Beispiel #1
0
        public async Task TheTimePickerCsCzTest()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <DateAndTimePickerWindow>().ConfigureAwait(false);

            window.Invoke(() =>
            {
                Assert.NotNull(window.TheTimePickerCsCz.SelectedDateTime);
                Assert.NotNull(window.TheTimePickerCsCz.Culture);
                Assert.False(window.TheTimePickerCsCz.IsMilitaryTime);
                Assert.Equal("cs-CZ", window.TheTimePickerCsCz.Culture.IetfLanguageTag);
                Assert.Equal("22:23:24", window.TheTimePickerCsCz.FindChild <DatePickerTextBox>(string.Empty).Text);
            });
        }
Beispiel #2
0
        public async Task FindFlyoutWithFindChildren()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <FlyoutWindow>();

            var ex = Record.Exception(() =>
            {
                var flyouts      = (window.Content as DependencyObject).FindChildren <Flyout>(true);
                var flyoutOnGrid = flyouts.FirstOrDefault(f => f.Name == "FlyoutOnGrid");
                Assert.NotNull(flyoutOnGrid);
            });

            Assert.Null(ex);
        }
Beispiel #3
0
        public KorbanLakiDialog()
        {
            InitializeComponent();


            var win    = WindowHelpers.GetWindow();
            var result = win.Width;

            this.Width  = result * 80 / 100;
            this.Height = win.Height * 80 / 100;
            var data = DataAccess.DataBasic.DataPengaduan.Where(x => x.Korban.Where(z => z.Gender == Gender.L).Count() > 0).Count();

            this.Title       = $"Jumlah korban kekerasan dengan gender Laki-Laki tahun {DateTime.Now.Year} adalah {data} jiwa ";
            this.DataContext = this;
        }
Beispiel #4
0
        public async Task RaisesIsOpenChangedEvent()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <FlyoutWindow>();

            bool eventRaised = false;

            window.RightFlyout.IsOpenChanged += (sender, args) => { eventRaised = true; };

            window.RightFlyout.IsOpen = true;

            // IsOpen fires IsOpenChangedEvent with DispatcherPriority.Background
            window.RightFlyout.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => Assert.True(eventRaised)));
        }
        public async Task HiddenIconIsBelowFlyout()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <FlyoutWindow>();

            window.LeftWindowCommandsOverlayBehavior = WindowCommandsOverlayBehavior.Never;
            window.LeftFlyout.IsOpen = true;

            var exposedWindow        = Exposed.From(window);
            int windowCommandsZIndex = Panel.GetZIndex(exposedWindow.icon);
            int flyoutindex          = Panel.GetZIndex(window.LeftFlyout);

            Assert.True(flyoutindex < windowCommandsZIndex);
        }
Beispiel #6
0
        public async Task DateTimePickerSetCulture()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <DateAndTimePickerWindow>().ConfigureAwait(false);

            window.Invoke(() =>
            {
                Assert.NotNull(window.TheDateTimePicker.SelectedDateTime);
                Assert.NotNull(window.TheDateTimePicker.Culture);
                Assert.False(window.TheDateTimePicker.IsMilitaryTime);
                Assert.Equal("pt-BR", window.TheDateTimePicker.Culture.IetfLanguageTag);
                Assert.Equal("31/08/2016 14:00:01", window.TheDateTimePicker.FindChild <DatePickerTextBox>(string.Empty).Text);
            });
        }
        public async Task ChangesWindowTheme()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <MetroWindow>();

            Accent   expectedAccent = ThemeManager.Accents.First(x => x.Name == "Teal");
            AppTheme expectedTheme  = ThemeManager.GetAppTheme("BaseDark");

            ThemeManager.ChangeAppStyle(Application.Current, expectedAccent, expectedTheme);

            var theme = ThemeManager.DetectAppStyle(window);

            Assert.Equal(expectedTheme, theme.Item1);
            Assert.Equal(expectedAccent, theme.Item2);
        }
Beispiel #8
0
        public async Task MilitaryTimeShouldBeConvertedToDateTime()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <DateAndTimePickerWindow>(
                w => { w.EmptyTimePicker.Focus(); }
                );

            var timePicker        = window.EmptyTimePicker;
            var datePickerTextBox = timePicker.FindChild <DatePickerTextBox>(string.Empty);

            datePickerTextBox.Text = "2:42:12 PM";
            datePickerTextBox.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

            Assert.Equal(default(DateTime) + new TimeSpan(14, 42, 12), timePicker.SelectedDateTime);
        }
