Exemple #1
0
 private void NextTestcase()
 {
     _pressButton = NavigationButton.Next;
     if (!ManualTest.IsConfirmed())
     {
         _tsettings.TCResult = StrResult.NOTRUN;
         ManualTest.Confirm();
     }
     else
     {
         Next();
     }
 }
Exemple #2
0
 private void PreviousTestcase()
 {
     _pressButton = NavigationButton.Previous;
     if (!ManualTest.IsConfirmed())
     {
         _tsettings.TCResult = StrResult.NOTRUN;
         ManualTest.Confirm();
     }
     else
     {
         Previous();
     }
 }
Exemple #3
0
        private void MakeTestPage()
        {
            _mainLayout = new StackLayout()
            {
                Orientation       = StackOrientation.Vertical,
                IsVisible         = true,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Spacing           = 5,
                Padding           = new Thickness(10),
            };
            _descriptionTitle = new Label()
            {
                Text = "DESCRIPTION:",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                HeightRequest     = 23,
                Margin            = new Thickness(40, 0, 0, 0),
                FontSize          = 5,
                TextColor         = Color.White,
            };

            StackLayout functionLayout = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                IsVisible         = true,
                HeightRequest     = 30,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                Spacing           = 2,
                Margin            = new Thickness(0, 0, 0, 15)
            };

            _mainBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "H",
                HeightRequest = 30,
                WidthRequest  = 55,
                FontSize      = 5
            };

            _mainBtn.Clicked += (sender, e) =>
            {
                _pressButton = NavigationButton.Home;
                if (!ManualTest.IsConfirmed())
                {
                    _tsettings.TCResult = StrResult.NOTRUN;
                    ManualTest.Confirm();
                }
                else
                {
                    _navigationPage.PopAsync();
                }
            };

            _prevBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "<<",
                HeightRequest = 30,
                WidthRequest  = 55,
                FontSize      = 4
            };

            _prevBtn.Clicked += (sender, e) =>
            {
                PreviousTestcase();
            };

            _nextBtn = new Button()
            {
                Text = ">>",
                HorizontalOptions = LayoutOptions.Start,
                HeightRequest     = 30,
                WidthRequest      = 55,
                FontSize          = 4
            };

            _nextBtn.Clicked += (sender, e) =>
            {
                NextTestcase();
            };

            _tcResultText = new Label()
            {
                HorizontalOptions       = LayoutOptions.Start,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                HeightRequest           = 30,
                FontSize = 3
            };
            functionLayout.Children.Add(_mainBtn);
            functionLayout.Children.Add(_tcResultText);
            functionLayout.Children.Add(_prevBtn);
            functionLayout.Children.Add(_nextBtn);
            // Show description
            ShowDescription();

            var navigationLayout = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                IsVisible         = true,
                HeightRequest     = 30,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                Spacing           = 5,
            };

            _passBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "P",
                HeightRequest = 30,
                IsEnabled     = false,
                FontSize      = 5,
                WidthRequest  = 60
            };

            _passBtn.Clicked += (sender, e) =>
            {
                if (!ManualTest.IsConfirmed())
                {
                    _tsettings.TCResult = StrResult.PASS;
                    ManualTest.Confirm();
                }
            };

            _failBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "F",
                HeightRequest = 30,
                IsEnabled     = false,
                FontSize      = 5,
                WidthRequest  = 60
            };

            _failBtn.Clicked += (sender, e) =>
            {
                if (!ManualTest.IsConfirmed())
                {
                    _tsettings.TCResult = StrResult.FAIL;
                    ManualTest.Confirm();
                }
            };

            _blockBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "B",
                HeightRequest = 30,
                IsEnabled     = false,
                FontSize      = 5,
                WidthRequest  = 60
            };

            _blockBtn.Clicked += (sender, e) =>
            {
                if (!ManualTest.IsConfirmed())
                {
                    _tsettings.TCResult = StrResult.BLOCK;
                    ManualTest.Confirm();
                }
            };

            _runBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "R",
                HeightRequest = 30,
                FontSize      = 5,
                WidthRequest  = 60
            };

            _runBtn.Clicked += (sender, e) =>
            {
                LockUIButton();
                _pressButton           = NavigationButton.NA;
                _tsettings.Testcase_ID = _tcIDList[_tcIndex];
                _tsettings.TCResult    = "";
                _tunitRunner.Execute();
            };

            navigationLayout.Children.Add(_passBtn);
            navigationLayout.Children.Add(_failBtn);
            navigationLayout.Children.Add(_blockBtn);
            navigationLayout.Children.Add(_runBtn);

            _tcUILayout = new StackLayout()
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                HeightRequest     = 40,
                WidthRequest      = 280,
                Margin            = new Thickness(10, 0, 10, 0)
            };

            _mainLayout.Children.Add(_summaryLabel1);
            _mainLayout.Children.Add(_summaryLabel2);
            _mainLayout.Children.Add(_descriptionTitle);
            _mainLayout.Children.Add(_tcDescriptions);
            _mainLayout.Children.Add(_tcUILayout);
            _mainLayout.Children.Add(navigationLayout);
            _mainLayout.Children.Add(functionLayout);
            _tcContentPage = new ContentPage()
            {
                Content = _mainLayout
            };
            NavigationPage.SetHasNavigationBar(_tcContentPage, false);
        }