-1)
{
expect_width=300;
expect_height=372;
}else if (current_os.indexOf("linux")>-1)
{
}
var nw:NativeWindow=myWin.nativeWindow;
var errMsg:String="";
if (nw.width!=expect_width)
errMsg+="width not expected, nw.width="+nw.width+";expect="+expect_width+"\n";
if (nw.height!=expect_height)
errMsg+="height not expected, nw.height="+nw.height+";expect="+expect_height+"\n";
if (nw.resizable!=myWin.resizable)
errMsg+="resizable not expected, nw.resizable="+nw.resizable+";expect="+myWin.resizable+"\n";
if (nw.minimizable!=myWin.minimizable)
errMsg+="minimizable not expected, nw.minimizable="+nw.minimizable+";expect="+myWin.minimizable+"\n";
if (nw.maximizable!=myWin.maximizable)
errMsg+="maximizable not expected, nw.maximizable="+nw.maximizable+";expect="+myWin.maximizable+"\n";
if (nw.type!=myWin.type)
errMsg+="type not expected, nw.type="+nw.type+";expect="+myWin.type+"\n";
if (nw.systemChrome!=myWin.systemChrome)
errMsg+="systemChrome not expected, nw.systemChrome="+nw.systemChrome+";expect="+myWin.systemChrome+"\n";
return errMsg;
}
public function updateWindow():void
{
myWin.width=400;
myWin.height=400;
myWin.title="updated title";
dispatchEvent(new FlexEvent("updateComplete"));
}
public function verifyNativeWindowUpdate():String
{
var errMsg:String="";
var current_os:String=Capabilities.os.toLowerCase();
var expect_width:Number=192, expect_height:Number=166;
if (current_os.indexOf("mac")>-1)
{
expect_width=200;
expect_height=178;
}else if (current_os.indexOf("linux")>-1)
{
}
trace("myWin.width="+myWin.width+";myWin.height="+myWin.height);
if (myWin.width!=expect_width)
errMsg+="width not expected, myWin.width="+myWin.width+";expect="+expect_width+"\n";
if (myWin.height!=expect_height)
errMsg+="height not expected, myWin.height="+myWin.height+";expect="+expect_height+"\n";
if( myWin.title=="test window")
errMsg+="title not expected, title should be changed in systemchrome skin, actual="+myWin.title;
return errMsg;
}
public function closeAllChildWindow():void
{
var win:Window;
while(childWindowList.length>0)
{
win=Window(childWindowList.pop());
if (win!=null && !win.closed)
win.close();
}
}
/**
* compare the actual value with expected value based on os. It returns an error string if comparison fails, otherwise an empty string.
* description: a string you can use to describe what is the test for, you can set it to null.
* actualVal: actual value used to compare for
* expectWinVal: expected value on window os
* expectMacVal: expected value on mac os
* expectLinuxVal: expected value on linux os
*/
public function assertValueBaseOnOS(description:String,actualVal:*,expectWinVal:*=null,expectMacVal:*=null,expectLinuxVal:*=null):String
{
var errMsg:String="";
var current_os:String=Capabilities.os.toLowerCase();
if (current_os.indexOf("window")>-1)
{
if (actualVal!=expectWinVal)
errMsg+="on os="+current_os+", actual value="+actualVal+";expected value="+expectWinVal;
}else if (current_os.indexOf("mac")>-1)
{
if (actualVal!=expectMacVal)
errMsg+="on os="+current_os+", actual value="+actualVal+";expected value="+expectMacVal;
}else if (current_os.indexOf("linux")>-1)
{
if (actualVal!=expectLinuxVal)
errMsg+="on os="+current_os+", actual value="+actualVal+";expected value="+expectLinuxVal;
}else {
errMsg+="on os="+current_os+" isn't supported";
}
if (description!=null && errMsg!="")
errMsg=description+" "+errMsg;
return errMsg;
}
]]>