Merge pull request #586 from gregory-diaz/master
Added new PartPreviewWindow which tests that when the Copy button cli…
This commit is contained in:
commit
cd2afe602e
4 changed files with 88 additions and 0 deletions
|
|
@ -277,6 +277,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
printLabel.HAnchor = HAnchor.ParentCenter;
|
||||
|
||||
FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel);
|
||||
printButton.Name = "Row Item " + partLabel.Text + " Print Button";
|
||||
printButton.VAnchor = VAnchor.ParentBottomTop;
|
||||
printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
printButton.Width = 100;
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
MeshGroupExtraData.Add(new PlatingMeshGroupData());
|
||||
|
||||
this.printItemWrapper = printItemWrapper;
|
||||
this.Name = "View3DWidget";
|
||||
|
||||
FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MatterHackers.PolygonMesh, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Submodules\agg-sharp\PolygonMesh\bin\Debug\MatterHackers.PolygonMesh.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
|
@ -67,6 +71,7 @@
|
|||
<Compile Include="LibraryDownloadsTest.cs" />
|
||||
<Compile Include="LocalLibraryTests.cs" />
|
||||
<Compile Include="OptionsTabTests.cs" />
|
||||
<Compile Include="PartPreviewTests.cs" />
|
||||
<Compile Include="PrintQueueTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SqLiteLibraryProvider.cs" />
|
||||
|
|
|
|||
81
Tests/MatterControl.AutomationTests/PartPreviewTests.cs
Normal file
81
Tests/MatterControl.AutomationTests/PartPreviewTests.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.PolygonMesh;
|
||||
using MatterHackers.Agg.UI;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
using System.IO;
|
||||
using MatterHackers.MatterControl.CreatorPlugins;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
namespace MatterHackers.MatterControl.UI
|
||||
{
|
||||
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain]
|
||||
public class PartPreviewTests
|
||||
{
|
||||
[Test, RequiresSTA, RunInApplicationDomain]
|
||||
public void CopyButtonClickedMakesCopyOfPartOnBed()
|
||||
{
|
||||
// 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);
|
||||
|
||||
|
||||
//Click Copy button and count MeshGroups
|
||||
testRunner.ClickByName(copyButtonName);
|
||||
System.Threading.Thread.Sleep(4000);
|
||||
int partCountAfterCopy = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partCountAfterCopy == 2);
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Click Copy button a second time and count MeshGroups again
|
||||
testRunner.ClickByName(copyButtonName);
|
||||
System.Threading.Thread.Sleep(4000);
|
||||
int partCountAfterSecondCopy = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partCountAfterSecondCopy == 3);
|
||||
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue