Made a test to prove overrides persist on top of user overrides.

This commit is contained in:
Lars Brubaker 2016-12-06 17:48:13 -08:00
parent 83a3c87557
commit 1e192d3cd0
3 changed files with 49 additions and 0 deletions

View file

@ -57,6 +57,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public PresetSelectorWidget(string label, RGBA_Bytes accentColor, NamedSettingsLayers layerType, int extruderIndex)
: base(FlowDirection.TopToBottom)
{
Name = label;
ActiveSliceSettings.SettingChanged.RegisterEvent((s, e) =>
{
StringEventArgs stringEvent = e as StringEventArgs;
@ -323,6 +325,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
MenuItemsPadding = new BorderDouble(10, 4, 10, 6),
};
dropDownList.Name = layerType.ToString();
dropDownList.Margin = new BorderDouble(0, 3);
dropDownList.MinimumSize = new Vector2(dropDownList.LocalBounds.Width, dropDownList.LocalBounds.Height);
@ -333,6 +336,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
foreach (var layer in listSource)
{
MenuItem menuItem = dropDownList.AddItem(layer.Name, layer.LayerID);
menuItem.Name = layer.Name + " Menu";
menuItem.Selected += MenuItem_Selected;
}

View file

@ -902,6 +902,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
Name = settingData.PresentationName + " Textbox",
SelectAllOnFocus = true
};
doubleEditWidget.Name = settingData.SlicerConfigName + " edit";
double currentValue;
bool ChangesMultipleOtherSettings = settingData.SetSettingsOnChange.Count > 0;

View file

@ -234,4 +234,48 @@ namespace MatterHackers.MatterControl.Tests.Automation
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 550);
}
}
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
public class QualitySettingsStayAsOverrides
{
[Test, Apartment(ApartmentState.STA)]
public async Task SettingsStayAsOverrides()
{
AutomationTest testToRun = (testRunner) =>
{
testRunner.CloseSignInAndPrinterSelect();
// Add Guest printers
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
testRunner.ClickByName(SettingsKey.layer_height + " edit", 2);
testRunner.Type(".5\n");
testRunner.Wait(.5);
Assert.AreEqual(ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.layer_height), .5, "Layer height is what we set it to");
testRunner.ClickByName("Quality", 2);
testRunner.ClickByName("Fine Menu", 2);
testRunner.Wait(.5);
Assert.AreEqual(ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.layer_height), .1, "Layer height is the fine override");
MatterControlUtilities.AddAndSelectPrinter(testRunner, "BCN", "Sigma");
// Check Guest printer count
Assert.AreEqual(2, ProfileManager.Instance.ActiveProfiles.Count(), "ProfileManager has 2 Profiles");
// Check if Guest printer names exists in dropdown
testRunner.ClickByName("Printers... Menu", 2);
testRunner.ClickByName("Airwolf 3D HD Menu Item", 5);
testRunner.Wait(1);
Assert.AreEqual(ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.layer_height), .1, "Layer height is the fine override");
return Task.FromResult(0);
};
await MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 120);
}
}
}