diff --git a/ActionBar/PrinterActionRow.cs b/ActionBar/PrinterActionRow.cs index e24840d54..6bf325924 100644 --- a/ActionBar/PrinterActionRow.cs +++ b/ActionBar/PrinterActionRow.cs @@ -149,6 +149,7 @@ namespace MatterHackers.MatterControl.ActionBar printerSelectorAndEditButton.AddChild(printerSelector); editPrinterButton = TextImageButtonFactory.GetThemedEditButton(); + editPrinterButton.Name = "Edit Printer Button"; editPrinterButton.VAnchor = VAnchor.ParentCenter; editPrinterButton.Click += UiNavigation.OpenEditPrinterWizard_Click; printerSelectorAndEditButton.AddChild(editPrinterButton); diff --git a/ControlElements/StyledMessageBoxWindow.cs b/ControlElements/StyledMessageBoxWindow.cs index d4f7298fb..413b8e41b 100644 --- a/ControlElements/StyledMessageBoxWindow.cs +++ b/ControlElements/StyledMessageBoxWindow.cs @@ -127,6 +127,7 @@ namespace MatterHackers.MatterControl { Title = "MatterControl - " + "Please Confirm".Localize(); Button yesButton = textImageButtonFactory.Generate(yesOk, centerText: true); + yesButton.Name = "Yes Button"; yesButton.Click += new EventHandler(okButton_Click); yesButton.Cursor = Cursors.Hand; buttonRow.AddChild(yesButton); @@ -134,6 +135,7 @@ namespace MatterHackers.MatterControl buttonRow.AddChild(new HorizontalSpacer()); Button noButton = textImageButtonFactory.Generate(no, centerText: true); + noButton.Name = "No Button"; noButton.Click += new EventHandler(noButton_Click); noButton.Cursor = Cursors.Hand; buttonRow.AddChild(noButton); diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index ae1208cf5..6305cc4d5 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -734,6 +734,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration buttonFactory.normalTextColor = RGBA_Bytes.Red; var button = buttonFactory.Generate("Delete Printer".Localize()); + button.Name = "Delete Printer Button"; button.HAnchor = HAnchor.ParentCenter; button.Click += (s, e) => { diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index bf804c808..4c9e6297a 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit bf804c80820224a0c2d16af0eda5afbf8445ad90 +Subproject commit 4c9e6297a37abb2d9484ae0c2e5bd0b762b47080 diff --git a/Tests/MatterControl.AutomationTests/SliceSetingsTests.cs b/Tests/MatterControl.AutomationTests/SliceSetingsTests.cs index 0475259b3..7ba3837ed 100644 --- a/Tests/MatterControl.AutomationTests/SliceSetingsTests.cs +++ b/Tests/MatterControl.AutomationTests/SliceSetingsTests.cs @@ -3,6 +3,7 @@ using MatterHackers.GuiAutomation; using MatterHackers.MatterControl.SlicerConfiguration; using NUnit.Framework; using System; +using System.Linq; namespace MatterHackers.MatterControl.Tests.Automation { @@ -92,6 +93,45 @@ namespace MatterHackers.MatterControl.Tests.Automation Assert.IsTrue(testHarness.TestCount == 21); // make sure we ran all our tests } + [Test, RequiresSTA, RunInApplicationDomain] + public void DeleteProfileWorksForGuest() + { + // Run a copy of MatterControl + Action testToRun = (AutomationTesterHarness resultsHarness) => + { + AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); + { + MatterControlUtilities.PrepForTestRun(testRunner); + + // assert no profiles + resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0); + + MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD"); + + // assert one profile + resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 1); + + // delete printer + testRunner.ClickByName("Edit Printer Button", 5); + testRunner.Wait(.5); + testRunner.ClickByName("Delete Printer Button", 5); + testRunner.Wait(.5); + testRunner.ClickByName("Yes Button", 5); + testRunner.Wait(2); + + // assert no profiles + resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0); + + MatterControlUtilities.CloseMatterControl(testRunner); + } + }; + + AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900); + + Assert.IsTrue(testHarness.AllTestsPassed); + Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests + } + private static void CheckAndUncheckSetting(AutomationTesterHarness resultsHarness, AutomationRunner testRunner, string settingToChange, string checkBoxName, bool expected) { // Assert that the checkbox is currently unchecked, and there is no user override