Merge pull request #588 from gregory-diaz/master
Added automated test for checking that Group and Ungroup buttons work
This commit is contained in:
commit
684d8749d0
2 changed files with 65 additions and 0 deletions
|
|
@ -258,6 +258,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
doEdittingButtonsContainer.AddChild(separator);
|
||||
|
||||
Button ungroupButton = textImageButtonFactory.Generate("Ungroup".Localize());
|
||||
ungroupButton.Name = "3D View Ungroup";
|
||||
doEdittingButtonsContainer.AddChild(ungroupButton);
|
||||
ungroupButton.Click += (sender, e) =>
|
||||
{
|
||||
|
|
@ -265,6 +266,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
|
||||
Button groupButton = textImageButtonFactory.Generate("Group".Localize());
|
||||
groupButton.Name = "3D View Group";
|
||||
doEdittingButtonsContainer.AddChild(groupButton);
|
||||
groupButton.Click += (sender, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -77,5 +77,68 @@ namespace MatterHackers.MatterControl.UI
|
|||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests
|
||||
}
|
||||
|
||||
[Test, RequiresSTA, RunInApplicationDomain]
|
||||
public void GroupAndUngroup()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
|
||||
SystemWindow systemWindow;
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
testRunner.ClickByName("Row Item Calibration - Box Print Button");
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Get View3DWidget and count MeshGroups before Copy button is clicked
|
||||
GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
|
||||
View3DWidget view3D = partPreview as View3DWidget;
|
||||
|
||||
string copyButtonName = "3D View Copy";
|
||||
|
||||
//Click Edit button to make edit controls visible
|
||||
testRunner.ClickByName("3D View Edit");
|
||||
testRunner.Wait(1);
|
||||
int partCountBeforeCopy = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partCountBeforeCopy == 1);
|
||||
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
testRunner.ClickByName(copyButtonName);
|
||||
testRunner.Wait(1);
|
||||
}
|
||||
|
||||
//Get MeshGroupCount before Group is clicked
|
||||
System.Threading.Thread.Sleep(4000);
|
||||
int partsOnBedBeforeGroup = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partsOnBedBeforeGroup == 6);
|
||||
|
||||
//Click Group Button and get MeshGroup count after Group button is clicked
|
||||
testRunner.ClickByName("3D View Group");
|
||||
System.Threading.Thread.Sleep(4000);
|
||||
int partsOnBedAfterGroup = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partsOnBedAfterGroup == 1);
|
||||
|
||||
testRunner.ClickByName("3D View Ungroup");
|
||||
System.Threading.Thread.Sleep(4000);
|
||||
int partsOnBedAfterUngroup = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partsOnBedAfterUngroup == 6);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 4); // make sure we ran all our tests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue