Skip to content

evan-liu/xface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xface: Simple UI-Unit develop tool.

It’s simple AsUnit/FlexUnit 4 style UI-Unit framework, but not for testing. It’s a tool to reach and verify UI implementation fast.

Demo 1 | Source
Demo 2 | Source

Example

Runner:

public class DemoRunner extends Sprite
{
    public function DemoRunner()
    {
        super();
        XFace.run(this, AllUnits);
    }
}

Suite:

[Suite]
// Use "label" to change the display name of the suite.
// [Suite(label="All elements")]
public class AllUnits
{
    public var _TextUnit:TextUnit;
    public var _ShapeSuite:ShapeSuite;
    public var _MinimalSuite:MinimalSuite;
}

Use variables will not have the same order. To have the order use suite method (use “suite” as method name and return an Array with classes):

[Suite]
public class AllUnits
{
    public static function suite():Array
    {
        return [
            TextUnit,
            ShapeSuite,
            MinimalSuite
        ];
    }
}

Unit:

public class PushButtonUnit
{
    private var instance:PushButton;

    [Before]
    public function setUp():void
    {
        instance = new PushButton();
        XFace.display(instance, 10, 30);
    }
    [After]
    public function tearDown():void
    {
        instance = null;
    }
    [Test]
    public function toggle_is_false():void
    {
        instance.label = "Click me";
        instance.toggle = false;
    }
    [Test]
    public function toggle_is_true():void
    {
        instance.label = "Click me";
        instance.toggle = true;
        instance.selected = true;
    }
}