Beispiel #9
0
        public async Task MinMaxCloseButtonsShouldBeHidden()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <HiddenMinMaxCloseButtonsWindow>();

            var minButton   = this.GetButton(window, "PART_Min");
            var maxButton   = this.GetButton(window, "PART_Max");
            var closeButton = this.GetButton(window, "PART_Close");

            // min/max/close should be hidden
            Assert.False(minButton.IsVisible);
            Assert.False(maxButton.IsVisible);
            Assert.False(closeButton.IsVisible);
            Assert.Equal(ResizeMode.CanResize, window.ResizeMode);
        }
        public async Task MinMaxCloseButtonsShouldBeVisibleByDefault()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <MetroWindow>();

            var minButton   = GetButton(window, "PART_Min");
            var maxButton   = GetButton(window, "PART_Max");
            var closeButton = GetButton(window, "PART_Close");

            // min/max/close should be visible
            Assert.True(minButton.IsVisible);
            Assert.True(maxButton.IsVisible);
            Assert.True(closeButton.IsVisible);
            Assert.Equal(ResizeMode.CanResize, window.ResizeMode);
        }
Beispiel #11
0
    private void Update()
    {
        if (_waitingState == WaitingState.WaitingForCalibrationToStart &&
            _host.EyeTrackingDeviceStatus == EyeXDeviceStatus.Pending)
        {
            print("Waiting for calibration to finish");
            _waitingState = WaitingState.WaitingForCalibrationToFinish;
        }
        else if (_waitingState == WaitingState.WaitingForCalibrationToFinish &&
                 _host.EyeTrackingDeviceStatus == EyeXDeviceStatus.Tracking)
        {
            print("Calibration finished. Bring back focus to application");
            WindowHelpers.ShowCurrentWindow();

            StopWaitingForCalibration();
        }
    }
Beispiel #12
0
        public async Task TestAutoWatermark()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <AutoWatermarkTestWindow>().ConfigureAwait(false);

            window.Invoke(() =>
            {
                var autoWatermark = "AutoWatermark";

                Assert.Equal(autoWatermark, window.TestTextBox.GetValue(TextBoxHelper.WatermarkProperty));
                Assert.Equal(autoWatermark, window.TestTextBoxSubModel.GetValue(TextBoxHelper.WatermarkProperty));
                Assert.Equal(autoWatermark, window.TestComboBox.GetValue(TextBoxHelper.WatermarkProperty));
                Assert.Equal(autoWatermark, window.TestNumericUpDown.GetValue(TextBoxHelper.WatermarkProperty));
                Assert.Equal(autoWatermark, window.TestDatePicker.GetValue(TextBoxHelper.WatermarkProperty));
            });
        }
Beispiel #13
0
        public KorbanPerempuanDialog()
        {
            InitializeComponent();

            var win    = WindowHelpers.GetWindow();
            var result = win.Width;

            this.Width  = result * 80 / 100;
            this.Height = win.Height * 80 / 100;
            var data = from a in DataAccess.DataBasic.DataPengaduan
                       from korban in a.Korban
                       where korban.Gender == Gender.P
                       select korban;

            this.Title       = $"Jumlah korban kekerasan dengan gender Perempuan tahun {DateTime.Now.Year} adalah {data.Count()} jiwa ";
            this.DataContext = this;
        }
