public void InsertBoldText() { ScreenActionBuilder.Create().WithWindow(metlWindow.AutomationElement) .Ensure<HomeTabScreen>((home) => { if (!home.IsActive) home.OpenTab(); home.ActivateTextMode().TextInsertMode(); return true; }) .With<CollapsedCanvasStack>((canvas) => { var insertedText = canvas.InsertTextbox(canvas.RandomPointWithinMargin(-40, -40), "Bolded text"); var home = new HomeTabScreen(metlWindow.AutomationElement).ActivateTextMode(); canvas.SelectTextboxWithClick(insertedText); home.ToggleBoldText(); var slideNav = new SlideNavigation(metlWindow.AutomationElement); var currentPage = slideNav.CurrentPage; slideNav.WaitForPageChange(currentPage + 1, () => slideNav.Add()); slideNav.WaitForPageChange(currentPage, () => slideNav.Back()); home.IsBoldChecked.ShouldBeTrue(); }); }
public void ExtendCanvasViaContent() { ScreenActionBuilder.Create().WithWindow(metlWindow.AutomationElement) .Ensure<HomeTabScreen>(home => { if (!home.IsActive) home.OpenTab(); home.ActivateTextMode().TextInsertMode(); return true; }) .With<CollapsedCanvasStack>(canvas => { var slideNav = new SlideNavigation(metlWindow.AutomationElement); var randomPage = slideNav.DetermineToRandomPage(); slideNav.ChangeToPage(randomPage); canvas.Refresh(); var originalSize = canvas.BoundingRectangle; var inserted = canvas.InsertTextbox(new System.Drawing.Point((int)(originalSize.Width * 0.95), (int)(originalSize.Height / 2)), "Extend canvas size by content --------->"); canvas.Refresh(); Assert.IsFalse(originalSize.Equals(canvas.BoundingRectangle)); var currentPage = slideNav.CurrentPage; randomPage = slideNav.DetermineToRandomPage(currentPage); UITestHelper.Wait(TimeSpan.FromSeconds(3)); slideNav.WaitForPageChange(randomPage, () => slideNav.ChangeToPage(randomPage)); UITestHelper.Wait(TimeSpan.FromSeconds(3)); slideNav.WaitForPageChange(currentPage, () => slideNav.ChangeToPage(currentPage)); new HomeTabScreen(metlWindow.AutomationElement).ActivateTextMode().TextSelectMode(); canvas.Refresh(); foreach (AutomationElement textbox in canvas.ChildTextboxes) { canvas.SelectTextboxWithClick(textbox); UITestHelper.Wait(TimeSpan.FromMilliseconds(500)); canvas.DeleteSelectedContent(); UITestHelper.Wait(TimeSpan.FromMilliseconds(500)); } }); }