From 9f6821305cd42af54d7f9688ac289029c735dbd0 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Sun, 21 May 2017 22:08:32 -0700 Subject: [PATCH 1/2] Fix ClickingShowTerminalButtonOpensTerminal test - Remove test navigation to SettingsAndControls --- .../OptionsTabTests.cs | 19 +++++-------------- .../PrintingTests.cs | 5 ----- .../MatterControl/MatterControlUtilities.cs | 15 --------------- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/Tests/MatterControl.AutomationTests/OptionsTabTests.cs b/Tests/MatterControl.AutomationTests/OptionsTabTests.cs index 5bd0c73c9..737686be5 100644 --- a/Tests/MatterControl.AutomationTests/OptionsTabTests.cs +++ b/Tests/MatterControl.AutomationTests/OptionsTabTests.cs @@ -1,9 +1,6 @@ -using System; -using System.Threading; +using System.Threading; using System.Threading.Tasks; using MatterHackers.Agg.UI; -using MatterHackers.Agg.UI.Tests; -using MatterHackers.GuiAutomation; using NUnit.Framework; namespace MatterHackers.MatterControl.Tests.Automation @@ -14,30 +11,24 @@ namespace MatterHackers.MatterControl.Tests.Automation [Test, Apartment(ApartmentState.STA)] public async Task ClickingShowTerminalButtonOpensTerminal() { - AutomationTest testToRun = (testRunner) => + await MatterControlUtilities.RunTest((testRunner) => { testRunner.CloseSignInAndPrinterSelect(); - testRunner.ClickByName("SettingsAndControls", 5); - testRunner.Delay(2); testRunner.ClickByName("Options Tab", 6); - bool terminalWindowExists1 = testRunner.WaitForName("Gcode Terminal", 0); - Assert.IsTrue(terminalWindowExists1 == false, "Terminal Window does not exist"); + Assert.IsFalse(testRunner.WaitForName("Gcode Terminal", 0.5), "Terminal Window should not exist"); testRunner.ClickByName("Show Terminal Button", 6); testRunner.Delay(1); SystemWindow containingWindow; GuiWidget terminalWindow = testRunner.GetWidgetByName("Gcode Terminal", out containingWindow, 3); - Assert.IsTrue(terminalWindow != null, "Terminal Window exists after Show Terminal button is clicked"); + Assert.IsNotNull(terminalWindow, "Terminal Window should exists after Show Terminal button is clicked"); containingWindow.CloseOnIdle(); testRunner.Delay(.5); return Task.FromResult(0); - }; - - await MatterControlUtilities.RunTest(testToRun); + }); } - } } diff --git a/Tests/MatterControl.AutomationTests/PrintingTests.cs b/Tests/MatterControl.AutomationTests/PrintingTests.cs index 61808af81..3a91e987f 100644 --- a/Tests/MatterControl.AutomationTests/PrintingTests.cs +++ b/Tests/MatterControl.AutomationTests/PrintingTests.cs @@ -276,8 +276,6 @@ namespace MatterHackers.MatterControl.Tests.Automation { Assert.IsTrue(ProfileManager.Instance.ActiveProfile != null); - testRunner.SwitchToSettingsAndControls(); - testRunner.ClickByName("Controls Tab", 1); testRunner.ClickByName("Start Print Button", 1); @@ -352,7 +350,6 @@ namespace MatterHackers.MatterControl.Tests.Automation [Test, Apartment(ApartmentState.STA)] public async Task TuningAdjustmentControlsBoundToStreamValues() { - double targetExtrusionRate = 1.5; double targetFeedRate = 2; @@ -374,8 +371,6 @@ namespace MatterHackers.MatterControl.Tests.Automation { Assert.IsTrue(ProfileManager.Instance.ActiveProfile != null); - testRunner.SwitchToSettingsAndControls(); - testRunner.ClickByName("Controls Tab", 1); testRunner.ClickByName("Start Print Button", 1); diff --git a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs index 5b0ca9512..154fe7d8a 100644 --- a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs +++ b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs @@ -473,23 +473,8 @@ namespace MatterHackers.MatterControl.Tests.Automation Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } - public static void SwitchToSettingsAndControls(this AutomationRunner testRunner) - { - if (testRunner.WaitForName("SettingsAndControls")) - { - testRunner.ClickByName("SettingsAndControls"); - testRunner.Delay(.5); - } - } - public static void SwitchToAdvancedSettings(AutomationRunner testRunner) { - if (testRunner.WaitForName("SettingsAndControls")) - { - testRunner.ClickByName("SettingsAndControls"); - testRunner.Delay(.5); - } - testRunner.ClickByName("User Level Dropdown"); testRunner.ClickByName("Advanced Menu Item"); testRunner.Delay(.5); From 4d84844f96ca388e6464c640fe858c98c68c2d32 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Sun, 21 May 2017 22:37:30 -0700 Subject: [PATCH 2/2] Throw exceptions for missing functionality rather than Debug.Break - Fix unexpected abort in NUnit testruns - Tests should fail rather than crash, highlighting areas needing focus --- Library/Widgets/PrintLibraryWidget.cs | 8 ++++++-- PartPreviewWindow/SaveAsWindow.cs | 3 ++- PartPreviewWindow/View3D/SideBar/MirrorControls.cs | 11 ++++++++--- PartPreviewWindow/View3D/View3DWidget.cs | 3 ++- Submodules/agg-sharp | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Library/Widgets/PrintLibraryWidget.cs b/Library/Widgets/PrintLibraryWidget.cs index f31466da7..63c10f073 100644 --- a/Library/Widgets/PrintLibraryWidget.cs +++ b/Library/Widgets/PrintLibraryWidget.cs @@ -372,7 +372,11 @@ namespace MatterHackers.MatterControl.PrintLibrary AllowMultiple = false, AllowProtected = false, AllowContainers = false, - Action = (selectedLibraryItems, listView) => System.Diagnostics.Debugger.Break() /* editButton_Click(s, null) */ + Action = (selectedLibraryItems, listView) => + { + throw new NotImplementedException(); + /* editButton_Click(s, null) */ + } }); // rename menu item @@ -795,7 +799,7 @@ namespace MatterHackers.MatterControl.PrintLibrary private void shareFromLibraryButton_Click(object sender, EventArgs e) { // TODO: Should be rewritten to Register from cloudlibrary, include logic to add to library as needed - System.Diagnostics.Debugger.Break(); + throw new NotImplementedException(); if (libraryView.SelectedItems.Count == 1) { diff --git a/PartPreviewWindow/SaveAsWindow.cs b/PartPreviewWindow/SaveAsWindow.cs index a57d91823..9d1f7c3ab 100644 --- a/PartPreviewWindow/SaveAsWindow.cs +++ b/PartPreviewWindow/SaveAsWindow.cs @@ -95,7 +95,8 @@ namespace MatterHackers.MatterControl }; // TODO: Needs a separate implementation that doesn't change the standard list view contents as we browse around - System.Diagnostics.Debugger.Break(); + throw new NotImplementedException(); + librarySelectorWidget = new ListView(ApplicationController.Instance.Library); // put in the bread crumb widget diff --git a/PartPreviewWindow/View3D/SideBar/MirrorControls.cs b/PartPreviewWindow/View3D/SideBar/MirrorControls.cs index be6d5bde8..714176f96 100644 --- a/PartPreviewWindow/View3D/SideBar/MirrorControls.cs +++ b/PartPreviewWindow/View3D/SideBar/MirrorControls.cs @@ -88,7 +88,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { view3DWidget.UndoBuffer.AddAndDo(new UndoRedoActions(() => MirrorOnAxis(0), () => MirrorOnAxis(0))); - Debugger.Break(); + throw new NotImplementedException(); + /* TODO: Revise above for scenebundle with the following... var selectedItem = view3DWidget.Scene.SelectedItem; selectedItem.Mesh.ReverseFaceEdges(); @@ -106,7 +107,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (view3DWidget.Scene.HasSelection) { view3DWidget.UndoBuffer.AddAndDo(new UndoRedoActions(() => MirrorOnAxis(1), () => MirrorOnAxis(1))); - Debugger.Break(); + + throw new NotImplementedException(); + /* TODO: Revise above for scenebundle with the following... var selectedItem = view3DWidget.Scene.SelectedItem; selectedItem.Mesh.ReverseFaceEdges(); @@ -124,7 +127,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (view3DWidget.Scene.HasSelection) { view3DWidget.UndoBuffer.AddAndDo(new UndoRedoActions(() => MirrorOnAxis(2), () => MirrorOnAxis(2))); - Debugger.Break(); + + throw new NotImplementedException(); + /* TODO: Revise above for scenebundle with the following... var selectedItem = view3DWidget.Scene.SelectedItem; selectedItem.Mesh.ReverseFaceEdges(); diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 3e03f0eb0..eac1bcc96 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -2220,7 +2220,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { libraryToSaveTo.AddItem(printItemWrapper); - Debugger.Break(); // Disabled dispose + throw new NotImplementedException(); + //libraryToSaveTo.Dispose(); } } diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index fafca6a25..d2af76859 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit fafca6a25575be4b386e7ea5892e6c9c0c405c5e +Subproject commit d2af76859987a42a50843d75b87cb2f6b74707e4