Beispiel #14
0
        public async Task _02_HandleUpdates_NonBeta()
        {
            try
            {
                VersionTuple initialVersions = await this.GetVersionsFromApp(Apps.PackageNames.AutomaticTestsClientAppV1, SharedTestHelpers.GetMethodName()).ConfigureAwait(false);

                UpdateCheckResult result = this.LaunchTestsAppNewInstanceAndGetResult <UpdateCheckResult>(out FileInfo appFile, Actions.HandleUpdates, Apps.Keys.AutomaticTestsClient, Apps.PackageNames.AutomaticTestsClientAppV1
                                                                                                          , SharedTestHelpers.GetMethodName(), waitForExit: false);

                Window updateNowMsgBox =
                    await WindowHelpers.WaitForWindowAsync(x => x.Equals("AutomaticTestsClient update installation"), TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                this.CheckProperUpdateVersionDownloadedInMessageBo(updateNowMsgBox, "2.");

                updateNowMsgBox.Get <Button>(SearchCriteria.ByText("Yes")).Click();
                Log("Clicked yes");
                Window updater = await WindowHelpers.WaitForWindowAsync(x => x.Contains("AutomaticTestsClient Updater"), TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                updater.Get <Button>(SearchCriteria.ByText("Install now!")).Click();
                Log("Clicked Install now!");

                Window doneMsg = await WindowHelpers.WaitForMessageBoxAsync(updater, "Update complete", TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                doneMsg.Get <Button>(SearchCriteria.ByText("Yes")).Click();
                Log("Clicked yes");

                Window appWarning = await WindowHelpers.WaitForWindowAsync(x => x.Equals("AutomaticTestsClient - This app requires arguments to run")
                                                                           , TimeSpan.FromMinutes(2)).ConfigureAwait(false);

                Log("Reading versions");

                VersionTuple newVersions = await this.GetVersionFromMsgBox(appWarning).ConfigureAwait(false);

                this.AssertVersionAreCorrect(newVersions, initialVersions, appFile, "2.");

                Log("Checking update info is false");
                //now just assert that the update check result is empty next time
                result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.CheckAndInstallUpdates, Apps.Keys.AutomaticTestsClient, waitForExit: true);

                this.AssertNoNonBetaUpdatesToInstall(result, true);
            }
            catch (Exception ex)
            {
                throw this.CleanupAndRethrow(ex);
            }
        }
Beispiel #15
0
        public async Task RaisesIsOpenChangedEvent()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <FlyoutWindow>();

            bool eventRaised = false;

            window.RightFlyout.IsOpenChanged += (sender, args) =>
            {
                eventRaised = true;
            };

            window.RightFlyout.IsOpen = true;

            Assert.True(eventRaised);
        }
Beispiel #16
0
        public async Task AdaptsWindowCommandsToDarkFlyout()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <FlyoutWindow>();

            var flyout = new Flyout {
                Theme = FlyoutTheme.Dark
            };

            window.Flyouts.Items.Add(flyout);

            flyout.IsOpen = true;

            Color expectedColor = ((SolidColorBrush)ThemeManager.GetAppTheme("BaseDark").Resources["BlackBrush"]).Color;

            window.AssertWindowCommandsColor(expectedColor);
        }
Beispiel #17
0
        public async Task DefaultWindowCommandColorIsBlack()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <CleanWindow>().ConfigureAwait(false);

            var theme = ThemeManager.Current.DetectTheme();

            Assert.NotNull(theme);

            var brush = theme.Resources["MahApps.Brushes.ThemeForeground"] as SolidColorBrush;

            Assert.NotNull(brush);

            var blackBrushColor = brush.Color;

            window.AssertWindowCommandsColor(blackBrushColor);
        }
Beispiel #18
0
        public async Task DefaultButtonRespectsControlsHelperContentCharacterCasing()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <ButtonWindow>();

            Button defaultButton = window.DefaultButton;
            var    presenter     = defaultButton.FindChild <ContentPresenter>("PART_ContentPresenter");

            ControlsHelper.SetContentCharacterCasing(defaultButton, CharacterCasing.Normal);
            Assert.Equal("SomeText", presenter.Content);

            ControlsHelper.SetContentCharacterCasing(defaultButton, CharacterCasing.Lower);
            Assert.Equal("sometext", presenter.Content);

            ControlsHelper.SetContentCharacterCasing(defaultButton, CharacterCasing.Upper);
            Assert.Equal("SOMETEXT", presenter.Content);
        }
        public async Task ReceivesDataContext()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <DialogWindow>();

            var vm     = new TheViewModel();
            var dialog = (CustomDialog)window.Resources["CustomDialog"];

            await window.ShowMetroDialogAsync(dialog);

            await TestHost.SwitchToAppThread(); // No idea why we have to do this again

            dialog.DataContext = vm;
            var textBlock = dialog.FindChild <TextBlock>("TheDialogBody");

            Assert.Equal(vm.Text, textBlock.Text);
        }
 public void OnBlockCreated(ITextBuffer editorBuffer, LanguageProjectionBuffer projectionBuffer)
 {
     WindowHelpers.WaitFor(delegate
     {
         var textView = TextViewConnectionListener.GetFirstViewForBuffer(editorBuffer);
         if (textView == null)
         {
             return(false);
         }
         // Attach the inner buffer's Document to the outer
         // buffer so that it can be found from the TextView
         var editorDocument = JSONEditorDocument.FromTextBuffer(projectionBuffer.IProjectionBuffer)
                              ?? JSONEditorDocument.Attach(projectionBuffer.IProjectionBuffer);
         ServiceManager.AddService(editorDocument, editorBuffer);
         editorDocument.Closing += delegate { ServiceManager.RemoveService <JSONEditorDocument>(textView.TextBuffer); };
         return(true);
     });
 }
