示例#1
0
    public void Next()
    {
        var window = NUIApplication.GetDefaultWindow();

        if (currentIndex == list.Count)
        {
            currentTest?.OnDestroy(currentView);
            window.Remove(currentView);
            currentView          = null;
            testDescription.Text = "All test is done!";
            window.Remove(runningDescription);
            window.Remove(passCondition);
            testDone = true;
            return;
        }

        string   testName = list[currentIndex++];
        TestUnit testUnit = this.GetType().Assembly.CreateInstance(testName) as TestUnit;

        if (testUnit == null)
        {
            Next();
            return;
        }

        if (currentTest != null)
        {
            currentTest.OnDestroy(currentView);
            window.Remove(currentView);
            currentView = null;
        }
        currentTest = testUnit;

        if (testDescription == null)
        {
            testDescription = new TextLabel
            {
                TextColor              = Color.White,
                MultiLine              = true,
                BackgroundColor        = new Color(0.2f, 0.2f, 0.2f, 1.0f),
                PixelSize              = 12,
                Position               = new Position(0, 880),
                Size                   = new Size(720, 400),
                PositionUsesPivotPoint = true,
                ParentOrigin           = ParentOrigin.TopLeft,
                PivotPoint             = PivotPoint.TopLeft,
            };
            window.Add(testDescription);
            testDescription.TouchEvent += OnDescriptionTouch;
        }

        if (runningDescription == null)
        {
            runningDescription = new TextLabel
            {
                TextColor              = Color.Black,
                MultiLine              = true,
                BackgroundColor        = new Color(0.8f, 0.8f, 0.8f, 1.0f),
                PixelSize              = 12,
                Size                   = new Size(710, 175),
                Position               = new Position(5, 920),
                PositionUsesPivotPoint = true,
                ParentOrigin           = ParentOrigin.TopLeft,
                PivotPoint             = PivotPoint.TopLeft,
            };
            window.Add(runningDescription);
        }

        if (passCondition == null)
        {
            passCondition = new TextLabel
            {
                TextColor              = Color.Black,
                MultiLine              = true,
                BackgroundColor        = new Color(0.8f, 0.8f, 0.8f, 1.0f),
                PixelSize              = 12,
                Size                   = new Size(710, 175),
                Position               = new Position(5, 1105),
                PositionUsesPivotPoint = true,
                ParentOrigin           = ParentOrigin.TopLeft,
                PivotPoint             = PivotPoint.TopLeft,
            };
            window.Add(passCondition);
        }

        currentView = TestUtils.CreateEmptyView();
        testUnit.OnCreate(currentView);
        testDescription.Text    = "<TC: " + testName + ">\n" + testUnit.TestDescription;
        runningDescription.Text = "[First Look]\n" + testUnit.RunningDescription;
        passCondition.Text      = "[Pass Condition]\n" + testUnit.PassCondition;
        window.Add(currentView);
    }