Working on a local library test
This commit is contained in:
parent
9d0c19abf9
commit
44bbbb74e4
16 changed files with 99 additions and 1 deletions
|
|
@ -40,6 +40,11 @@ namespace MatterHackers.MatterControl
|
||||||
this.imageName = imageName;
|
this.imageName = imageName;
|
||||||
|
|
||||||
DynamicDropDownMenu menu = CreateMenu(direction);
|
DynamicDropDownMenu menu = CreateMenu(direction);
|
||||||
|
if(buttonList.Count > 1)
|
||||||
|
{
|
||||||
|
menu.Name = buttonList[1].Item1 + " Menu";
|
||||||
|
}
|
||||||
|
|
||||||
menu.Margin = new BorderDouble();
|
menu.Margin = new BorderDouble();
|
||||||
Button button = CreateButton(buttonList[0]);
|
Button button = CreateButton(buttonList[0]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace MatterHackers.MatterControl
|
||||||
AddChild(altChoices);
|
AddChild(altChoices);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(string name, Func<bool> clickFunction)
|
public void AddItem(string name, Func<bool> clickFunction)
|
||||||
{
|
{
|
||||||
altChoices.addItem(name, clickFunction);
|
altChoices.addItem(name, clickFunction);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,7 @@ namespace MatterHackers.MatterControl
|
||||||
}
|
}
|
||||||
|
|
||||||
Button saveAsButton = textImageButtonFactory.Generate("Save".Localize(), centerText: true);
|
Button saveAsButton = textImageButtonFactory.Generate("Save".Localize(), centerText: true);
|
||||||
|
saveAsButton.Name = "Save As Save Button";
|
||||||
saveAsButton.Visible = true;
|
saveAsButton.Visible = true;
|
||||||
saveAsButton.Cursor = Cursors.Hand;
|
saveAsButton.Cursor = Cursors.Hand;
|
||||||
buttonRow.AddChild(saveAsButton);
|
buttonRow.AddChild(saveAsButton);
|
||||||
|
|
|
||||||
|
|
@ -191,6 +191,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
Button enterEdittingButton = textImageButtonFactory.Generate("Edit".Localize(), "icon_edit_32x32.png");
|
Button enterEdittingButton = textImageButtonFactory.Generate("Edit".Localize(), "icon_edit_32x32.png");
|
||||||
|
enterEdittingButton.Name = "3D View Edit";
|
||||||
enterEdittingButton.Margin = new BorderDouble(right: 4);
|
enterEdittingButton.Margin = new BorderDouble(right: 4);
|
||||||
enterEdittingButton.Click += (sender, e) =>
|
enterEdittingButton.Click += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
|
@ -285,6 +286,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
doEdittingButtonsContainer.AddChild(separatorTwo);
|
doEdittingButtonsContainer.AddChild(separatorTwo);
|
||||||
|
|
||||||
Button copyButton = textImageButtonFactory.Generate("Copy".Localize());
|
Button copyButton = textImageButtonFactory.Generate("Copy".Localize());
|
||||||
|
copyButton.Name = "3D View Copy";
|
||||||
doEdittingButtonsContainer.AddChild(copyButton);
|
doEdittingButtonsContainer.AddChild(copyButton);
|
||||||
copyButton.Click += (sender, e) =>
|
copyButton.Click += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
|
@ -292,6 +294,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
};
|
};
|
||||||
|
|
||||||
Button deleteButton = textImageButtonFactory.Generate("Remove".Localize());
|
Button deleteButton = textImageButtonFactory.Generate("Remove".Localize());
|
||||||
|
deleteButton.Name = "3D View Delete";
|
||||||
doEdittingButtonsContainer.AddChild(deleteButton);
|
doEdittingButtonsContainer.AddChild(deleteButton);
|
||||||
deleteButton.Click += (sender, e) =>
|
deleteButton.Click += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="MatterControl\AutomationTests\CheckBoxInLibraryIsClickable.cs" />
|
<Compile Include="MatterControl\AutomationTests\CheckBoxInLibraryIsClickable.cs" />
|
||||||
|
<Compile Include="MatterControl\AutomationTests\SqLiteLibraryProvider.cs" />
|
||||||
<Compile Include="MatterControl\LibraryProviderSqliteTests.cs" />
|
<Compile Include="MatterControl\LibraryProviderSqliteTests.cs" />
|
||||||
<Compile Include="MatterControl\AutomationTests\CreateLibraryFolder.cs" />
|
<Compile Include="MatterControl\AutomationTests\CreateLibraryFolder.cs" />
|
||||||
<Compile Include="MatterControl\MatterControlUiFeatures.cs" />
|
<Compile Include="MatterControl\MatterControlUiFeatures.cs" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
using MatterHackers.Agg.PlatformAbstract;
|
||||||
|
using MatterHackers.Agg.UI;
|
||||||
|
using MatterHackers.Agg.UI.Tests;
|
||||||
|
using MatterHackers.GuiAutomation;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace MatterHackers.MatterControl.UI
|
||||||
|
{
|
||||||
|
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain]
|
||||||
|
public class SqLiteLibraryProviderTests
|
||||||
|
{
|
||||||
|
[Test, RequiresSTA, RunInApplicationDomain]
|
||||||
|
public void LibraryQueueViewRefreshesOnAddItem()
|
||||||
|
{
|
||||||
|
// Run a copy of MatterControl
|
||||||
|
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||||
|
{
|
||||||
|
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||||
|
{
|
||||||
|
testRunner.ClickByName("Library Tab", 5);
|
||||||
|
|
||||||
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||||
|
|
||||||
|
resultsHarness.AddTestResult(testRunner.ClickByName("3D View Edit", secondsToWait: 3));
|
||||||
|
|
||||||
|
resultsHarness.AddTestResult(testRunner.ClickByName("3D View Copy", secondsToWait: 3));
|
||||||
|
resultsHarness.AddTestResult(testRunner.ClickByName("3D View Delete", secondsToWait: 3));
|
||||||
|
resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu", secondsToWait: 3));
|
||||||
|
resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu Item", secondsToWait: 3));
|
||||||
|
|
||||||
|
testRunner.Type("Test Part");
|
||||||
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||||
|
|
||||||
|
testRunner.ClickByName("Save As Save Button", secondsToWait: 1);
|
||||||
|
|
||||||
|
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#if !__ANDROID__
|
||||||
|
// Set the static data to point to the directory of MatterControl
|
||||||
|
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
||||||
|
#endif
|
||||||
|
bool showWindow;
|
||||||
|
string testDBFolder = "MC_One_Queue_No_Library";
|
||||||
|
MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewStaticDataForTesting(testDBFolder);
|
||||||
|
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
|
||||||
|
AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 450);
|
||||||
|
MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);
|
||||||
|
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||||
|
Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -31,6 +31,7 @@ using MatterHackers.Agg.Image;
|
||||||
using MatterHackers.Agg.UI;
|
using MatterHackers.Agg.UI;
|
||||||
using MatterHackers.GuiAutomation;
|
using MatterHackers.GuiAutomation;
|
||||||
using MatterHackers.MatterControl.DataStorage;
|
using MatterHackers.MatterControl.DataStorage;
|
||||||
|
using MatterHackers.MatterControl.PrintLibrary.Provider;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
@ -132,6 +133,21 @@ namespace MatterHackers.MatterControl.UI
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LibraryProvider CurrentProvider()
|
||||||
|
{
|
||||||
|
return ApplicationController.Instance.CurrentLibraryDataView.CurrentLibraryProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NavigateToFolder(AutomationRunner testRunner, string libraryRowItemName)
|
||||||
|
{
|
||||||
|
SearchRegion libraryRowItemRegion = testRunner.GetRegionByName(libraryRowItemName, secondsToWait: 3);
|
||||||
|
testRunner.ClickByName(libraryRowItemName);
|
||||||
|
testRunner.MoveToByName(libraryRowItemName);
|
||||||
|
testRunner.Wait(.5);
|
||||||
|
testRunner.ClickByName("Open Collection", searchRegion: libraryRowItemRegion);
|
||||||
|
testRunner.Wait(.5);
|
||||||
|
}
|
||||||
|
|
||||||
public static void RestoreStaticDataAfterTesting(DataFolderState state, bool closeDataBase)
|
public static void RestoreStaticDataAfterTesting(DataFolderState state, bool closeDataBase)
|
||||||
{
|
{
|
||||||
if (state.undoDataRename)
|
if (state.undoDataRename)
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
Tests/TestData/TestDatabaseStates/MC_One_Queue_No_Library/cache/session.bin
vendored
Normal file
0
Tests/TestData/TestDatabaseStates/MC_One_Queue_No_Library/cache/session.bin
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"ProjectFiles": [
|
||||||
|
{
|
||||||
|
"DateAdded": "2015-09-01T10:50:29.5703883-07:00",
|
||||||
|
"FileLocation": "C:\\Development\\MatterControl\\Tests\\TestData\\TestMeshes\\LibraryProviderData\\Box20x20x10.stl",
|
||||||
|
"Name": "Box20x20x10",
|
||||||
|
"PrintCount": 0,
|
||||||
|
"PrintItemCollectionID": 0,
|
||||||
|
"ReadOnly": false,
|
||||||
|
"Protected": false,
|
||||||
|
"Id": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ProjectName": "Test Project",
|
||||||
|
"ProjectDateCreated": "2015-09-01T10:50:44"
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Loading…
Add table
Add a link
Reference in a new issue