Beispiel #21
0
        private void WindowService()
        {
            while (!_exitServiceThread)
            {
                Thread.Sleep(100);

                if (!IsVisible)
                {
                    continue;
                }

                if (BypassTopmost)
                {
                    var windowAboveParentWindow = User32.GetWindow(ParentWindowHandle, 3 /* GW_HWNDPREV */);

                    if (windowAboveParentWindow != WindowHandle)
                    {
                        User32.SetWindowPos(WindowHandle, windowAboveParentWindow, 0, 0, 0, 0,
                                            0x10 | 0x2 | 0x1 | 0x4000); // SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_ASYNCWINDOWPOS
                    }
                }

                if (!WindowHelpers.GetWindowClientRectInternal(ParentWindowHandle, out var bounds))
                {
                    continue;
                }

                int x = bounds.Left;
                int y = bounds.Top;

                int width  = bounds.Right - x;
                int height = bounds.Bottom - y;

                if (X == x &&
                    Y == y &&
                    Width == width &&
                    Height == height)
                {
                    continue;
                }

                SetWindowBounds(x, y, width, height);
            }
        }
Beispiel #22
0
        public async Task TestAttachedPropertyButtonTemplate()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <TextBoxHelperTestWindow>().ConfigureAwait(false);

            window.Invoke(() =>
            {
                var controlTemplate = new ControlTemplate(typeof(Button));

                window.TestButtonTextBox.SetValue(TextBoxHelper.ButtonTemplateProperty, controlTemplate);
                Assert.Equal(controlTemplate, window.TestButtonTextBox.FindChild <Button>("PART_ClearText").Template);

                window.TestButtonPasswordBox.SetValue(TextBoxHelper.ButtonTemplateProperty, controlTemplate);
                Assert.Equal(controlTemplate, window.TestButtonPasswordBox.FindChild <Button>("PART_ClearText").Template);
                window.TestButtonRevealedPasswordBox.SetValue(TextBoxHelper.ButtonTemplateProperty, controlTemplate);
                Assert.Equal(controlTemplate, window.TestButtonRevealedPasswordBox.FindChild <Button>("PART_ClearText").Template);
            });
        }
        public void CloseWithHiddenFloatingWindowsTest()
        {
            TestHost.SwitchToAppThread();
            Task <LayoutAnchorableFloatingWindowControlTestWindow> taskResult = WindowHelpers.CreateInvisibleWindowAsync <LayoutAnchorableFloatingWindowControlTestWindow>();

            taskResult.Wait();

            LayoutAnchorableFloatingWindowControlTestWindow window = taskResult.Result;

            window.Window1.Float();
            Assert.IsTrue(window.Window1.IsFloating);
            var layoutSerializer = new XmlLayoutSerializer(window.dockingManager);

            layoutSerializer.Serialize(@".\AvalonDock.Layout.config");
            window.tabControl.SelectedIndex = 1;
            layoutSerializer.Deserialize(@".\AvalonDock.Layout.config");
            window.tabControl.SelectedIndex = 0;
            window.Close();
        }
