0)
{
win=TitleWindow(childWindowList.pop());
PopUpManager.removePopUp(win);
win=null;
}
}
public function resetTitleWindow():void
{
closePopUPs();
myWin=createTitleWindowByClass(TitleWindowWithContent4, "methods test window");
}
public function testAddElement():void
{
var b:spark.components.Button=new spark.components.Button();
b.label="new Button";
b.name="addElementTest";
b.y=70;
myWin.addElement(b);
}
public function testAddElementAt(index:Number):Boolean
{
var lb:Label=new Label();
lb.text="new label";
lb.x=30*(index+1)
var elementCount:Number=myWin.numElements;
myWin.addElementAt(lb,index);
var n:Number=myWin.numElements;
if ((elementCount+1)!=n)
return false;
var vElement:IVisualElement=myWin.getElementAt(index);
if (!(vElement is Label) || Label(vElement).text!=lb.text)
return false;
else return true;
}
public function testAddElementAtNegative(index:Number):Boolean
{
var lb:Label=new Label();
lb.text="new label";
lb.x=30;
try{
myWin.addElementAt(lb,index);//index isn't available
return false;//if no error, then test fails
}catch(e:Error)
{
}
return true;
}
public function testGetElementAt(pos:Number):Boolean
{
var iv:IVisualElement=myWin.getElementAt(pos);//this should return a button
var index:Number=myWin.getElementIndex(iv);
if (index!=pos)
{
return false;
}else
return true;
}
public function testGetElementIndexNegative():Boolean
{
var lb:Label=new Label();
lb.text="new label";
lb.x=30;
var index:Number=-1;
try
{
index=myWin.getElementIndex(lb);
}catch(e:Error)
{
}
if (index!=-1)
{
trace("###index="+index)
return false;
}
else return true;
}
public function testGetFirstButton():Boolean
{
var iv:IVisualElement=myWin.getElementAt(1);//this should return a button
if (iv is spark.components.Button)
{
var b:spark.components.Button=spark.components.Button(iv);
if (b.label.indexOf("test Button")>-1)
{
return true;
}
else
{
trace("###button label not expected");
return false;
}
}else
{
trace("###first element isn't a button");
return false;
}
}
public function testGetElementAtNegative(index:Number):Boolean
{
var iv:IVisualElement=null;
try
{
iv=myWin.getElementAt(index);
return false;
}catch(e:Error)
{
}
if (iv!=null)
return false;
else
return true;
}
public function testRemoveElement():Boolean
{
var iv:IVisualElement=myWin.getElementAt(2);//this should return the drop down list
myWin.removeElement(iv); //the drop down list is removed
var displayObj:DisplayObject=myWin.getChildByName("datagrid1");//try to get the dropdown list again
if (displayObj !=null)
return false;
else
return true;
}
public function testRemoveElement2():Boolean
{
testAddElement();
var num:Number=myWin.numElements;
var iv:IVisualElement;
var coll:ArrayCollection=new ArrayCollection();
for (var i:Number=0;i
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@namespace c "Comps.*";
@font-face {
src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Regular.ttf");
fontFamily: MyVera;
embedAsCFF: true;
}
@font-face {
src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Italic.ttf");
fontFamily: MyArial;
fontStyle: italic;
embedAsCFF: true;
}
@font-face {
src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Bold.ttf");
fontFamily: MyVera;
fontWeight: bold;
embedAsCFF: true;
}
@font-face {
src: url("../../../../../Assets/Fonts/PT_Serif/PT_Serif-Web-Regular.ttf");
fontFamily: MyArialHalo;
embedAsCFF: false;
}
@font-face {
src: url("../../../../../Assets/Fonts/PT_Serif/PT_Serif-Web-Italic.ttf");
fontFamily: MyArialHalo;
fontStyle: italic;
embedAsCFF: false;
}
@font-face {
src: url("../../../../../Assets/Fonts/PT_Serif/PT_Serif-Web-Bold.ttf");
fontFamily: MyArialHalo;
fontWeight: bold;
embedAsCFF: false;
}
mx|Accordion,
mx|RadioButton,
mx|CheckBox,
mx|List,
mx|DataGrid,
mx|Button,
mx|Text,
mx|Label,
mx|NumericStepper,
mx|ToolTip{
fontAntiAliasType: "normal";
fontFamily: MyArialHalo;
fontSize: 12;
}
s|TitleWindow,
s|Panel,
s|HSlider,
s|NumericStepper,
s|Button,
s|TextInput{
fontAntiAliasType: "normal";
fontFamily: MyVera;
fontSize: 12;
fontLookup: "embeddedCFF";
}