Beispiel #24
0
        public async Task WindowCommandsForegroundBrushShouldBeAlwaysOverrideDefaultWindowCommandsBrush()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <FlyoutWindow>();

            window.OverrideDefaultWindowCommandsBrush = Brushes.Red;

            window.RightFlyout.IsOpen = true;
            Assert.Equal(Brushes.Red, window.RightWindowCommands.Foreground);

            window.RightFlyout.IsOpen = false;
            Assert.Equal(Brushes.Red, window.RightWindowCommands.Foreground);

            window.LeftFlyout.IsOpen = true;
            Assert.Equal(Brushes.Red, window.LeftWindowCommands.Foreground);

            window.LeftFlyout.IsOpen = false;
            Assert.Equal(Brushes.Red, window.LeftWindowCommands.Foreground);
        }
        public async Task _03_CheckAndInstallUpdates_NonBeta()
        {
            try
            {
                VersionTuple initialVersions    = this.GetVersionsFromExtractedAppFile(Apps.PackageNames.AutomaticTestsClientAppV1, SharedTestHelpers.GetMethodName(), out FileInfo appFile);
                var          installationResult = this.LaunchTestsAppAndGetResult <UpdateInstallationResult>(appFile, Actions.CheckAndInstallUpdates, Apps.Keys.AutomaticTestsClient, waitForExit: false);

                if (installationResult?.Exception != null)
                {
                    throw installationResult.Exception;
                }

                Window updater = await WindowHelpers.WaitForWindowAsync(x => x.Contains("AutomaticTestsClient Updater"), TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                this.CheckProperUpdateVersionDownloadedInUpdater(updater, "2.");
                WindowHelpers.ClickButtonByText(updater, "Install now!");

                Log("Clicked Install now!");

                Window doneMsg = await WindowHelpers.WaitForMessageBoxAsync(updater, "Update complete", TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                WindowHelpers.ClickButtonByText(doneMsg, "Yes");
                Log("Clicked yes");

                VersionTuple newVersions = this.GetVersionsFromApp(appFile);
                Log($"New versions: {newVersions.ToLog()}");

                this.AssertVersionAreCorrect(newVersions, initialVersions, appFile, "2.");

                //now just assert that the update check result is empty next time
                Log("Checking update info is false");

                UpdateCheckResult result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.CheckAndInstallUpdates, Apps.Keys.AutomaticTestsClient, waitForExit: true);
                this.AssertNoNonBetaUpdatesToInstall(result, true);
            }
            catch (Exception ex)
            {
                this.CleanupAndLog(ex);
                throw;
            }
        }
Beispiel #26
0
        public void AnchorablePaneHideCloseTest()
        {
            TestHost.SwitchToAppThread();

            Task <AnchorablePaneTestWindow> taskResult = WindowHelpers.CreateInvisibleWindowAsync <AnchorablePaneTestWindow>();

            taskResult.Wait();

            AnchorablePaneTestWindow windows = taskResult.Result;

            ILayoutContainer expectedContainer = windows.Screen3.Parent;

            windows.Screen3.Hide();
            Assert.IsTrue(windows.Screen3.IsHidden);
            windows.Screen2.Close();
            windows.Screen3.Show();
            Assert.IsFalse(windows.Screen3.IsHidden);
            ILayoutContainer actualContainer = windows.Screen3.Parent;

            Assert.AreEqual(expectedContainer, actualContainer);
        }
        public async Task MinMaxButtonsShouldBeHiddenWithNoResizeMode()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <MetroWindow>();

            var minButton = GetButton(window, "PART_Min");
            var maxButton = GetButton(window, "PART_Max");

            // min/max should be visible
            Assert.True(minButton.IsVisible);
            Assert.True(maxButton.IsVisible);
            Assert.Equal(ResizeMode.CanResize, window.ResizeMode);

            window.ResizeMode = ResizeMode.NoResize;

            // min/max should be hidden
            Assert.False(minButton.IsVisible);
            Assert.False(maxButton.IsVisible);
            Assert.Equal(ResizeMode.NoResize, window.ResizeMode);
        }
Beispiel #28
0
        public MessageBoxView()
        {
            InitializeComponent();

            MessageBoxViewModel vm = (MessageBoxViewModel)DataContext;

            vm.PropertyChanged += (_, args) => {
                if (args.PropertyName == nameof(vm.Message))
                {
                    InlineExpression.SetInlineExpression(MessageBlock, vm.Message);
                }
            };

            Loaded += (_, _) => {
                // Window Setup
                _window = Window.GetWindow(this);
                Debug.Assert(_window != null, nameof(_window) + " != null");

                _window.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));

                (double dpiWidthFactor, double dpiHeightFactor) = WindowHelpers.GetDpiFactors(_window);
                Rect screen = vm.openOnScreen?.WorkingArea ?? _window.CurrentScreen().WorkingArea;
                _window.CenterOnScreen(screen, dpiWidthFactor, dpiHeightFactor);


                //Set the window style to noactivate.
                if (!vm.getsFocus)
                {
                    var helper = new WindowInteropHelper(_window);
                    SetWindowLong(helper.Handle, GWL_EXSTYLE, GetWindowLong(helper.Handle, GWL_EXSTYLE) | WS_EX_NOACTIVATE);
                }
            };

            MouseDown += (_, e) => {
                if (e.ChangedButton == MouseButton.Left)
                {
                    _window.DragMove();
                }
            };
        }
Beispiel #29
0
        public async Task _05_CheckAndInstallUpdates_Beta()
        {
            try
            {
                VersionTuple initialVersions = this.GetVersionsFromExtractedAppFile(Apps.PackageNames.AutomaticTestsClientAppV1, SharedTestHelpers.GetMethodName(), out FileInfo appFile);

                this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.HandleUpdatesWithBeta, Apps.Keys.AutomaticTestsClient, waitForExit: false);

                Window updateNowMsgBox =
                    await WindowHelpers.WaitForWindowAsync(x => x.Equals("AutomaticTestsClient update installation"), TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                updateNowMsgBox.Get <Button>(SearchCriteria.ByText("Yes")).Click();
                Log("Clicked yes");

                Window updater = await WindowHelpers.WaitForWindowAsync(x => x.Contains("AutomaticTestsClient Updater"), TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                updater.Get <Button>(SearchCriteria.ByText("Install now!")).Click();
                Log("Clicked Install now!");

                Window doneMsg = await WindowHelpers.WaitForMessageBoxAsync(updater, "Update complete", TimeSpan.FromMinutes(1)).ConfigureAwait(false);

                doneMsg.Get <Button>(SearchCriteria.ByText("No")).Click();
                Log("Clicked no");

                VersionTuple newVersions = this.GetVersionsFromFile(appFile);

                this.AssertVersionAreCorrect(newVersions, initialVersions, appFile, "3.");

                //now just assert that the update check result is empty next time
                Log("Checking update info is false");
                UpdateCheckResult result = this.LaunchTestsAppAndGetResult <UpdateCheckResult>(appFile, Actions.CheckAndInstallUpdates, Apps.Keys.AutomaticTestsClient, waitForExit: true);

                this.AssertNoNonBetaUpdatesToInstall(result, false);
            }
            catch (Exception ex)
            {
                throw this.CleanupAndRethrow(ex);
            }
        }
Beispiel #30
0
        public async Task TestAttachedPropertyButtonWidth()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync <TextBoxHelperTestWindow>().ConfigureAwait(false);

            window.Invoke(() =>
            {
                var width = 42d;

                window.TestTextBox.SetValue(TextBoxHelper.ButtonWidthProperty, width);
                Assert.Equal(width, window.TestTextBox.FindChild <Button>("PART_ClearText").Width);
                window.TestButtonTextBox.SetValue(TextBoxHelper.ButtonWidthProperty, width);
                Assert.Equal(width, window.TestButtonTextBox.FindChild <Button>("PART_ClearText").Width);

                window.TestPasswordBox.SetValue(TextBoxHelper.ButtonWidthProperty, width);
                Assert.Equal(width, window.TestPasswordBox.FindChild <Button>("PART_ClearText").Width);
                window.TestButtonPasswordBox.SetValue(TextBoxHelper.ButtonWidthProperty, width);
                Assert.Equal(width, window.TestButtonPasswordBox.FindChild <Button>("PART_ClearText").Width);
                window.TestButtonRevealedPasswordBox.SetValue(TextBoxHelper.ButtonWidthProperty, width);
                Assert.Equal(width, window.TestButtonRevealedPasswordBox.FindChild <Button>("PART_ClearText").Width);
                Assert.Equal(width, window.TestButtonRevealedPasswordBox.FindChild <Button>("PART_RevealButton").Width);

                window.TestComboBox.SetValue(TextBoxHelper.ButtonWidthProperty, width);
                var toggleButton = window.TestComboBox.FindChild <ToggleButton>("PART_DropDownToggle");
                Assert.Equal(width, toggleButton.FindChild <Button>("PART_ClearText").Width);
                Assert.Equal(width, toggleButton.FindChild <Grid>("BtnArrowBackground").Width);

                window.TestEditableComboBox.SetValue(TextBoxHelper.ButtonWidthProperty, width);
                var edTextBox = window.TestEditableComboBox.FindChild <TextBox>("PART_EditableTextBox");
                Assert.Equal(width, edTextBox.FindChild <Button>("PART_ClearText").Width);

                window.TestNumericUpDown.SetValue(TextBoxHelper.ButtonWidthProperty, width);
                Assert.Equal(width, window.TestNumericUpDown.FindChild <Button>("PART_ClearText").Width);

                window.TestHotKeyBox.SetValue(TextBoxHelper.ButtonWidthProperty, width);
                Assert.Equal(width, window.TestHotKeyBox.FindChild <Button>("PART_ClearText").Width);
            });
        }