commit
c4be48d7a9
95 changed files with 2595 additions and 3012 deletions
|
|
@ -71,7 +71,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
private Button resumeButton;
|
||||
private Button skipButton;
|
||||
private Button startButton;
|
||||
private Button configureButton;
|
||||
private Button finishSetupButton;
|
||||
private MatterHackers.MatterControl.TextImageButtonFactory textImageButtonFactory = new MatterHackers.MatterControl.TextImageButtonFactory();
|
||||
private Stopwatch timeSincePrintStarted = new Stopwatch();
|
||||
|
||||
|
|
@ -125,11 +125,11 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
startButton.Margin = new BorderDouble(6, 6, 6, 3);
|
||||
startButton.Click += onStartButton_Click;
|
||||
|
||||
configureButton = textImageButtonFactory.GenerateTooltipButton("Finish Setup...".Localize());
|
||||
configureButton.Name = "Finish Setup Button";
|
||||
configureButton.ToolTipText = "Run setup configuration for printer.".Localize();
|
||||
configureButton.Margin = new BorderDouble(6, 6, 6, 3);
|
||||
configureButton.Click += onStartButton_Click;
|
||||
finishSetupButton = textImageButtonFactory.GenerateTooltipButton("Finish Setup...".Localize());
|
||||
finishSetupButton.Name = "Finish Setup Button";
|
||||
finishSetupButton.ToolTipText = "Run setup configuration for printer.".Localize();
|
||||
finishSetupButton.Margin = new BorderDouble(6, 6, 6, 3);
|
||||
finishSetupButton.Click += onStartButton_Click;
|
||||
|
||||
connectButton = textImageButtonFactory.GenerateTooltipButton("Connect".Localize(), StaticData.Instance.LoadIcon("icon_power_32x32.png",32,32).InvertLightness());
|
||||
connectButton.ToolTipText = "Connect to the printer".Localize();
|
||||
|
|
@ -249,8 +249,8 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
this.AddChild(startButton);
|
||||
allPrintButtons.Add(startButton);
|
||||
|
||||
this.AddChild(configureButton);
|
||||
allPrintButtons.Add(configureButton);
|
||||
this.AddChild(finishSetupButton);
|
||||
allPrintButtons.Add(finishSetupButton);
|
||||
|
||||
this.AddChild(doneWithCurrentPartButton);
|
||||
allPrintButtons.Add(doneWithCurrentPartButton);
|
||||
|
|
@ -280,6 +280,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
{
|
||||
PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
|
||||
ProfileManager.ProfilesListChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
|
||||
addButton.Click += onAddButton_Click;
|
||||
skipButton.Click += onSkipButton_Click;
|
||||
resetConnectionButton.Click += (sender, e) => { UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.RebootBoard); };
|
||||
|
|
@ -362,7 +363,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
if (levelingData != null && ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_required_to_print)
|
||||
&& !levelingData.HasBeenRunAndEnabled())
|
||||
{
|
||||
this.activePrintButtons.Add(configureButton);
|
||||
this.activePrintButtons.Add(finishSetupButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
// Rebuild the droplist any time the Profiles list changes
|
||||
ProfileManager.ProfilesListChanged.RegisterEvent((s, e) => Rebuild(), ref unregisterEvents);
|
||||
ApplicationController.Instance.ReloadAllRequested.RegisterEvent((s, e) => Rebuild(), ref unregisterEvents);
|
||||
}
|
||||
|
||||
public void Rebuild()
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ namespace MatterHackers.MatterControl
|
|||
return;
|
||||
}
|
||||
|
||||
PopOutManager.SaveIfClosed = false;
|
||||
// remove the advance control and replace it with new ones built for the selected printer
|
||||
int advancedControlsIndex = GetChildIndex(advancedTab);
|
||||
RemoveChild(advancedControlsIndex);
|
||||
|
|
@ -79,6 +80,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
advancedTab = CreateAdvancedControlsTab();
|
||||
AddChild(advancedTab, advancedControlsIndex);
|
||||
PopOutManager.SaveIfClosed = true;
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ namespace MatterHackers.MatterControl
|
|||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using SettingsManagement;
|
||||
using PrintHistory;
|
||||
|
||||
public class OemProfileDictionary : Dictionary<string, Dictionary<string, PublicDevice>>
|
||||
{
|
||||
|
|
@ -178,9 +179,13 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public class ApplicationController
|
||||
{
|
||||
public Action RedeemDesignCode;
|
||||
public Action EnterShareCode;
|
||||
|
||||
private static ApplicationController globalInstance;
|
||||
public RootedObjectEventHandler AdvancedControlsPanelReloading = new RootedObjectEventHandler();
|
||||
public RootedObjectEventHandler CloudSyncStatusChanged = new RootedObjectEventHandler();
|
||||
public RootedObjectEventHandler ReloadAllRequested = new RootedObjectEventHandler();
|
||||
public RootedObjectEventHandler DoneReloadingAll = new RootedObjectEventHandler();
|
||||
public RootedObjectEventHandler PluginsLoaded = new RootedObjectEventHandler();
|
||||
|
||||
|
|
@ -202,7 +207,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public static Func<string, Task<Dictionary<string, string>>> GetProfileHistory;
|
||||
public static Func<PrinterInfo,string, Task<PrinterSettings>> GetPrinterProfileAsync;
|
||||
public static Func<IProgress<SyncReportType>,Task> SyncPrinterProfiles;
|
||||
public static Func<string, IProgress<SyncReportType>,Task> SyncPrinterProfiles;
|
||||
public static Func<Task<OemProfileDictionary>> GetPublicProfileList;
|
||||
public static Func<string, Task<PrinterSettings>> DownloadPublicProfileAsync;
|
||||
|
||||
|
|
@ -388,24 +393,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
private static string MakeValidFileName(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
string invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars()));
|
||||
string invalidRegStr = string.Format(@"([{0}]*\.+$)|([{0}]+)", invalidChars);
|
||||
|
||||
return Regex.Replace(name, invalidRegStr, "_");
|
||||
}
|
||||
|
||||
public string GetSessionUsernameForFileSystem()
|
||||
{
|
||||
return MakeValidFileName(AuthenticationData.Instance.ActiveSessionUsername);
|
||||
}
|
||||
|
||||
bool pendingReloadRequest = false;
|
||||
public void ReloadAll(object sender, EventArgs e)
|
||||
{
|
||||
|
|
@ -416,6 +403,8 @@ namespace MatterHackers.MatterControl
|
|||
MainView.AfterDraw += DoReloadAll;
|
||||
MainView.Invalidate();
|
||||
}
|
||||
|
||||
ReloadAllRequested?.CallEvents(null, null);
|
||||
}
|
||||
|
||||
static int reloadCount = 0;
|
||||
|
|
@ -452,23 +441,15 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
static void LoadUITheme()
|
||||
{
|
||||
if (string.IsNullOrEmpty(UserSettings.Instance.get(UserSettingsKey.ActiveThemeName)))
|
||||
string oemColor = OemSettings.Instance.ThemeColor;
|
||||
if (string.IsNullOrEmpty(oemColor))
|
||||
{
|
||||
string oemColor = OemSettings.Instance.ThemeColor;
|
||||
if (string.IsNullOrEmpty(oemColor))
|
||||
{
|
||||
ActiveTheme.Instance = ActiveTheme.GetThemeColors("Blue - Light");
|
||||
}
|
||||
else
|
||||
{
|
||||
UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, oemColor);
|
||||
ActiveTheme.Instance = ActiveTheme.GetThemeColors(oemColor);
|
||||
}
|
||||
ActiveTheme.Instance = ActiveTheme.GetThemeColors("Blue - Light");
|
||||
}
|
||||
else
|
||||
{
|
||||
string name = UserSettings.Instance.get(UserSettingsKey.ActiveThemeName);
|
||||
ActiveTheme.Instance = ActiveTheme.GetThemeColors(name);
|
||||
UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, oemColor);
|
||||
ActiveTheme.Instance = ActiveTheme.GetThemeColors(oemColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -484,11 +465,18 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
// set the colors
|
||||
LoadUITheme();
|
||||
// This will initialize the theme for the first printer to load
|
||||
ProfileManager.Reload();
|
||||
|
||||
// We previously made a call to Reload, which fired the method twice due to it being in the static constructor. Accessing
|
||||
// any property will run the static constructor and perform the Reload behavior without the overhead of duplicate calls
|
||||
bool na = ProfileManager.Instance.IsGuestProfile;
|
||||
|
||||
if (UserSettings.Instance.DisplayMode == ApplicationDisplayType.Touchscreen)
|
||||
{
|
||||
// make sure that on touchscreen (due to lazy tabs) we initialize our stating parts and queue
|
||||
var temp = new LibraryProviderSQLite(null, null, null, null);
|
||||
// and make sure we have the check for print recovery wired up needed for lazy tabs.
|
||||
var temp2 = PrintHistoryData.Instance;
|
||||
// now bulid the ui
|
||||
globalInstance.MainView = new TouchscreenView();
|
||||
}
|
||||
else
|
||||
|
|
@ -511,29 +499,35 @@ namespace MatterHackers.MatterControl
|
|||
public LibraryDataView CurrentLibraryDataView = null;
|
||||
public void SwitchToPurchasedLibrary()
|
||||
{
|
||||
// Switch to the purchased library
|
||||
LibraryProviderSelector libraryProviderSelector = CurrentLibraryDataView.CurrentLibraryProvider.GetRootProvider() as LibraryProviderSelector;
|
||||
if (libraryProviderSelector != null)
|
||||
if (CurrentLibraryDataView?.CurrentLibraryProvider?.GetRootProvider() != null)
|
||||
{
|
||||
LibraryProvider purchaseProvider = libraryProviderSelector.GetPurchasedLibrary();
|
||||
UiThread.RunOnIdle(() =>
|
||||
// Switch to the purchased library
|
||||
LibraryProviderSelector libraryProviderSelector = CurrentLibraryDataView.CurrentLibraryProvider.GetRootProvider() as LibraryProviderSelector;
|
||||
if (libraryProviderSelector != null)
|
||||
{
|
||||
CurrentLibraryDataView.CurrentLibraryProvider = purchaseProvider;
|
||||
});
|
||||
LibraryProvider purchaseProvider = libraryProviderSelector.GetPurchasedLibrary();
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
CurrentLibraryDataView.CurrentLibraryProvider = purchaseProvider;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SwitchToSharedLibrary()
|
||||
{
|
||||
// Switch to the shared library
|
||||
LibraryProviderSelector libraryProviderSelector = CurrentLibraryDataView.CurrentLibraryProvider.GetRootProvider() as LibraryProviderSelector;
|
||||
if (libraryProviderSelector != null)
|
||||
if (CurrentLibraryDataView?.CurrentLibraryProvider?.GetRootProvider() != null)
|
||||
{
|
||||
LibraryProvider sharedProvider = libraryProviderSelector.GetSharedLibrary();
|
||||
UiThread.RunOnIdle(() =>
|
||||
LibraryProviderSelector libraryProviderSelector = CurrentLibraryDataView.CurrentLibraryProvider.GetRootProvider() as LibraryProviderSelector;
|
||||
if (libraryProviderSelector != null)
|
||||
{
|
||||
CurrentLibraryDataView.CurrentLibraryProvider = sharedProvider;
|
||||
});
|
||||
LibraryProvider sharedProvider = libraryProviderSelector.GetSharedLibrary();
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
CurrentLibraryDataView.CurrentLibraryProvider = sharedProvider;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -545,11 +539,14 @@ namespace MatterHackers.MatterControl
|
|||
CloudSyncStatusChanged.CallEvents(this, new CloudSyncEventArgs() { IsAuthenticated = userAuthenticated });
|
||||
|
||||
// Only fire UserChanged if it actually happened - prevents runaway positive feedback loop
|
||||
if (AuthenticationData.Instance.ActiveSessionUsername != AuthenticationData.Instance.LastSessionUsername)
|
||||
if (!string.IsNullOrEmpty(AuthenticationData.Instance.ActiveSessionUsername)
|
||||
&& AuthenticationData.Instance.ActiveSessionUsername != AuthenticationData.Instance.LastSessionUsername)
|
||||
{
|
||||
// only set it if it is an actual user name
|
||||
AuthenticationData.Instance.LastSessionUsername = AuthenticationData.Instance.ActiveSessionUsername;
|
||||
UserChanged();
|
||||
}
|
||||
|
||||
UserChanged();
|
||||
}
|
||||
|
||||
// Called after every startup and at the completion of every authentication change
|
||||
|
|
@ -562,10 +559,10 @@ namespace MatterHackers.MatterControl
|
|||
// Ensure SQLite printers are imported
|
||||
profileManager.EnsurePrintersImported();
|
||||
|
||||
var guestDB = ProfileManager.LoadGuestDB();
|
||||
var guest = ProfileManager.LoadGuestProfiles();
|
||||
|
||||
// If profiles.json was created, run the import wizard to pull in any SQLite printers
|
||||
if (guestDB?.Profiles != null && guestDB.Profiles.Any() && !profileManager.IsGuestProfile && !profileManager.PrintersImported)
|
||||
if (guest?.Profiles != null && guest.Profiles.Any() && !profileManager.IsGuestProfile && !profileManager.PrintersImported)
|
||||
{
|
||||
var wizardPage = new CopyGuestProfilesToUser(() =>
|
||||
{
|
||||
|
|
@ -611,7 +608,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else
|
||||
{
|
||||
ApplicationController.SyncPrinterProfiles.Invoke(null).ContinueWith((task) =>
|
||||
ApplicationController.SyncPrinterProfiles.Invoke("ApplicationController.OnLoadActions()", null).ContinueWith((task) =>
|
||||
{
|
||||
RunSetupIfRequired();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
public static MenuOptionFile CurrentMenuOptionFile = null;
|
||||
|
||||
public EventHandler RedeemDesignCode;
|
||||
public EventHandler EnterShareCode;
|
||||
|
||||
public MenuOptionFile()
|
||||
: base("File".Localize())
|
||||
{
|
||||
|
|
@ -36,8 +33,8 @@ namespace MatterHackers.MatterControl
|
|||
new MenuItemAction("Add Printer".Localize(), AddPrinter_Click),
|
||||
new MenuItemAction("Import Printer".Localize(), ImportPrinter),
|
||||
new MenuItemAction("Add File To Queue".Localize(), importFile_Click),
|
||||
new MenuItemAction("Redeem Design Code".Localize(), () => RedeemDesignCode?.Invoke(this, null)),
|
||||
new MenuItemAction("Enter Share Code".Localize(), () => EnterShareCode?.Invoke(this, null)),
|
||||
new MenuItemAction("Redeem Design Code".Localize(), () => ApplicationController.Instance.RedeemDesignCode?.Invoke()),
|
||||
new MenuItemAction("Enter Share Code".Localize(), () => ApplicationController.Instance.EnterShareCode?.Invoke()),
|
||||
new MenuItemAction("------------------------", null),
|
||||
new MenuItemAction("Exit".Localize(), () =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,7 +110,9 @@ namespace MatterHackers.MatterControl
|
|||
return sliceSettingsWidget;
|
||||
});
|
||||
|
||||
this.TabBar.AddChild(new HorizontalLine() { Margin = new BorderDouble(4, 10) });
|
||||
BorderDouble horizontalSpacerMargin = new BorderDouble(4, 10);
|
||||
|
||||
this.TabBar.AddChild(new HorizontalLine() { Margin = horizontalSpacerMargin });
|
||||
|
||||
this.AddTab(
|
||||
"Controls Tab",
|
||||
|
|
@ -120,7 +122,7 @@ namespace MatterHackers.MatterControl
|
|||
// TODO: How to handle reload? Create .Reload on LazyTab? Create accessor for tabs["Controls Tab"].Reload()?
|
||||
//manualControlsPage = new TabPage(, printerControlsLabel);
|
||||
|
||||
this.TabBar.AddChild(new HorizontalLine() { Margin = new BorderDouble(4, 10) });
|
||||
this.TabBar.AddChild(new HorizontalLine() { Margin = horizontalSpacerMargin });
|
||||
|
||||
this.AddTab(
|
||||
"Queue Tab",
|
||||
|
|
@ -142,7 +144,18 @@ namespace MatterHackers.MatterControl
|
|||
() => new PrintHistoryWidget());
|
||||
}
|
||||
|
||||
this.TabBar.AddChild(new HorizontalLine() { Margin = new BorderDouble(4, 10) });
|
||||
this.TabBar.AddChild(new HorizontalLine() { Margin = horizontalSpacerMargin });
|
||||
|
||||
this.Load += (s, e) =>
|
||||
{
|
||||
if (!simpleMode && !TouchScreenIsTall)
|
||||
{
|
||||
foreach (GuiWidget horizontalLine in this.TabBar.Children<HorizontalLine>())
|
||||
{
|
||||
horizontalLine.Margin = new BorderDouble(4, 5);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Make sure we have the right scroll position when we create this view
|
||||
// This is not working well enough. So, I disabled it until it can be fixed.
|
||||
|
|
@ -219,6 +232,23 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
public bool TouchScreenIsTall
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach(GuiWidget topParent in this.Parents<SystemWindow>())
|
||||
{
|
||||
if(topParent.Height < 610)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private event EventHandler unregisterEvents;
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ using System;
|
|||
|
||||
namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
|
||||
{
|
||||
#if false
|
||||
public class BrailleBuilderPlugin : MatterControlPlugin
|
||||
{
|
||||
public BrailleBuilderPlugin()
|
||||
|
|
@ -74,4 +75,5 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
|
|||
BrailleBuilderMainWindow mainWindow = new BrailleBuilderMainWindow();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -129,10 +129,6 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Submodules\agg-sharp\PlatformWin32\OpenTK.dll</HintPath>
|
||||
|
|
@ -218,7 +214,6 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.CreatorPlugins;
|
||||
using MatterHackers.MatterControl.PluginSystem;
|
||||
#if !__ANDROID__
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
@ -45,68 +42,6 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
|
|||
{
|
||||
public static class BrailleGrade2
|
||||
{
|
||||
#if !__ANDROID__
|
||||
static bool ranTests = false;
|
||||
[Test]
|
||||
public static void BrailGrade2Tests()
|
||||
{
|
||||
if (!ranTests)
|
||||
{
|
||||
Assert.IsTrue(ConvertWord("taylor") == "taylor");
|
||||
Assert.IsTrue(ConvertWord("Taylor") == ",taylor");
|
||||
Assert.IsTrue(ConvertWord("TayLor") == ",tay,lor");
|
||||
Assert.IsTrue(ConvertWord("energy") == "5}gy");
|
||||
Assert.IsTrue(ConvertWord("men") == "m5");
|
||||
Assert.IsTrue(ConvertWord("runabout") == "runab");
|
||||
Assert.IsTrue(ConvertWord("afternoon") == "afn");
|
||||
Assert.IsTrue(ConvertWord("really") == "re,y");
|
||||
Assert.IsTrue(ConvertWord("glance") == "gl.e");
|
||||
Assert.IsTrue(ConvertWord("station") == "/,n");
|
||||
Assert.IsTrue(ConvertWord("as") == "z");
|
||||
Assert.IsTrue(ConvertWord("abby") == "a2y");
|
||||
Assert.IsTrue(ConvertWord("commitment") == "-mit;t");
|
||||
Assert.IsTrue(ConvertWord("mother") == "\"m");
|
||||
Assert.IsTrue(ConvertWord("myself") == "myf");
|
||||
Assert.IsTrue(ConvertWord("lochness") == "lo*;s");
|
||||
Assert.IsTrue(ConvertWord("Seven o'clock") == ",sev5 o'c");
|
||||
|
||||
Assert.IsTrue(ConvertWord("test") == "te/");
|
||||
Assert.IsTrue(ConvertWord("that") == "t");
|
||||
Assert.IsTrue(ConvertWord("will") == "w");
|
||||
Assert.IsTrue(ConvertWord("show") == "%{");
|
||||
Assert.IsTrue(ConvertWord("our") == "|r");
|
||||
Assert.IsTrue(ConvertWord("with") == ")");
|
||||
Assert.IsTrue(ConvertWord("braille") == "brl");
|
||||
Assert.IsTrue(ConvertWord("conformance") == "3=m.e");
|
||||
|
||||
Assert.IsTrue(ConvertString("go to sleep") == "g 6sleep");
|
||||
Assert.IsTrue(ConvertString("go to") == "g to");
|
||||
Assert.IsTrue(ConvertString("here it is") == "\"h x is");
|
||||
Assert.IsTrue(ConvertString("test that will show our conformance with braille") == "te/ t w %{ |r 3=m.e ) brl");
|
||||
Assert.IsTrue(ConvertString("so we can create some strings and then this gives us the output that is expected") == "s we c cr1te \"s /r+s & !n ? gives u ! |tput t is expect$");
|
||||
|
||||
Assert.IsTrue(ConvertString("Waltz, bad nymph, for quick jigs vex.") == ",waltz1 bad nymph1 = qk jigs vex4");
|
||||
Assert.IsTrue(ConvertString("Quick zephyrs blow, vexing daft Jim.") == ",qk zephyrs bl{1 vex+ daft ,jim4");
|
||||
Assert.IsTrue(ConvertString("Sphinx of black quartz, judge my vow.") == ",sph9x ( black qu>tz1 judge my v{4");
|
||||
Assert.IsTrue(ConvertString("Two driven jocks help fax my big quiz.") == ",two driv5 jocks help fax my big quiz4");
|
||||
// Assert.IsTrue(ConvertString("Five quacking zephyrs jolt my wax bed.") == ",five quack+ zephyrs jolt my wax b$4");
|
||||
Assert.IsTrue(ConvertString("The five boxing wizards jump quickly.") == ",! five box+ wiz>ds jump qkly4");
|
||||
Assert.IsTrue(ConvertString("Pack my box with five dozen liquor jugs.") == ",pack my box ) five doz5 liquor jugs4");
|
||||
Assert.IsTrue(ConvertString("The quick brown fox jumps over the lazy dog.") == ",! qk br{n fox jumps ov} ! lazy dog4");
|
||||
Assert.IsTrue(ConvertString("Jinxed wizards pluck ivy from the big quilt.") == ",j9x$ wiz>ds pluck ivy f ! big quilt4");
|
||||
Assert.IsTrue(ConvertString("Crazy Fredrick bought many very exquisite opal jewels.") == ",crazy ,fr$rick b\"| _m v exquisite opal jewels4");
|
||||
Assert.IsTrue(ConvertString("We promptly judged antique ivory buckles for the next prize.") == ",we promptly judg$ antique ivory buckles =! next prize4");
|
||||
Assert.IsTrue(ConvertString("A mad boxer shot a quick, gloved jab to the jaw of his dizzy opponent.") == ",a mad box} %ot a qk1 glov$ jab 6! jaw ( 8 dizzy opp\"ont4");
|
||||
Assert.IsTrue(ConvertString("Jaded zombies acted quaintly but kept driving their oxen forward.") == ",jad$ zombies act$ qua9tly b kept driv+ _! ox5 =w>d4");
|
||||
Assert.IsTrue(ConvertString("14. The job requires extra pluck and zeal from every young wage earner.") == "#ad4 ,! job requires extra pluck & z1l f e \"y wage e>n}4");
|
||||
|
||||
Assert.IsTrue(ConvertString("Just wanting to put together some more tests to show the effectiveness of our converter.") == ",j want+ 6put tgr \"s m te/s 6%{ ! e6ective;s ( |r 3v}t}4");
|
||||
|
||||
ranTests = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal class TextMapping
|
||||
{
|
||||
internal string Key;
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.CreatorPlugins;
|
||||
using MatterHackers.MatterControl.PluginSystem;
|
||||
#if !__ANDROID__
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="3.4.1" targetFramework="net45" />
|
||||
</packages>
|
||||
|
|
@ -223,8 +223,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
optionsContainer.AddChild(interfaceOptionsDropList);
|
||||
optionsContainer.Width = 200;
|
||||
|
||||
MenuItem responsizeOptionsDropDownItem = interfaceOptionsDropList.AddItem("Normal".Localize(), "responsive");
|
||||
MenuItem touchscreenOptionsDropDownItem = interfaceOptionsDropList.AddItem("Touchscreen".Localize(), "touchscreen");
|
||||
interfaceOptionsDropList.AddItem("Normal".Localize(), "responsive");
|
||||
interfaceOptionsDropList.AddItem("Touchscreen".Localize(), "touchscreen");
|
||||
|
||||
List<string> acceptableUpdateFeedTypeValues = new List<string>() { "responsive", "touchscreen" };
|
||||
string currentDisplayModeType = UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode);
|
||||
|
|
@ -237,10 +237,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
interfaceOptionsDropList.SelectedValue = UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode);
|
||||
interfaceOptionsDropList.SelectionChanged += (sender, e) =>
|
||||
{
|
||||
string releaseCode = ((DropDownList)sender).SelectedValue;
|
||||
if (releaseCode != UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode))
|
||||
string displayMode = ((DropDownList)sender).SelectedValue;
|
||||
if (displayMode != UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode))
|
||||
{
|
||||
UserSettings.Instance.set(UserSettingsKey.ApplicationDisplayMode, releaseCode);
|
||||
UserSettings.Instance.set(UserSettingsKey.ApplicationDisplayMode, displayMode);
|
||||
displayControlRestartButton.Visible = true;
|
||||
}
|
||||
};
|
||||
|
|
@ -546,6 +546,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
{
|
||||
UserSettings.Instance.Fields.IsSimpleMode = false;
|
||||
}
|
||||
ApplicationController.Instance.ReloadAll(null, null);
|
||||
}
|
||||
|
||||
private void ReleaseOptionsDropList_SelectionChanged(object sender, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -79,20 +79,22 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
string medPrecisionLabel = LocalizedString.Get("Medium Precision");
|
||||
string highPrecisionLabel = LocalizedString.Get("High Precision");
|
||||
|
||||
bool allowLessThanZero = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.z_can_be_negative);
|
||||
|
||||
Vector2 probeBackCenter = LevelWizardBase.GetPrintLevelPositionToSample(0);
|
||||
printLevelWizard.AddPage(new GetCoarseBedHeight(printLevelWizard, new Vector3(probeBackCenter, 10), string.Format("{0} {1} 1 - {2}", GetStepString(), positionLabel, lowPrecisionLabel), probePositions, 0));
|
||||
printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} 1 - {2}", GetStepString(), positionLabel, medPrecisionLabel), probePositions, 0));
|
||||
printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} 1 - {2}", GetStepString(), positionLabel, highPrecisionLabel), probePositions, 0));
|
||||
printLevelWizard.AddPage(new GetCoarseBedHeight(printLevelWizard, new Vector3(probeBackCenter, 10), string.Format("{0} {1} 1 - {2}", GetStepString(), positionLabel, lowPrecisionLabel), probePositions, 0, allowLessThanZero));
|
||||
printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} 1 - {2}", GetStepString(), positionLabel, medPrecisionLabel), probePositions, 0, allowLessThanZero));
|
||||
printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} 1 - {2}", GetStepString(), positionLabel, highPrecisionLabel), probePositions, 0, allowLessThanZero));
|
||||
|
||||
Vector2 probeFrontLeft = LevelWizardBase.GetPrintLevelPositionToSample(1);
|
||||
printLevelWizard.AddPage(new GetCoarseBedHeight(printLevelWizard, new Vector3(probeFrontLeft, 10), string.Format("{0} {1} 2 - {2}", GetStepString(), positionLabel, lowPrecisionLabel), probePositions,1));
|
||||
printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} 2 - {2}", GetStepString(), positionLabel, medPrecisionLabel), probePositions,1));
|
||||
printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} 2 - {2}", GetStepString(), positionLabel, highPrecisionLabel), probePositions,1));
|
||||
printLevelWizard.AddPage(new GetCoarseBedHeight(printLevelWizard, new Vector3(probeFrontLeft, 10), string.Format("{0} {1} 2 - {2}", GetStepString(), positionLabel, lowPrecisionLabel), probePositions, 1, allowLessThanZero));
|
||||
printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} 2 - {2}", GetStepString(), positionLabel, medPrecisionLabel), probePositions, 1, allowLessThanZero));
|
||||
printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} 2 - {2}", GetStepString(), positionLabel, highPrecisionLabel), probePositions, 1, allowLessThanZero));
|
||||
|
||||
Vector2 probeFrontRight = LevelWizardBase.GetPrintLevelPositionToSample(2);
|
||||
printLevelWizard.AddPage(new GetCoarseBedHeight(printLevelWizard, new Vector3(probeFrontRight, 10), string.Format("{0} {1} 3 - {2}", GetStepString(), positionLabel, lowPrecisionLabel), probePositions,2));
|
||||
printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} 3 - {2}", GetStepString(), positionLabel, medPrecisionLabel), probePositions,2));
|
||||
printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} 3 - {2}", GetStepString(), positionLabel, highPrecisionLabel), probePositions,2));
|
||||
printLevelWizard.AddPage(new GetCoarseBedHeight(printLevelWizard, new Vector3(probeFrontRight, 10), string.Format("{0} {1} 3 - {2}", GetStepString(), positionLabel, lowPrecisionLabel), probePositions, 2, allowLessThanZero));
|
||||
printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} 3 - {2}", GetStepString(), positionLabel, medPrecisionLabel), probePositions,2, allowLessThanZero));
|
||||
printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} 3 - {2}", GetStepString(), positionLabel, highPrecisionLabel), probePositions,2, allowLessThanZero));
|
||||
|
||||
string doneInstructions = string.Format("{0}\n\n\t• {1}\n\n{2}", doneInstructionsText, doneInstructionsTextTwo, doneInstructionsTextThree);
|
||||
printLevelWizard.AddPage(new LastPage3PointInstructions("Done".Localize(), doneInstructions, probePositions));
|
||||
|
|
|
|||
|
|
@ -212,14 +212,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
string highPrecisionLabel = "High Precision".Localize();
|
||||
|
||||
double bedRadius = Math.Min(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size).x, ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size).y) / 2;
|
||||
bool allowLessThanZero = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.z_can_be_negative);
|
||||
|
||||
double startProbeHeight = 5;
|
||||
double startProbeHeight = 5;
|
||||
for (int i = 0; i < numberOfRadialSamples + 1; i++)
|
||||
{
|
||||
Vector2 probePosition = GetPrintLevelPositionToSample(i, bedRadius);
|
||||
printLevelWizard.AddPage(new GetCoarseBedHeight(printLevelWizard, new Vector3(probePosition, startProbeHeight), string.Format("{0} {1} {2} - {3}", GetStepString(), positionLabel, i + 1, lowPrecisionLabel), probePositions, i));
|
||||
printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} {2} - {3}", GetStepString(), positionLabel, i + 1, medPrecisionLabel), probePositions, i));
|
||||
printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} {2} - {3}", GetStepString(), positionLabel, i + 1, highPrecisionLabel), probePositions, i));
|
||||
printLevelWizard.AddPage(new GetCoarseBedHeight(printLevelWizard, new Vector3(probePosition, startProbeHeight), string.Format("{0} {1} {2} - {3}", GetStepString(), positionLabel, i + 1, lowPrecisionLabel), probePositions, i, allowLessThanZero));
|
||||
printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} {2} - {3}", GetStepString(), positionLabel, i + 1, medPrecisionLabel), probePositions, i, allowLessThanZero));
|
||||
printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} {2} - {3}", GetStepString(), positionLabel, i + 1, highPrecisionLabel), probePositions, i, allowLessThanZero));
|
||||
}
|
||||
|
||||
string doneInstructions = string.Format("{0}\n\n\t• {1}\n\n{2}", doneInstructionsText, doneInstructionsTextTwo, doneInstructionsTextThree);
|
||||
|
|
|
|||
|
|
@ -158,8 +158,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
ActiveSliceSettings.Instance.Helpers.DoPrintLeveling(false);
|
||||
// clear any data that we are going to be acquiring (sampled positions, after z home offset)
|
||||
PrintLevelingData levelingData = ActiveSliceSettings.Instance.Helpers.GetPrintLevelingData();
|
||||
levelingData.SampledPositions.Clear();
|
||||
ActiveSliceSettings.Instance.SetValue(SettingsKey.z_offset_after_home, 0.ToString());
|
||||
levelingData.SampledPositions.Clear();
|
||||
ApplicationController.Instance.ReloadAdvancedControlsPanel();
|
||||
|
||||
LevelWizardBase printLevelWizardWindow;
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
public override void PageIsBecomingActive()
|
||||
{
|
||||
PrintLevelingData levelingData = ActiveSliceSettings.Instance.Helpers.GetPrintLevelingData();
|
||||
levelingData.SampledPositions.Clear();
|
||||
|
||||
Vector3 paperWidth = new Vector3(0, 0, ActiveSliceSettings.Instance.GetValue<double>("manual_probe_paper_width"));
|
||||
for (int i = 0; i < probePositions.Count; i++)
|
||||
|
|
@ -187,13 +188,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private List<ProbePosition> probePositions;
|
||||
int probePositionsBeingEditedIndex;
|
||||
private double moveAmount;
|
||||
private bool allowLessThan0;
|
||||
|
||||
protected JogControls.MoveButton zPlusControl;
|
||||
protected JogControls.MoveButton zMinusControl;
|
||||
|
||||
public FindBedHeight(string pageDescription, string setZHeightCoarseInstruction1, string setZHeightCoarseInstruction2, double moveDistance, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex)
|
||||
public FindBedHeight(string pageDescription, string setZHeightCoarseInstruction1, string setZHeightCoarseInstruction2, double moveDistance, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex, bool allowLessThan0)
|
||||
: base(pageDescription, setZHeightCoarseInstruction1)
|
||||
{
|
||||
this.allowLessThan0 = allowLessThan0;
|
||||
this.probePositions = probePositions;
|
||||
this.moveAmount = moveDistance;
|
||||
this.lastReportedPosition = PrinterConnectionAndCommunication.Instance.LastReportedPosition;
|
||||
|
|
@ -254,24 +257,20 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
return zButtons;
|
||||
}
|
||||
|
||||
private static string zIsTooLowMessage = "You cannot move any lower. This position on your bed is too low for the extruder to reach. You need to raise your bed, or adjust your limits to allow the extruder to go lower.".Localize();
|
||||
private static string zTooLowTitle = "Warning - Moving Too Low".Localize();
|
||||
|
||||
private void zMinusControl_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
double newPosition = PrinterConnectionAndCommunication.Instance.LastReportedPosition.z - moveAmount;
|
||||
bool moveBelow0 = newPosition < 0;
|
||||
if (moveBelow0)
|
||||
if (!allowLessThan0
|
||||
&& PrinterConnectionAndCommunication.Instance.LastReportedPosition.z - moveAmount < 0)
|
||||
{
|
||||
// increment the z_offset_after_home
|
||||
double zOffset = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.z_offset_after_home);
|
||||
zOffset += 1;
|
||||
ActiveSliceSettings.Instance.SetValue(SettingsKey.z_offset_after_home, zOffset.ToString());
|
||||
// adjust all previously sampled points
|
||||
for(int i=0; i< probePositions.Count; i++)
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
probePositions[i].position = probePositions[i].position + new Vector3(0, 0, 1);
|
||||
}
|
||||
|
||||
// send a G92 z position to the printer to adjust the current z height
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow($"G92 Z{PrinterConnectionAndCommunication.Instance.CurrentDestination.z + 1}");
|
||||
StyledMessageBox.ShowMessageBox(null, zIsTooLowMessage, zTooLowTitle, StyledMessageBox.MessageType.OK);
|
||||
});
|
||||
// don't move the bed lower it will not work when we print.
|
||||
return;
|
||||
}
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, -moveAmount, ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds().z);
|
||||
|
|
@ -299,8 +298,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
protected Vector3 probeStartPosition;
|
||||
protected WizardControl container;
|
||||
|
||||
public GetCoarseBedHeight(WizardControl container, Vector3 probeStartPosition, string pageDescription, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex)
|
||||
: base(pageDescription, setZHeightCoarseInstruction1, setZHeightCoarseInstruction2, 1, probePositions, probePositionsBeingEditedIndex)
|
||||
public GetCoarseBedHeight(WizardControl container, Vector3 probeStartPosition, string pageDescription, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex, bool allowLessThan0)
|
||||
: base(pageDescription, setZHeightCoarseInstruction1, setZHeightCoarseInstruction2, 1, probePositions, probePositionsBeingEditedIndex, allowLessThan0)
|
||||
{
|
||||
this.container = container;
|
||||
this.probeStartPosition = probeStartPosition;
|
||||
|
|
@ -343,8 +342,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private static string setZHeightFineInstructionTextThree = LocalizedString.Get("Finally click 'Next' to continue.");
|
||||
private static string setZHeightFineInstruction2 = string.Format("\t• {0}\n\t• {1}\n\n{2}", setZHeightFineInstructionTextOne, setZHeightFineInstructionTextTwo, setZHeightFineInstructionTextThree);
|
||||
|
||||
public GetFineBedHeight(string pageDescription, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex)
|
||||
: base(pageDescription, setZHeightFineInstruction1, setZHeightFineInstruction2, .1, probePositions, probePositionsBeingEditedIndex)
|
||||
public GetFineBedHeight(string pageDescription, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex, bool allowLessThan0)
|
||||
: base(pageDescription, setZHeightFineInstruction1, setZHeightFineInstruction2, .1, probePositions, probePositionsBeingEditedIndex, allowLessThan0)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -356,8 +355,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private static string setHeightFineInstructionTextTwo = LocalizedString.Get("Finally click 'Next' to continue.");
|
||||
private static string setZHeightFineInstruction2 = string.Format("\t• {0}\n\n\n{1}", setHeightFineInstructionTextOne, setHeightFineInstructionTextTwo);
|
||||
|
||||
public GetUltraFineBedHeight(string pageDescription, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex)
|
||||
: base(pageDescription, setZHeightFineInstruction1, setZHeightFineInstruction2, .02, probePositions, probePositionsBeingEditedIndex)
|
||||
public GetUltraFineBedHeight(string pageDescription, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex, bool allowLessThan0)
|
||||
: base(pageDescription, setZHeightFineInstruction1, setZHeightFineInstruction2, .02, probePositions, probePositionsBeingEditedIndex, allowLessThan0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using Newtonsoft.Json;
|
|||
using Newtonsoft.Json.Converters;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
||||
{
|
||||
|
|
@ -104,6 +105,21 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
return false;
|
||||
}
|
||||
|
||||
var positionCounts = from x in SampledPositions
|
||||
group x by x into g
|
||||
let count = g.Count()
|
||||
orderby count descending
|
||||
select new { Value = g.Key, Count = count };
|
||||
|
||||
foreach (var x in positionCounts)
|
||||
{
|
||||
if(x.Count > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (CurrentPrinterLevelingSystem)
|
||||
{
|
||||
case PrintLevelingData.LevelingSystem.Probe3Points:
|
||||
|
|
|
|||
|
|
@ -327,6 +327,10 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Copy(gcodeFilename, dest, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
|
|||
this.Name = this.ItemName + " Row Item Collection";
|
||||
|
||||
CreateGuiElements(openButtonText);
|
||||
|
||||
MouseEnterBounds += (s, e) => EnteredBounds();
|
||||
MouseLeaveBounds += (s, e) => EnteredBounds();
|
||||
}
|
||||
|
||||
public PrintItemCollection PrintItemCollection { get { return printItemCollection; } }
|
||||
|
|
@ -266,7 +269,7 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
|
|||
AddHandlers();
|
||||
}
|
||||
|
||||
public override void OnMouseMove(MouseEventArgs mouseEvent)
|
||||
void EnteredBounds()
|
||||
{
|
||||
switch (UnderMouseState)
|
||||
{
|
||||
|
|
@ -289,8 +292,6 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
base.OnMouseMove(mouseEvent);
|
||||
}
|
||||
|
||||
private void AddHandlers()
|
||||
|
|
|
|||
|
|
@ -390,26 +390,33 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private static ImageBuffer LoadImageFromDisk(PartThumbnailWidget thumbnailWidget, string stlHashCode)
|
||||
{
|
||||
ImageBuffer tempImage = new ImageBuffer(BigRenderSize.x, BigRenderSize.y);
|
||||
string imageFileName = GetImageFileName(stlHashCode);
|
||||
|
||||
if (File.Exists(imageFileName))
|
||||
try
|
||||
{
|
||||
if (partExtension == ".png")
|
||||
ImageBuffer tempImage = new ImageBuffer(BigRenderSize.x, BigRenderSize.y);
|
||||
string imageFileName = GetImageFileName(stlHashCode);
|
||||
|
||||
if (File.Exists(imageFileName))
|
||||
{
|
||||
if (ImageIO.LoadImageData(imageFileName, tempImage))
|
||||
if (partExtension == ".png")
|
||||
{
|
||||
return tempImage;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImageTgaIO.LoadImageData(imageFileName, tempImage))
|
||||
{
|
||||
return tempImage;
|
||||
if (ImageIO.LoadImageData(imageFileName, tempImage))
|
||||
{
|
||||
return tempImage;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImageTgaIO.LoadImageData(imageFileName, tempImage))
|
||||
{
|
||||
return tempImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -614,13 +621,13 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
case ImageSizes.Size115x115:
|
||||
{
|
||||
StaticData.Instance.LoadIcon(Path.ChangeExtension("icon_sd_card_115x115", partExtension), this.thumbnailImage);
|
||||
this.thumbnailImage = StaticData.Instance.LoadIcon(Path.ChangeExtension("icon_sd_card_115x115", partExtension)).InvertLightness();
|
||||
}
|
||||
break;
|
||||
|
||||
case ImageSizes.Size50x50:
|
||||
{
|
||||
StaticData.Instance.LoadIcon(Path.ChangeExtension("icon_sd_card_50x50", partExtension), this.thumbnailImage);
|
||||
this.thumbnailImage = StaticData.Instance.LoadIcon(Path.ChangeExtension("icon_sd_card_50x50", partExtension)).InvertLightness();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -90,8 +90,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
// save it for this printer
|
||||
ActiveSliceSettings.Instance.SetValue(SettingsKey.active_theme_name, themeName);
|
||||
|
||||
UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, themeName);
|
||||
//Set new user selected Default
|
||||
ActiveTheme.Instance = ActiveTheme.GetThemeColors(themeName);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace MatterHackers.MatterControl.DataStorage.ClassicDB
|
|||
|
||||
if (string.IsNullOrEmpty(ProfileManager.Instance.LastProfileID))
|
||||
{
|
||||
ProfileManager.Instance.SetLastProfile(printer.Id.ToString());
|
||||
ProfileManager.Instance.LastProfileID = printer.Id.ToString();
|
||||
}
|
||||
|
||||
printerSettings.UserLayer[SettingsKey.active_theme_name] = UserSettings.Instance.get(UserSettingsKey.ActiveThemeName);
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
FileDialog.OpenFileDialog(
|
||||
new OpenFileDialogParams("EEPROM Settings" + "|*.ini")
|
||||
new OpenFileDialogParams("EEPROM Settings|*.ini")
|
||||
{
|
||||
ActionButtonLabel = "Import EEPROM Settings".Localize(),
|
||||
Title = "Import EEPROM".Localize(),
|
||||
|
|
@ -237,7 +237,7 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
{
|
||||
string defaultFileNameNoPath = "eeprom_settings.ini";
|
||||
FileDialog.SaveFileDialog(
|
||||
new SaveFileDialogParams("EEPROM Settings" + "|*.ini")
|
||||
new SaveFileDialogParams("EEPROM Settings|*.ini")
|
||||
{
|
||||
ActionButtonLabel = "Export EEPROM Settings".Localize(),
|
||||
Title = "Export EEPROM".Localize(),
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
FileDialog.OpenFileDialog(
|
||||
new OpenFileDialogParams("EEPROM Settings" + "|*.ini")
|
||||
new OpenFileDialogParams("EEPROM Settings|*.ini")
|
||||
{
|
||||
ActionButtonLabel = "Import EEPROM Settings".Localize(),
|
||||
Title = "Import EEPROM".Localize(),
|
||||
|
|
@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
FileDialog.SaveFileDialog(
|
||||
new SaveFileDialogParams("EEPROM Settings" + "|*.ini")
|
||||
new SaveFileDialogParams("EEPROM Settings|*.ini")
|
||||
{
|
||||
ActionButtonLabel = "Export EEPROM Settings".Localize(),
|
||||
Title = "Export EEPROM".Localize(),
|
||||
|
|
|
|||
|
|
@ -80,6 +80,9 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
this.libraryDataView = libraryDataView;
|
||||
this.IsViewHelperItem = false;
|
||||
this.EnableSlideInActions = true;
|
||||
|
||||
MouseEnterBounds += (s, e) => EnteredBounds();
|
||||
MouseLeaveBounds += (s, e) => EnteredBounds();
|
||||
}
|
||||
|
||||
public string ItemName { get; protected set; }
|
||||
|
|
@ -305,7 +308,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
|
||||
#endregion Abstract Functions
|
||||
|
||||
public override void OnMouseMove(MouseEventArgs mouseEvent)
|
||||
void EnteredBounds()
|
||||
{
|
||||
switch (UnderMouseState)
|
||||
{
|
||||
|
|
@ -328,8 +331,6 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
base.OnMouseMove(mouseEvent);
|
||||
}
|
||||
|
||||
private void AddHandlers()
|
||||
|
|
@ -374,14 +375,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
{
|
||||
//this.VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
this.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
if (UserSettings.Instance.DisplayMode == ApplicationDisplayType.Touchscreen)
|
||||
{
|
||||
this.Height = 65;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Height = 50;
|
||||
}
|
||||
this.Height = 50 * GuiWidget.DeviceScale;
|
||||
|
||||
this.Padding = new BorderDouble(0);
|
||||
this.Margin = new BorderDouble(6, 0, 6, 6);
|
||||
|
|
|
|||
|
|
@ -472,14 +472,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
{
|
||||
//this.VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
this.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
if (UserSettings.Instance.DisplayMode == ApplicationDisplayType.Touchscreen)
|
||||
{
|
||||
this.Height = 65;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Height = 50;
|
||||
}
|
||||
this.Height = 50 * GuiWidget.DeviceScale;
|
||||
|
||||
this.Padding = new BorderDouble(0);
|
||||
this.Margin = new BorderDouble(6, 0, 6, 6);
|
||||
|
|
|
|||
|
|
@ -219,7 +219,6 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
|
||||
public override void ShareItem(int itemIndexToShare)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void CloudSyncStatusChanged(object sender, EventArgs eventArgs)
|
||||
|
|
@ -227,7 +226,8 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
var e = eventArgs as ApplicationController.CloudSyncEventArgs;
|
||||
|
||||
// If signing out, we need to force selection to this provider
|
||||
if (e != null && !e.IsAuthenticated)
|
||||
if (e?.IsAuthenticated == false
|
||||
&& SetCurrentLibraryProvider != null)
|
||||
{
|
||||
// Switch to the selector
|
||||
SetCurrentLibraryProvider(this);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace MatterHackers.MatterControl
|
|||
public static string MCWSBaseUri { get; } = "https://mattercontrol.appspot.com";
|
||||
#endif
|
||||
|
||||
public static bool CameraInUseByOtherProcess = false;
|
||||
public static bool CameraInUseByExternalProcess { get; set; } = false;
|
||||
public bool RestartOnClose = false;
|
||||
private static readonly Vector2 minSize = new Vector2(600, 600);
|
||||
private static MatterControlApplication instance;
|
||||
|
|
@ -103,7 +103,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
static MatterControlApplication()
|
||||
{
|
||||
if (OsInformation.OperatingSystem == OSType.Mac)
|
||||
if (OsInformation.OperatingSystem == OSType.Mac && StaticData.Instance == null)
|
||||
{
|
||||
// Set working directory - this duplicates functionality in Main but is necessary on OSX as Main fires much later (after the constructor in this case)
|
||||
// resulting in invalid paths due to path tests running before the working directory has been overridden. Setting the value before initializing StaticData
|
||||
|
|
@ -602,27 +602,53 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
{
|
||||
// Needed as we can't assign to CancelClose inside of the lambda below
|
||||
bool continueWithShutdown = false;
|
||||
|
||||
StyledMessageBox.ShowMessageBox(
|
||||
(shutdownConfirmed) => continueWithShutdown = shutdownConfirmed,
|
||||
"Are you sure you want to abort the current print and close MatterControl?".Localize(),
|
||||
"Abort Print".Localize(),
|
||||
StyledMessageBox.MessageType.YES_NO);
|
||||
|
||||
if (continueWithShutdown)
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd)
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd)
|
||||
// Needed as we can't assign to CancelClose inside of the lambda below
|
||||
bool continueWithShutdown = false;
|
||||
|
||||
StyledMessageBox.ShowMessageBox(
|
||||
(shutdownConfirmed) => continueWithShutdown = shutdownConfirmed,
|
||||
"Are you sure you want to abort the current print and close MatterControl?".Localize(),
|
||||
"Abort Print".Localize(),
|
||||
StyledMessageBox.MessageType.YES_NO);
|
||||
|
||||
if (continueWithShutdown)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
this.Close();
|
||||
CancelClose = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// It's safe to cancel an active print because PrinterConnectionAndCommunication.Disable will be called
|
||||
// when MatterControlApplication.OnClosed is invoked
|
||||
CancelClose = true;
|
||||
}
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
bool continueWithShutdown = false;
|
||||
|
||||
// It's safe to cancel an active print because PrinterConnectionAndCommunication.Disable will be called
|
||||
// when MatterControlApplication.OnClosed is invoked
|
||||
CancelClose = true;
|
||||
StyledMessageBox.ShowMessageBox(
|
||||
(shutdownConfirmed) => continueWithShutdown = shutdownConfirmed,
|
||||
"Are you sure you want exit while a print is running from SD Card?\n\nNote: If you exit, it is recommended you wait until the print is completed before running MatterControl again.".Localize(),
|
||||
"Exit while printing".Localize(),
|
||||
StyledMessageBox.MessageType.YES_NO);
|
||||
|
||||
if (continueWithShutdown)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
this.Close();
|
||||
CancelClose = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// It's safe to cancel an active print because PrinterConnectionAndCommunication.Disable will be called
|
||||
// when MatterControlApplication.OnClosed is invoked
|
||||
CancelClose = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (PartsSheet.IsSaving())
|
||||
{
|
||||
|
|
@ -848,29 +874,14 @@ namespace MatterHackers.MatterControl
|
|||
bool showNamesUnderMouse = false;
|
||||
public override void OnKeyDown(KeyEventArgs keyEvent)
|
||||
{
|
||||
if (keyEvent.KeyCode == Keys.F2)
|
||||
{
|
||||
Task.Run((Action)AutomationTest);
|
||||
}
|
||||
else if (keyEvent.KeyCode == Keys.F1)
|
||||
if (keyEvent.KeyCode == Keys.F1)
|
||||
{
|
||||
showNamesUnderMouse = !showNamesUnderMouse;
|
||||
}
|
||||
|
||||
base.OnKeyDown(keyEvent);
|
||||
}
|
||||
|
||||
private void AutomationTest()
|
||||
{
|
||||
AutomationRunner test = new AutomationRunner();
|
||||
test.ClickByName("Library Tab", 5);
|
||||
test.ClickByName("Queue Tab", 5);
|
||||
test.ClickByName("Queue Item SkeletonArm_Med", 5);
|
||||
test.ClickByName("3D View Edit", 5);
|
||||
test.Wait(.2);
|
||||
test.DragByName("SkeletonArm_Med_IObject3D", 5);
|
||||
test.DropByName("SkeletonArm_Med_IObject3D", 5, offset: new Point2D(0, -40));
|
||||
}
|
||||
|
||||
public static void CheckKnownAssemblyConditionalCompSymbols()
|
||||
{
|
||||
MatterControlApplication.AssertDebugNotDefined();
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
presetScaleMenu.AddItem("in to mm (25.4)");
|
||||
presetScaleMenu.AddItem("mm to cm (.1)");
|
||||
presetScaleMenu.AddItem("cm to mm (10)");
|
||||
string resetLable = "reset".Localize();
|
||||
string resetLable = "none".Localize();
|
||||
string resetLableFull = "{0} (1)".FormatWith(resetLable);
|
||||
presetScaleMenu.AddItem(resetLableFull);
|
||||
|
||||
|
|
@ -245,7 +245,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
scaleRatioControl.ActuallNumberEdit.Value = scale;
|
||||
ApplyScaleFromEditField();
|
||||
};
|
||||
|
||||
return presetScaleMenu;
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
iconTextImageButtonFactory.checkedBorderColor = RGBA_Bytes.White;
|
||||
|
||||
BackgroundColor = new RGBA_Bytes(0, 0, 0, 120);
|
||||
iconTextImageButtonFactory.FixedHeight = buttonHeight;
|
||||
iconTextImageButtonFactory.FixedWidth = buttonHeight;
|
||||
iconTextImageButtonFactory.FixedHeight = buttonHeight * GuiWidget.DeviceScale;
|
||||
iconTextImageButtonFactory.FixedWidth = buttonHeight * GuiWidget.DeviceScale;
|
||||
|
||||
string resetViewIconPath = Path.Combine("ViewTransformControls", "reset.png");
|
||||
resetViewButton = iconTextImageButtonFactory.Generate("", StaticData.Instance.LoadIcon(resetViewIconPath,32,32).InvertLightness());
|
||||
|
|
@ -125,8 +125,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
BackgroundColor = new RGBA_Bytes(0, 0, 0, 120);
|
||||
|
||||
iconTextImageButtonFactory.FixedHeight = buttonHeight;
|
||||
iconTextImageButtonFactory.FixedWidth = buttonHeight;
|
||||
iconTextImageButtonFactory.FixedHeight = buttonHeight * GuiWidget.DeviceScale;
|
||||
iconTextImageButtonFactory.FixedWidth = buttonHeight * GuiWidget.DeviceScale;
|
||||
|
||||
string select2dIconPath = Path.Combine("ViewTransformControls", "2d.png");
|
||||
twoDimensionButton = iconTextImageButtonFactory.GenerateRadioButton("", select2dIconPath);
|
||||
|
|
|
|||
|
|
@ -131,8 +131,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
||||
BackgroundColor = new RGBA_Bytes(0, 0, 0, 120);
|
||||
textImageButtonFactory.FixedHeight = buttonHeight;
|
||||
textImageButtonFactory.FixedWidth = buttonHeight;
|
||||
textImageButtonFactory.FixedHeight = buttonHeight * GuiWidget.DeviceScale;
|
||||
textImageButtonFactory.FixedWidth = buttonHeight * GuiWidget.DeviceScale;
|
||||
textImageButtonFactory.AllowThemeToAdjustImage = false;
|
||||
textImageButtonFactory.checkedBorderColor = RGBA_Bytes.White;
|
||||
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
//using (new PerformanceTimer("GCode Timer", "Render"))
|
||||
{
|
||||
gCodeRenderer.Render(graphics2D, renderInfo);
|
||||
gCodeRenderer?.Render(graphics2D, renderInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,21 +112,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
return currentDestination;
|
||||
}
|
||||
|
||||
public static bool LineIsZHoming(string lineBeingSent)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(lineBeingSent))
|
||||
{
|
||||
bool isAZHome = lineBeingSent.StartsWith("G28") && lineBeingSent.Contains("Z");
|
||||
bool isANakedHome = lineBeingSent.Trim() == "G28";
|
||||
if (isAZHome || isANakedHome)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool LineIsMovement(string lineBeingSent)
|
||||
{
|
||||
if (lineBeingSent.StartsWith("G0 ")
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public class PrintLevelingStream : GCodeStreamProxy
|
||||
{
|
||||
bool activePrinting;
|
||||
bool hadZHome = false;
|
||||
protected PrinterMove lastDestination = new PrinterMove();
|
||||
public PrintLevelingStream(GCodeStream internalStream, bool activePrinting)
|
||||
: base(internalStream)
|
||||
|
|
@ -52,30 +51,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public PrinterMove LastDestination { get { return lastDestination; } }
|
||||
public override string ReadLine()
|
||||
{
|
||||
if (hadZHome)
|
||||
{
|
||||
hadZHome = false;
|
||||
// only add this when exporting to gcode
|
||||
if (!activePrinting)
|
||||
{
|
||||
// return the correct G92
|
||||
double zOffset = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.z_offset_after_home);
|
||||
if (zOffset != 0)
|
||||
{
|
||||
double newHomePosition = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.printer_z_after_home) + zOffset;
|
||||
return $"G92 Z{newHomePosition}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string lineFromChild = base.ReadLine();
|
||||
|
||||
if (lineFromChild != null
|
||||
&& LineIsZHoming(lineFromChild))
|
||||
{
|
||||
hadZHome = true;
|
||||
}
|
||||
|
||||
if (lineFromChild != null
|
||||
&& PrinterConnectionAndCommunication.Instance.ActivePrinter.GetValue<bool>(SettingsKey.print_leveling_enabled))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
queuedCommands.Add("G28 Y0");
|
||||
// move to the place we can home z from
|
||||
Vector2 recoveryPositionXy = ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.recover_position_before_z_home);
|
||||
queuedCommands.Add("G1 X{0:0.000}Y{1:0.000}F{2}".FormatWith(recoveryPositionXy.x, recoveryPositionXy.y, MovementControls.XSpeed));
|
||||
queuedCommands.Add("G1 X{0:0.###}Y{1:0.###}F{2}".FormatWith(recoveryPositionXy.x, recoveryPositionXy.y, MovementControls.XSpeed));
|
||||
// home z
|
||||
queuedCommands.Add("G28 Z0");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
ReadLineContainsCallBacks.AddCallbackToKey("T:", ReadTemperatures);
|
||||
|
||||
ReadLineContainsCallBacks.AddCallbackToKey("rs ", PrinterRequestsResend); // smoothie is lower case and no :
|
||||
ReadLineContainsCallBacks.AddCallbackToKey("RS:", PrinterRequestsResend);
|
||||
ReadLineContainsCallBacks.AddCallbackToKey("Resend:", PrinterRequestsResend);
|
||||
|
||||
|
|
@ -1278,13 +1279,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
public void MoveAbsolute(Axis axis, double axisPositionMm, double feedRateMmPerMinute)
|
||||
{
|
||||
SetMovementToAbsolute();
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 {0}{1} F{2}".FormatWith(axis, axisPositionMm, feedRateMmPerMinute));
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 {0}{1:0.###} F{2}".FormatWith(axis, axisPositionMm, feedRateMmPerMinute));
|
||||
}
|
||||
|
||||
public void MoveAbsolute(Vector3 position, double feedRateMmPerMinute)
|
||||
{
|
||||
SetMovementToAbsolute();
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 X{0}Y{1}Z{2} F{3}".FormatWith(position.x, position.y, position.z, feedRateMmPerMinute));
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 X{0:0.###}Y{1:0.###}Z{2:0.###} F{3}".FormatWith(position.x, position.y, position.z, feedRateMmPerMinute));
|
||||
}
|
||||
|
||||
public void MoveExtruderRelative(double moveAmountMm, double feedRateMmPerMinute, int extruderNumber = 0)
|
||||
|
|
@ -1301,7 +1302,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("T{0}".FormatWith(extruderNumber)); //Set active extruder
|
||||
}
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 E{0} F{1}".FormatWith(moveAmountMm, feedRateMmPerMinute));
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 E{0:0.###} F{1}".FormatWith(moveAmountMm, feedRateMmPerMinute));
|
||||
|
||||
if (requiresToolChange)
|
||||
{
|
||||
|
|
@ -1317,7 +1318,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
if (moveAmountMm != 0)
|
||||
{
|
||||
SetMovementToRelative();
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 {0}{1} F{2}".FormatWith(axis, moveAmountMm, feedRateMmPerMinute));
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 {0}{1:0.###} F{2}".FormatWith(axis, moveAmountMm, feedRateMmPerMinute));
|
||||
SetMovementToAbsolute();
|
||||
}
|
||||
}
|
||||
|
|
@ -1523,12 +1524,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
}
|
||||
}
|
||||
|
||||
bool reportedError = false;
|
||||
bool haveReportedError = false;
|
||||
public void PrinterReportsError(object sender, EventArgs e)
|
||||
{
|
||||
if (!reportedError)
|
||||
if (!haveReportedError)
|
||||
{
|
||||
reportedError = true;
|
||||
haveReportedError = true;
|
||||
FoundStringEventArgs foundStringEventArgs = e as FoundStringEventArgs;
|
||||
if (foundStringEventArgs != null)
|
||||
{
|
||||
|
|
@ -1720,6 +1721,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
if (segments.Length <= MAX_INVALID_CONNECTION_CHARS)
|
||||
{
|
||||
CommunicationState = CommunicationStates.Connected;
|
||||
haveReportedError = false;
|
||||
// now send any command that initialize this printer
|
||||
string connectGCode = ActiveSliceSettings.Instance.GetValue(SettingsKey.connect_gcode);
|
||||
SendLineToPrinterNow(connectGCode);
|
||||
|
|
@ -1838,26 +1840,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
waitingForPosition.Stop();
|
||||
waitingForPosition.Reset();
|
||||
|
||||
if(storePositionToPrinterZAfterHome)
|
||||
{
|
||||
storePositionToPrinterZAfterHome = false;
|
||||
double storedHomePosition = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.printer_z_after_home);
|
||||
// if printer_z_after_home != current z position
|
||||
if (storedHomePosition != LastReportedPosition.z)
|
||||
{
|
||||
ActiveSliceSettings.Instance.SetValue(SettingsKey.printer_z_after_home, LastReportedPosition.z.ToString());
|
||||
ApplicationController.Instance.ReloadAdvancedControlsPanel();
|
||||
}
|
||||
|
||||
// now send a G92 to set the position that we want to think is home
|
||||
double zOffset = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.z_offset_after_home);
|
||||
if (zOffset != 0)
|
||||
{
|
||||
double newHomePosition = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.printer_z_after_home) + zOffset;
|
||||
SendLineToPrinterNow($"G92 Z{newHomePosition}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ReadTemperatures(object sender, EventArgs e)
|
||||
|
|
@ -2137,6 +2119,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
return;
|
||||
}
|
||||
|
||||
haveReportedError = false;
|
||||
printWasCanceled = false;
|
||||
ExtrusionRatio = 1;
|
||||
FeedRateRatio = 1;
|
||||
|
|
@ -2290,7 +2273,11 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
if (PrinterIsConnected)
|
||||
{
|
||||
#if DEBUG
|
||||
throw new Exception(LocalizedString.Get("You can only connect when not currently connected."));
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool serialPortIsAvailable = SerialPortIsAvailable(serialPortName);
|
||||
|
|
@ -2818,13 +2805,22 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
double currentDone = loadedGCode.PercentComplete(gCodeFileStream0.LineIndex);
|
||||
// Only update the amount done if it is greater than what is recorded.
|
||||
// We don't want to mess up the resume before we actually resume it.
|
||||
if (activePrintTask.PercentDone < currentDone)
|
||||
if (activePrintTask != null
|
||||
&& babyStepsStream6 != null
|
||||
&& activePrintTask.PercentDone < currentDone)
|
||||
{
|
||||
activePrintTask.PercentDone = currentDone;
|
||||
activePrintTask.PrintingOffsetX = (float)babyStepsStream6.Offset.x;
|
||||
activePrintTask.PrintingOffsetY = (float)babyStepsStream6.Offset.y;
|
||||
activePrintTask.PrintingOffsetZ = (float)babyStepsStream6.Offset.z;
|
||||
activePrintTask.Commit();
|
||||
try
|
||||
{
|
||||
Task.Run(() => activePrintTask.Commit());
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Can't write for some reason, continue with the write.
|
||||
}
|
||||
}
|
||||
secondsSinceUpdateHistory = secondsSinceStartedPrint;
|
||||
}
|
||||
|
|
@ -2933,11 +2929,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|| (lineWithoutChecksum.StartsWith("T") && !lineWithoutChecksum.StartsWith("T:"))) // is a switch extruder (verify this is the right time to ask this)
|
||||
{
|
||||
SendLineToPrinterNow("M114");
|
||||
|
||||
if (GCodeStream.LineIsZHoming(lineWithoutChecksum))
|
||||
{
|
||||
storePositionToPrinterZAfterHome = true;
|
||||
}
|
||||
}
|
||||
|
||||
// write data to communication
|
||||
|
|
@ -3015,7 +3006,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
}
|
||||
|
||||
bool haveHookedDrawing = false;
|
||||
private bool storePositionToPrinterZAfterHome = false;
|
||||
|
||||
public class ReadThread
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
{
|
||||
public class SetupStepComPortManual : ConnectionWizardPage
|
||||
{
|
||||
private static Regex linuxDefaultUIFilter = new Regex("/dev/ttyS*\\d+", RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
|
||||
private Button nextButton;
|
||||
private Button connectButton;
|
||||
private Button refreshButton;
|
||||
|
|
@ -164,21 +162,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
protected void CreateSerialPortControls(FlowLayoutWidget comPortContainer, string activePrinterSerialPort)
|
||||
{
|
||||
int portIndex = 0;
|
||||
string[] allPorts = FrostedSerialPort.GetPortNames();
|
||||
IEnumerable<string> filteredPorts;
|
||||
|
||||
if (OsInformation.OperatingSystem == OSType.X11)
|
||||
{
|
||||
// A default and naive filter that works well on Ubuntu 14
|
||||
filteredPorts = allPorts.Where(portName => portName != "/dev/tty" && !linuxDefaultUIFilter.Match(portName).Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
// looks_like_mac -- serialPort.StartsWith("/dev/tty."); looks_like_pc -- serialPort.StartsWith("COM")
|
||||
filteredPorts = allPorts.Where(portName => portName.StartsWith("/dev/tty.") || portName.StartsWith("COM"));
|
||||
}
|
||||
|
||||
IEnumerable<string> portsToCreate = filteredPorts.Any() ? filteredPorts : allPorts;
|
||||
string[] portsToCreate = FrostedSerialPort.GetPortNames();
|
||||
|
||||
// Add a radio button for each filtered port
|
||||
foreach (string portName in portsToCreate)
|
||||
|
|
|
|||
|
|
@ -63,26 +63,20 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
printerMessageOne.HAnchor = HAnchor.ParentLeftRight;
|
||||
printerMessageOne.Margin = elementMargin;
|
||||
|
||||
string disconnectMessage = string.Format("1.) {0} ({1}).", "Disconnect printer".Localize(), "if currently connected".Localize());
|
||||
TextWidget printerMessageTwo = new TextWidget(disconnectMessage, 0, 0, 12);
|
||||
printerMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printerMessageTwo.HAnchor = HAnchor.ParentLeftRight;
|
||||
printerMessageTwo.Margin = elementMargin;
|
||||
string printerMessageFourBeg = "Connect printer and power on".Localize();
|
||||
string printerMessageFourFull = string.Format("1.) {0}.", printerMessageFourBeg);
|
||||
TextWidget printerMessageFour = new TextWidget(printerMessageFourFull, 0, 0, 12);
|
||||
printerMessageFour.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printerMessageFour.HAnchor = HAnchor.ParentLeftRight;
|
||||
printerMessageFour.Margin = elementMargin;
|
||||
|
||||
string printerMessageThreeBeg = "Power on and connect printer".Localize();
|
||||
string printerMessageThreeFull = string.Format("2.) {0}.", printerMessageThreeBeg);
|
||||
TextWidget printerMessageThree = new TextWidget(printerMessageThreeFull, 0, 0, 12);
|
||||
printerMessageThree.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printerMessageThree.HAnchor = HAnchor.ParentLeftRight;
|
||||
printerMessageThree.Margin = elementMargin;
|
||||
|
||||
string printerMessageFourTxtBeg = "Press".Localize();
|
||||
string printerMessageFourTxtEnd = "Connect".Localize();
|
||||
string printerMessageFourTxtFull = string.Format("3.) {0} '{1}'.", printerMessageFourTxtBeg, printerMessageFourTxtEnd);
|
||||
TextWidget printerMessageFour = new TextWidget(printerMessageFourTxtFull, 0, 0, 12);
|
||||
printerMessageFour.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printerMessageFour.HAnchor = HAnchor.ParentLeftRight;
|
||||
printerMessageFour.Margin = elementMargin;
|
||||
string printerMessageFiveTxtBeg = "Press".Localize();
|
||||
string printerMessageFiveTxtEnd = "Connect".Localize();
|
||||
string printerMessageFiveTxtFull = string.Format("2.) {0} '{1}'.", printerMessageFiveTxtBeg, printerMessageFiveTxtEnd);
|
||||
TextWidget printerMessageFive = new TextWidget(printerMessageFiveTxtFull, 0, 0, 12);
|
||||
printerMessageFive.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printerMessageFive.HAnchor = HAnchor.ParentLeftRight;
|
||||
printerMessageFive.Margin = elementMargin;
|
||||
|
||||
GuiWidget vSpacer = new GuiWidget();
|
||||
vSpacer.VAnchor = VAnchor.ParentBottomTop;
|
||||
|
|
@ -98,8 +92,6 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
printerErrorMessage.Margin = elementMargin;
|
||||
|
||||
container.AddChild(printerMessageOne);
|
||||
container.AddChild(printerMessageTwo);
|
||||
container.AddChild(printerMessageThree);
|
||||
container.AddChild(printerMessageFour);
|
||||
container.AddChild(printerErrorMessage);
|
||||
container.AddChild(vSpacer);
|
||||
|
|
|
|||
|
|
@ -78,21 +78,28 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
UiThread.RunOnIdle(WizardWindow.Close);
|
||||
}
|
||||
};
|
||||
|
||||
var createAccountButton = textImageButtonFactory.Generate("Create Account".Localize());
|
||||
createAccountButton.Name = "Create Account From Connection Wizard Button";
|
||||
createAccountButton.Margin = new Agg.BorderDouble(right: 5);
|
||||
createAccountButton.Click += (s, e) =>
|
||||
{
|
||||
WizardWindow.ChangeToAccountCreate();
|
||||
UiThread.RunOnIdle(WizardWindow.Close);
|
||||
UiThread.RunOnIdle (() =>
|
||||
{
|
||||
WizardWindow.Close();
|
||||
WizardWindow.ChangeToAccountCreate();
|
||||
});
|
||||
};
|
||||
|
||||
var signInButton = textImageButtonFactory.Generate("Sign In".Localize());
|
||||
signInButton.Name = "Sign In From Connection Wizard Button";
|
||||
signInButton.Click += (s, e) =>
|
||||
{
|
||||
WizardWindow.ShowAuthDialog?.Invoke();
|
||||
UiThread.RunOnIdle(WizardWindow.Close);
|
||||
UiThread.RunOnIdle (() =>
|
||||
{
|
||||
WizardWindow.Close();
|
||||
WizardWindow.ShowAuthDialog?.Invoke();
|
||||
});
|
||||
};
|
||||
|
||||
footerRow.AddChild(skipButton);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2016, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -526,7 +526,9 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
{
|
||||
get
|
||||
{
|
||||
if (SelectedIndex != -1)
|
||||
if (SelectedIndex != -1
|
||||
&& topToBottomItemList.Children?.Count > SelectedIndex
|
||||
&& topToBottomItemList.Children[SelectedIndex].Children?.Count > 0)
|
||||
{
|
||||
return topToBottomItemList.Children[SelectedIndex].Children[0];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -678,10 +678,9 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
|
||||
private void sendButton_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
//Open export options
|
||||
List<PrintItemWrapper> itemList = this.queueDataView.SelectedItems.Select(item => item.PrintItemWrapper).ToList();
|
||||
if (sendButtonFunction != null)
|
||||
{
|
||||
List<PrintItemWrapper> itemList = this.queueDataView.SelectedItems.Select(item => item.PrintItemWrapper).ToList();
|
||||
UiThread.RunOnIdle(() => sendButtonFunction(null, itemList));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -99,6 +99,9 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
this.PrintItemWrapper.UseIncrementedNameDuringTypeChange = true;
|
||||
|
||||
ConstructPrintQueueItem();
|
||||
|
||||
MouseEnterBounds += (s, e) => EnteredBounds();
|
||||
MouseLeaveBounds += (s, e) => EnteredBounds();
|
||||
}
|
||||
|
||||
private event EventHandler unregisterEvents;
|
||||
|
|
@ -123,7 +126,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnMouseMove(MouseEventArgs mouseEvent)
|
||||
void EnteredBounds()
|
||||
{
|
||||
switch (UnderMouseState)
|
||||
{
|
||||
|
|
@ -146,8 +149,6 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
base.OnMouseMove(mouseEvent);
|
||||
}
|
||||
|
||||
public PrintItemWrapper PrintItemWrapper { get; set; }
|
||||
|
|
|
|||
|
|
@ -140,22 +140,32 @@ namespace MatterHackers.MatterControl.SettingsManagement
|
|||
[OnDeserialized]
|
||||
private void Deserialized(StreamingContext context)
|
||||
{
|
||||
// Load from StaticData to prepopulate oemProfiles for when user create a printer before load cacheable is done
|
||||
OemProfiles = JsonConvert.DeserializeObject<OemProfileDictionary>(StaticData.Instance.ReadAllText(Path.Combine("Profiles", "oemprofiles.json")));
|
||||
// Load local OemProfile content during initial startup
|
||||
OemProfiles = this.LoadOemProfiles();
|
||||
|
||||
var manufacturesList = OemProfiles.Keys.ToDictionary(oem => oem).ToList();
|
||||
var manufacturesList = OemProfiles.Keys.ToDictionary(oem => oem);
|
||||
SetManufacturers(manufacturesList);
|
||||
}
|
||||
|
||||
private OemProfileDictionary LoadOemProfiles()
|
||||
{
|
||||
string cachePath = ApplicationController.CacheablePath("public-profiles", "oemprofiles.json");
|
||||
|
||||
// Load data from cache or fall back to stale StaticData content
|
||||
string json = File.Exists(cachePath) ? File.ReadAllText(cachePath) : StaticData.Instance.ReadAllText(Path.Combine("Profiles", "oemprofiles.json"));
|
||||
|
||||
return JsonConvert.DeserializeObject<OemProfileDictionary>(json);
|
||||
}
|
||||
|
||||
public async Task ReloadOemProfiles(IProgress<SyncReportType> syncReport = null)
|
||||
{
|
||||
// In public builds this won't be assigned to and we should abort and exit early
|
||||
// In public builds this won't be assigned to and we should exit
|
||||
if (ApplicationController.GetPublicProfileList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var oemProfilesDict = await ApplicationController.LoadCacheableAsync<OemProfileDictionary>(
|
||||
await ApplicationController.LoadCacheableAsync<OemProfileDictionary>(
|
||||
"oemprofiles.json",
|
||||
"public-profiles",
|
||||
async () =>
|
||||
|
|
@ -163,20 +173,16 @@ namespace MatterHackers.MatterControl.SettingsManagement
|
|||
var result = await ApplicationController.GetPublicProfileList();
|
||||
if (result != null)
|
||||
{
|
||||
// Refresh the in memory instance any time the server responds with updated content - caller will serialize
|
||||
OemProfiles = result;
|
||||
|
||||
var manufactures = result.Keys.ToDictionary(oem => oem);
|
||||
SetManufacturers(manufactures);
|
||||
SetManufacturers(result.Keys.ToDictionary(oem => oem));
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
Path.Combine("Profiles", "oemprofiles.json"));
|
||||
});
|
||||
|
||||
if (oemProfilesDict != null)
|
||||
{
|
||||
await DownloadMissingProfiles(syncReport);
|
||||
}
|
||||
await DownloadMissingProfiles(syncReport);
|
||||
}
|
||||
|
||||
private async Task DownloadMissingProfiles(IProgress<SyncReportType> syncReport)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
contentRow.AddChild(new SetupPrinterView(this.textImageButtonFactory) { WizardPage = this });
|
||||
contentRow.AddChild(new SetupAccountView(this.textImageButtonFactory));
|
||||
contentRow.AddChild(new EnterCodesView(this.textImageButtonFactory));
|
||||
|
||||
footerRow.AddChild(new HorizontalSpacer());
|
||||
footerRow.AddChild(cancelButton);
|
||||
|
|
@ -58,49 +57,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public class EnterCodesView : SetupViewBase
|
||||
{
|
||||
public static EventHandler RedeemDesignCode;
|
||||
public static EventHandler EnterShareCode;
|
||||
|
||||
public EnterCodesView(TextImageButtonFactory textImageButtonFactory) : base("")
|
||||
{
|
||||
this.textImageButtonFactory = textImageButtonFactory;
|
||||
FlowLayoutWidget buttonContainer = new FlowLayoutWidget()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
Margin = new BorderDouble(0, 14)
|
||||
};
|
||||
mainContainer.AddChild(buttonContainer);
|
||||
|
||||
if (UserSettings.Instance.IsTouchScreen)
|
||||
{
|
||||
// the redeem design code button
|
||||
Button redeemPurchaseButton = textImageButtonFactory.Generate("Redeem Purchase".Localize());
|
||||
redeemPurchaseButton.Enabled = true; // The library selector (the first library selected) is protected so we can't add to it.
|
||||
redeemPurchaseButton.Name = "Redeem Code Button";
|
||||
redeemPurchaseButton.Margin = new BorderDouble(0, 0, 10, 0);
|
||||
redeemPurchaseButton.Click += (sender, e) =>
|
||||
{
|
||||
RedeemDesignCode?.Invoke(this, null);
|
||||
};
|
||||
buttonContainer.AddChild(redeemPurchaseButton);
|
||||
|
||||
// the redeem a share code button
|
||||
Button redeemShareButton = textImageButtonFactory.Generate("Enter Share Code".Localize());
|
||||
redeemShareButton.Enabled = true; // The library selector (the first library selected) is protected so we can't add to it.
|
||||
redeemShareButton.Name = "Enter Share Code";
|
||||
redeemShareButton.Margin = new BorderDouble(0, 0, 3, 0);
|
||||
redeemShareButton.Click += (sender, e) =>
|
||||
{
|
||||
EnterShareCode?.Invoke(this, null);
|
||||
};
|
||||
|
||||
buttonContainer.AddChild(redeemShareButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SetupPrinterView : SetupViewBase
|
||||
{
|
||||
internal WizardPage WizardPage { get; set; }
|
||||
|
|
@ -179,6 +135,18 @@ namespace MatterHackers.MatterControl
|
|||
private Button signInButton;
|
||||
private Button signOutButton;
|
||||
private TextWidget statusMessage;
|
||||
TextWidget connectionStatus;
|
||||
|
||||
public static string AuthenticationString { private get; set; } = "";
|
||||
|
||||
internal void RefreshStatus()
|
||||
{
|
||||
connectionStatus.Text = AuthenticationString;
|
||||
if (!HasBeenClosed)
|
||||
{
|
||||
UiThread.RunOnIdle(RefreshStatus, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public SetupAccountView(TextImageButtonFactory textImageButtonFactory)
|
||||
: base("My Account")
|
||||
|
|
@ -193,7 +161,24 @@ namespace MatterHackers.MatterControl
|
|||
username = "Not Signed In";
|
||||
}
|
||||
|
||||
mainContainer.AddChild(new TextWidget(username, pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor));
|
||||
FlowLayoutWidget nameAndStatus = new FlowLayoutWidget();
|
||||
nameAndStatus.AddChild(new TextWidget(username, pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor));
|
||||
|
||||
connectionStatus = new TextWidget(AuthenticationString, pointSize: 8, textColor: ActiveTheme.Instance.SecondaryTextColor)
|
||||
{
|
||||
Margin = new BorderDouble(5, 0, 0, 0),
|
||||
AutoExpandBoundsToText = true,
|
||||
};
|
||||
|
||||
if (signedIn)
|
||||
{
|
||||
nameAndStatus.AddChild(connectionStatus);
|
||||
}
|
||||
|
||||
|
||||
mainContainer.AddChild(nameAndStatus);
|
||||
|
||||
RefreshStatus();
|
||||
|
||||
FlowLayoutWidget buttonContainer = new FlowLayoutWidget();
|
||||
buttonContainer.HAnchor = HAnchor.ParentLeftRight;
|
||||
|
|
@ -203,7 +188,7 @@ namespace MatterHackers.MatterControl
|
|||
signInButton.Margin = new BorderDouble(left: 0);
|
||||
signInButton.VAnchor = VAnchor.ParentCenter;
|
||||
signInButton.Visible = !signedIn;
|
||||
signInButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
signInButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
signInButton.Visible = false;
|
||||
signOutButton.Visible = false;
|
||||
|
|
@ -225,13 +210,45 @@ namespace MatterHackers.MatterControl
|
|||
});
|
||||
buttonContainer.AddChild(signOutButton);
|
||||
|
||||
buttonContainer.AddChild(new HorizontalSpacer());
|
||||
|
||||
// the redeem design code button
|
||||
textImageButtonFactory.disabledTextColor = RGBA_Bytes.DarkGray;
|
||||
Button redeemPurchaseButton = textImageButtonFactory.Generate("Redeem Purchase".Localize());
|
||||
redeemPurchaseButton.Enabled = true; // The library selector (the first library selected) is protected so we can't add to it.
|
||||
redeemPurchaseButton.Name = "Redeem Code Button";
|
||||
redeemPurchaseButton.Margin = new BorderDouble(0, 0, 10, 0);
|
||||
redeemPurchaseButton.Click += (sender, e) =>
|
||||
{
|
||||
ApplicationController.Instance.RedeemDesignCode?.Invoke();
|
||||
};
|
||||
buttonContainer.AddChild(redeemPurchaseButton);
|
||||
|
||||
// the redeem a share code button
|
||||
Button redeemShareButton = textImageButtonFactory.Generate("Enter Share Code".Localize());
|
||||
redeemShareButton.Enabled = true; // The library selector (the first library selected) is protected so we can't add to it.
|
||||
redeemShareButton.Name = "Enter Share Code";
|
||||
redeemShareButton.Margin = new BorderDouble(0, 0, 10, 0);
|
||||
redeemShareButton.Click += (sender, e) =>
|
||||
{
|
||||
ApplicationController.Instance.EnterShareCode?.Invoke();
|
||||
};
|
||||
|
||||
if (!signedIn)
|
||||
{
|
||||
redeemPurchaseButton.Enabled = false;
|
||||
redeemShareButton.Enabled = false;
|
||||
}
|
||||
|
||||
buttonContainer.AddChild(redeemShareButton);
|
||||
|
||||
statusMessage = new TextWidget("Please wait...", pointSize: 12, textColor: ActiveTheme.Instance.SecondaryAccentColor);
|
||||
statusMessage.Visible = false;
|
||||
buttonContainer.AddChild(statusMessage);
|
||||
|
||||
mainContainer.AddChild(buttonContainer);
|
||||
|
||||
ApplicationController.Instance.DoneReloadingAll.RegisterEvent(RemoveAndNewControl, ref unregisterEvents);
|
||||
ApplicationController.Instance.ReloadAllRequested.RegisterEvent(RemoveAndNewControl, ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void RemoveAndNewControl(object sender, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
var byCheckbox = new Dictionary<CheckBox, PrinterInfo>();
|
||||
|
||||
var guestProfileManager = ProfileManager.LoadGuestDB();
|
||||
if (guestProfileManager?.Profiles.Count > 0)
|
||||
var guest = ProfileManager.LoadGuestProfiles();
|
||||
if (guest?.Profiles.Count > 0)
|
||||
{
|
||||
container.AddChild(new TextWidget("Printers to Copy:".Localize())
|
||||
{
|
||||
|
|
@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl
|
|||
Margin = new BorderDouble(0, 3, 0, 15),
|
||||
});
|
||||
|
||||
foreach (var printerInfo in guestProfileManager.Profiles)
|
||||
foreach (var printerInfo in guest.Profiles)
|
||||
{
|
||||
var checkBox = new CheckBox(printerInfo.Name)
|
||||
{
|
||||
|
|
@ -104,20 +104,23 @@ namespace MatterHackers.MatterControl
|
|||
// import the printer
|
||||
var printerInfo = byCheckbox[checkBox];
|
||||
|
||||
string existingPath = Path.Combine(ProfileManager.GuestDBDirectory, printerInfo.ID + ProfileManager.ProfileExtension); ;
|
||||
|
||||
ProfileManager.Instance.Profiles.Add(printerInfo);
|
||||
guestProfileManager.Profiles.Remove(printerInfo);
|
||||
string existingPath = guest.ProfilePath(printerInfo);
|
||||
|
||||
// PrinterSettings files must actually be copied to the users profile directory
|
||||
if (File.Exists(existingPath))
|
||||
{
|
||||
File.Copy(existingPath, printerInfo.ProfilePath);
|
||||
|
||||
// Only add if copy succeeds
|
||||
ProfileManager.Instance.Profiles.Add(printerInfo);
|
||||
|
||||
// TODO: Do we copy or migrate. This looks a lot like migrate which is not the current expected behavior
|
||||
// guestProfileManager.Profiles.Remove(printerInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
guestProfileManager.Save();
|
||||
guest.Save();
|
||||
|
||||
// close the window
|
||||
UiThread.RunOnIdle(() =>
|
||||
|
|
|
|||
|
|
@ -180,14 +180,17 @@ namespace MatterHackers.MatterControl
|
|||
mergeButton.Name = "Merge Profile";
|
||||
mergeButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
bool copyName = false;
|
||||
PrinterSettingsLayer sourceLayer = null;
|
||||
if (selectedMaterial > -1)
|
||||
{
|
||||
sourceLayer = settingsToImport.MaterialLayers[selectedMaterial];
|
||||
copyName = true;
|
||||
}
|
||||
else if (selectedQuality > -1)
|
||||
{
|
||||
sourceLayer = settingsToImport.QualityLayers[selectedQuality];
|
||||
copyName = true;
|
||||
}
|
||||
|
||||
List<PrinterSettingsLayer> sourceFilter;
|
||||
|
|
@ -208,7 +211,7 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
}
|
||||
|
||||
ActiveSliceSettings.Instance.Merge(destinationLayer, settingsToImport, sourceFilter);
|
||||
ActiveSliceSettings.Instance.Merge(destinationLayer, settingsToImport, sourceFilter, copyName);
|
||||
|
||||
this.Parents<SystemWindow>().FirstOrDefault()?.CloseOnIdle();
|
||||
});
|
||||
|
|
@ -229,7 +232,7 @@ namespace MatterHackers.MatterControl
|
|||
settingsToImport.UserLayer ?? new PrinterSettingsLayer()
|
||||
};
|
||||
|
||||
ActiveSliceSettings.Instance.Merge(destinationLayer, settingsToImport, sourceFilter);
|
||||
ActiveSliceSettings.Instance.Merge(destinationLayer, settingsToImport, sourceFilter, false);
|
||||
UiThread.RunOnIdle(ApplicationController.Instance.ReloadAdvancedControlsPanel);
|
||||
|
||||
string successMessage = importPrinterSuccessMessage.FormatWith(Path.GetFileNameWithoutExtension(settingsFilePath));
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ public class LicenseAgreementPage : WizardPage
|
|||
acceptButton.Visible = true;
|
||||
cancelButton.Visible = true;
|
||||
|
||||
cancelButton.Click += (s, e) => UiThread.RunOnIdle(WizardWindow.Close);
|
||||
// Exit if EULA is not accepted
|
||||
cancelButton.Click += (s, e) => UiThread.RunOnIdle(MatterControlApplication.Instance.Close);
|
||||
|
||||
//Add buttons to buttonContainer
|
||||
footerRow.AddChild(acceptButton);
|
||||
|
|
@ -75,30 +76,11 @@ public class LicenseAgreementPage : WizardPage
|
|||
|
||||
footerRow.Visible = true;
|
||||
|
||||
UiThread.RunOnIdle(MakeFrontWindow, 1);
|
||||
UiThread.RunOnIdle(MakeFrontWindow, .2);
|
||||
}
|
||||
|
||||
private void MakeFrontWindow()
|
||||
{
|
||||
this.WizardWindow.BringToFront();
|
||||
if (!HasBeenClosed)
|
||||
{
|
||||
//UiThread.RunOnIdle(MakeFrontWindow, .3);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
base.OnDraw(graphics2D);
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (UserSettings.Instance.get("SoftwareLicenseAccepted") != "true")
|
||||
{
|
||||
UiThread.RunOnIdle(MatterControlApplication.Instance.Close);
|
||||
}
|
||||
|
||||
base.OnClosed(e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace MatterHackers.MatterControl.SetupWizard
|
|||
ScrollableWidget scrollWindow;
|
||||
|
||||
public PrinterProfileHistoryPage()
|
||||
: base(unlocalizedTextForTitle: "Settings History")
|
||||
: base(unlocalizedTextForTitle: "Restore Settings")
|
||||
{
|
||||
scrollWindow = new ScrollableWidget()
|
||||
{
|
||||
|
|
@ -31,7 +31,7 @@ namespace MatterHackers.MatterControl.SetupWizard
|
|||
contentRow.FlowDirection = FlowDirection.TopToBottom;
|
||||
contentRow.AddChild(scrollWindow);
|
||||
|
||||
var revertButton = textImageButtonFactory.Generate("Revert");
|
||||
var revertButton = textImageButtonFactory.Generate("Restore");
|
||||
footerRow.AddChild(revertButton);
|
||||
footerRow.AddChild(new HorizontalSpacer());
|
||||
footerRow.AddChild(cancelButton);
|
||||
|
|
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.SetupWizard
|
|||
loadingText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
scrollWindow.AddChild(loadingText);
|
||||
|
||||
var results = await ApplicationController.GetProfileHistory(ProfileManager.Instance.ActiveProfile.DeviceToken);
|
||||
var results = await ApplicationController.GetProfileHistory?.Invoke(ProfileManager.Instance.ActiveProfile.DeviceToken);
|
||||
printerProfileData = results;
|
||||
if(printerProfileData != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace MatterHackers.MatterControl.SetupWizard
|
|||
contentRow.AddChild(syncingDetails);
|
||||
Progress<SyncReportType> progress = new Progress<SyncReportType>(ReportProgress);
|
||||
|
||||
ApplicationController.SyncPrinterProfiles(progress).ContinueWith((task) =>
|
||||
ApplicationController.SyncPrinterProfiles("SyncingPrintersPage.ctor()", progress).ContinueWith((task) =>
|
||||
{
|
||||
if (!ProfileManager.Instance.ActiveProfiles.Any())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace MatterHackers.MatterControl
|
|||
protected double labelFontSize = 12 * GuiWidget.DeviceScale;
|
||||
protected double errorFontSize = 10 * GuiWidget.DeviceScale;
|
||||
|
||||
internal WizardWindow WizardWindow;
|
||||
public WizardWindow WizardWindow;
|
||||
|
||||
protected GuiWidget mainContainer;
|
||||
|
||||
|
|
|
|||
|
|
@ -162,19 +162,18 @@ namespace MatterHackers.MatterControl
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
this.RemoveAllChildren();
|
||||
#if __ANDROID__
|
||||
this.AddChild(new SoftKeyboardContentOffset(pageToChangeTo));
|
||||
#else
|
||||
this.AddChild(pageToChangeTo);
|
||||
#endif
|
||||
this.Invalidate();
|
||||
});
|
||||
}
|
||||
|
||||
internal void ChangeToPage<PanelType>() where PanelType : WizardPage, new()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
this.RemoveAllChildren();
|
||||
this.AddChild(new PanelType() { WizardWindow = this });
|
||||
this.Invalidate();
|
||||
});
|
||||
ChangeToPage(new PanelType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -124,30 +124,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
if (ActiveSliceSettings.Instance.PrinterSelected)
|
||||
{
|
||||
//Attempt to load userSetting theme as default
|
||||
string activeThemeName = UserSettings.Instance.get(UserSettingsKey.ActiveThemeName);
|
||||
if(string.IsNullOrEmpty(activeThemeName))
|
||||
{
|
||||
activeThemeName = "Blue - Light";
|
||||
}
|
||||
if (ActiveSliceSettings.Instance.Contains(SettingsKey.active_theme_name))
|
||||
{
|
||||
activeThemeName = ActiveSliceSettings.Instance.GetValue(SettingsKey.active_theme_name);
|
||||
if (string.IsNullOrEmpty(activeThemeName))
|
||||
{
|
||||
activeThemeName = "Blue - Light";
|
||||
}
|
||||
string activeThemeName = ActiveSliceSettings.Instance.GetValue(SettingsKey.active_theme_name);
|
||||
if (!doReloadEvent)
|
||||
{
|
||||
ActiveTheme.SuspendEvents();
|
||||
}
|
||||
ActiveTheme.Instance = ActiveTheme.GetThemeColors(activeThemeName);
|
||||
ActiveTheme.ResumeEvents();
|
||||
}
|
||||
else
|
||||
{
|
||||
//If the active printer has no theme we set it to the default so that it does not suddenly change colors later when another printer's color is changed
|
||||
ActiveSliceSettings.Instance.SetValue(SettingsKey.active_theme_name, activeThemeName);
|
||||
}
|
||||
ActiveTheme.Instance = ActiveTheme.GetThemeColors(activeThemeName);
|
||||
ActiveTheme.ResumeEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -155,12 +141,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
static ActiveSliceSettings()
|
||||
{
|
||||
// Load last profile or fall back to empty
|
||||
Instance = ProfileManager.Instance?.LoadLastProfileWithoutRecovery() ?? ProfileManager.LoadEmptyProfile();
|
||||
Instance = ProfileManager.Instance?.LoadWithoutRecovery(ProfileManager.Instance.LastProfileID) ?? ProfileManager.LoadEmptyProfile();
|
||||
}
|
||||
|
||||
internal static async Task SwitchToProfile(string printerID)
|
||||
{
|
||||
ProfileManager.Instance.SetLastProfile(printerID);
|
||||
ProfileManager.Instance.LastProfileID = printerID;
|
||||
Instance = (await ProfileManager.LoadProfileAsync(printerID)) ?? ProfileManager.LoadEmptyProfile();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
[JsonIgnore]
|
||||
internal PrinterSettingsLayer MaterialLayer { get; private set; }
|
||||
|
||||
public PrinterSettingsLayer StagedUserSettings { get; set; } = new PrinterSettingsLayer();
|
||||
|
||||
public PrinterSettings()
|
||||
{
|
||||
this.Helpers = new SettingsHelpers(this);
|
||||
|
|
@ -94,14 +96,18 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public PrinterSettingsLayer OemLayer { get; set; }
|
||||
|
||||
public void Merge(PrinterSettingsLayer destinationLayer, PrinterSettings settingsToImport, List<PrinterSettingsLayer> rawSourceFilter)
|
||||
public void Merge(PrinterSettingsLayer destinationLayer, PrinterSettings settingsToImport, List<PrinterSettingsLayer> rawSourceFilter, bool setLayerName)
|
||||
{
|
||||
HashSet<string> skipKeys = new HashSet<string>
|
||||
{
|
||||
SettingsKey.layer_name,
|
||||
"layer_id",
|
||||
};
|
||||
|
||||
if(!setLayerName)
|
||||
{
|
||||
skipKeys.Add(SettingsKey.layer_name);
|
||||
}
|
||||
|
||||
var destinationFilter = new List<PrinterSettingsLayer>
|
||||
{
|
||||
OemLayer,
|
||||
|
|
@ -131,6 +137,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
if (setLayerName)
|
||||
{
|
||||
destinationLayer[SettingsKey.layer_name] = settingsToImport.GetValue(SettingsKey.layer_name, sourceFilter);
|
||||
}
|
||||
|
||||
settingsToImport.BaseLayer = baseLayer;
|
||||
|
||||
this.Save();
|
||||
|
|
@ -238,17 +249,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return;
|
||||
}
|
||||
|
||||
string json = this.ToJson();
|
||||
|
||||
var printerInfo = ProfileManager.Instance[this.ID];
|
||||
if (printerInfo != null)
|
||||
{
|
||||
printerInfo.ContentSHA1 = this.ComputeSha1(json);
|
||||
ProfileManager.Instance.Save();
|
||||
}
|
||||
|
||||
lock (writeLock)
|
||||
{
|
||||
string json = this.ToJson();
|
||||
|
||||
var printerInfo = ProfileManager.Instance[this.ID];
|
||||
if (printerInfo != null)
|
||||
{
|
||||
printerInfo.ContentSHA1 = this.ComputeSha1(json);
|
||||
ProfileManager.Instance.Save();
|
||||
}
|
||||
|
||||
File.WriteAllText(DocumentPath, json);
|
||||
}
|
||||
|
||||
|
|
@ -398,7 +409,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
private static async Task<PrinterSettings> GetFirstValidHistoryItem(PrinterInfo printerInfo)
|
||||
{
|
||||
var recentProfileHistoryItems = await ApplicationController.GetProfileHistory(printerInfo.DeviceToken);
|
||||
var recentProfileHistoryItems = await ApplicationController.GetProfileHistory?.Invoke(printerInfo.DeviceToken);
|
||||
if (recentProfileHistoryItems != null)
|
||||
{
|
||||
// Iterate history, skipping the first item, limiting to the next five, attempt to load and return the first success
|
||||
|
|
@ -967,6 +978,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return;
|
||||
}
|
||||
|
||||
// Remove any staged/conflicting user override, making this the new and active user override
|
||||
if (StagedUserSettings.ContainsKey(settingsKey))
|
||||
{
|
||||
StagedUserSettings.Remove(settingsKey);
|
||||
}
|
||||
|
||||
// Otherwise, set and save
|
||||
persistenceLayer[settingsKey] = settingsValue;
|
||||
Save();
|
||||
|
|
|
|||
|
|
@ -47,104 +47,96 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
public static RootedObjectEventHandler ProfilesListChanged = new RootedObjectEventHandler();
|
||||
|
||||
public static ProfileManager Instance { get; set; }
|
||||
public static ProfileManager Instance { get; private set; }
|
||||
|
||||
private static EventHandler unregisterEvents;
|
||||
|
||||
public const string ProfileExtension = ".printer";
|
||||
public const string ConfigFileExtension = ".slice";
|
||||
public const string ProfileDocExtension = ".profiles";
|
||||
|
||||
private static object writeLock = new object();
|
||||
private static EventHandler unregisterEvents;
|
||||
private static readonly string userDataPath = ApplicationDataStorage.ApplicationUserDataPath;
|
||||
|
||||
/// <summary>
|
||||
/// The user specific path to the Profiles directory
|
||||
/// </summary>
|
||||
private static string ProfilesPath
|
||||
{
|
||||
get
|
||||
{
|
||||
// Determine username
|
||||
string username = ApplicationController.Instance.GetSessionUsernameForFileSystem();
|
||||
if (string.IsNullOrEmpty(username))
|
||||
{
|
||||
username = "guest";
|
||||
}
|
||||
else
|
||||
{
|
||||
username = ApplicationController.EnvironmentName + username;
|
||||
}
|
||||
|
||||
string path = Path.Combine(userDataPath, "Profiles", username);
|
||||
|
||||
// Ensure directory exists
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
private const string userDBExtension = ".profiles";
|
||||
private const string guestDBFileName = "guest" + userDBExtension;
|
||||
|
||||
internal static string GuestDBDirectory => Path.Combine(userDataPath, "Profiles", "guest");
|
||||
private static string GuestDBPath => Path.Combine(GuestDBDirectory, guestDBFileName);
|
||||
|
||||
internal static string ProfilesDBPath
|
||||
{
|
||||
get
|
||||
{
|
||||
string username = ApplicationController.Instance.GetSessionUsernameForFileSystem();
|
||||
if (string.IsNullOrEmpty(username))
|
||||
{
|
||||
username = GuestDBPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
username = Path.Combine(ProfilesPath, $"{username}{userDBExtension}");
|
||||
}
|
||||
|
||||
return username;
|
||||
}
|
||||
}
|
||||
private object writeLock = new object();
|
||||
|
||||
static ProfileManager()
|
||||
{
|
||||
SliceSettingsWidget.SettingChanged.RegisterEvent(SettingsChanged, ref unregisterEvents);
|
||||
|
||||
// Ensure the profiles directory exists
|
||||
Directory.CreateDirectory(ProfilesPath);
|
||||
|
||||
Reload();
|
||||
}
|
||||
|
||||
public ProfileManager()
|
||||
public ProfileManager(string userName)
|
||||
{
|
||||
this.UserName = userName;
|
||||
}
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user specific path to the Profiles directory
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
private string UserProfilesDirectory => GetProfilesDirectoryForUser(this.UserName);
|
||||
|
||||
/// <summary>
|
||||
/// The user specific path to the Profiles document
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string ProfilesDocPath => GetProfilesDocPathForUser(this.UserName);
|
||||
|
||||
private static string GetProfilesDocPathForUser(string userName)
|
||||
{
|
||||
return Path.Combine(GetProfilesDirectoryForUser(userName), $"{userName}{ProfileDocExtension}");
|
||||
}
|
||||
|
||||
private static string GetProfilesDirectoryForUser(string userName)
|
||||
{
|
||||
string userAndEnvName = (userName == "guest") ? userName : ApplicationController.EnvironmentName + userName;
|
||||
string userProfilesDirectory = Path.Combine(ApplicationDataStorage.ApplicationUserDataPath, "Profiles", userAndEnvName);
|
||||
|
||||
// Ensure directory exists
|
||||
Directory.CreateDirectory(userProfilesDirectory);
|
||||
|
||||
return userProfilesDirectory;
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsGuestProfile => Path.GetFileName(ProfilesDBPath) == guestDBFileName;
|
||||
public bool IsGuestProfile => this.UserName == "guest";
|
||||
|
||||
public static void Reload()
|
||||
{
|
||||
string userName = AuthenticationData.Instance.FileSystemSafeUserName;
|
||||
if (string.IsNullOrEmpty(userName))
|
||||
{
|
||||
userName = "guest";
|
||||
}
|
||||
|
||||
if (Instance?.UserName == userName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Instance?.Profiles != null)
|
||||
{
|
||||
// Release event registration
|
||||
Instance.Profiles.CollectionChanged -= Profiles_CollectionChanged;
|
||||
}
|
||||
|
||||
// Load the profiles document
|
||||
if (File.Exists(ProfilesDBPath))
|
||||
string profilesDocPath = GetProfilesDocPathForUser(userName);
|
||||
|
||||
// Reassign the active instance based on the logged in user
|
||||
if (File.Exists(profilesDocPath))
|
||||
{
|
||||
string json = File.ReadAllText(ProfilesDBPath);
|
||||
string json = File.ReadAllText(profilesDocPath);
|
||||
Instance = JsonConvert.DeserializeObject<ProfileManager>(json);
|
||||
Instance.UserName = userName;
|
||||
}
|
||||
else
|
||||
{
|
||||
Instance = new ProfileManager();
|
||||
Instance = new ProfileManager(userName);
|
||||
}
|
||||
|
||||
if (ActiveSliceSettings.Instance?.ID != Instance.LastProfileID)
|
||||
{
|
||||
// async so we can safely wait for LoadProfileAsync to complete
|
||||
Task.Run(async () =>
|
||||
{
|
||||
// Load or download on a background thread
|
||||
|
|
@ -152,6 +144,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
if (MatterControlApplication.IsLoading)
|
||||
{
|
||||
// TODO: Not true - we're on a background thread in an async lambda... what is the intent of this?
|
||||
// Assign on the UI thread
|
||||
ActiveSliceSettings.Instance = lastProfile ?? LoadEmptyProfile();
|
||||
}
|
||||
|
|
@ -170,15 +163,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
Instance.Profiles.CollectionChanged += Profiles_CollectionChanged;
|
||||
}
|
||||
|
||||
internal static ProfileManager LoadGuestDB()
|
||||
internal static ProfileManager LoadGuestProfiles()
|
||||
{
|
||||
if (File.Exists(GuestDBPath))
|
||||
{
|
||||
string json = File.ReadAllText(GuestDBPath);
|
||||
return JsonConvert.DeserializeObject<ProfileManager>(json);
|
||||
}
|
||||
|
||||
return null;
|
||||
return new ProfileManager("guest");
|
||||
}
|
||||
|
||||
internal static void SettingsChanged(object sender, EventArgs e)
|
||||
|
|
@ -198,7 +185,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<PrinterInfo> Profiles { get; set; } = new ObservableCollection<PrinterInfo>();
|
||||
public ObservableCollection<PrinterInfo> Profiles { get; } = new ObservableCollection<PrinterInfo>();
|
||||
|
||||
[JsonIgnore]
|
||||
public IEnumerable<PrinterInfo> ActiveProfiles => Profiles.Where(profile => !profile.MarkedForDelete).ToList();
|
||||
|
|
@ -227,35 +214,27 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
get
|
||||
{
|
||||
string activeUserName = ApplicationController.Instance.GetSessionUsernameForFileSystem();
|
||||
return UserSettings.Instance.get($"ActiveProfileID-{activeUserName}");
|
||||
return UserSettings.Instance.get($"ActiveProfileID-{UserName}");
|
||||
}
|
||||
set
|
||||
{
|
||||
UserSettings.Instance.set($"ActiveProfileID-{UserName}", value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool PrintersImported { get; set; } = false;
|
||||
|
||||
public PrinterSettings LoadLastProfileWithoutRecovery()
|
||||
{
|
||||
return LoadWithoutRecovery(this.LastProfileID);
|
||||
}
|
||||
|
||||
public void SetLastProfile(string printerID)
|
||||
{
|
||||
string activeUserName = ApplicationController.Instance.GetSessionUsernameForFileSystem();
|
||||
UserSettings.Instance.set($"ActiveProfileID-{activeUserName}", printerID);
|
||||
}
|
||||
|
||||
public string ProfilePath(PrinterInfo printer)
|
||||
{
|
||||
return Path.Combine(ProfileManager.ProfilesPath, printer.ID + ProfileExtension);
|
||||
}
|
||||
|
||||
public string ProfilePath(string printerID)
|
||||
{
|
||||
return ProfilePath(this[printerID]);
|
||||
}
|
||||
|
||||
public static PrinterSettings LoadWithoutRecovery(string profileID)
|
||||
public string ProfilePath(PrinterInfo printer)
|
||||
{
|
||||
return Path.Combine(UserProfilesDirectory, printer.ID + ProfileExtension);
|
||||
}
|
||||
|
||||
public PrinterSettings LoadWithoutRecovery(string profileID)
|
||||
{
|
||||
var printerInfo = Instance[profileID];
|
||||
|
||||
|
|
@ -291,14 +270,14 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
|
||||
// Only load profiles by ID that are defined in the profiles document
|
||||
var printerInfo = ProfileManager.Instance[profileID];
|
||||
var printerInfo = Instance[profileID];
|
||||
if (printerInfo == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Attempt to load from disk, pull from the web or fall back using recovery logic
|
||||
PrinterSettings printerSettings = LoadWithoutRecovery(profileID);
|
||||
PrinterSettings printerSettings = Instance.LoadWithoutRecovery(profileID);
|
||||
if (printerSettings != null)
|
||||
{
|
||||
return printerSettings;
|
||||
|
|
@ -444,6 +423,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
printerSettings.UserLayer[SettingsKey.printer_name.ToString()] = printerName;
|
||||
|
||||
//If the active printer has no theme we set it to the current theme color
|
||||
printerSettings.UserLayer[SettingsKey.active_theme_name] = ActiveTheme.Instance.Name;
|
||||
|
||||
// Import named macros as defined in the following printers: (Airwolf Axiom, HD, HD-R, HD2x, HDL, HDx, Me3D Me2, Robo R1[+])
|
||||
var classicDefaultMacros = printerSettings.GetValue("default_macros");
|
||||
if (!string.IsNullOrEmpty(classicDefaultMacros))
|
||||
|
|
@ -550,7 +532,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
if (IsGuestProfile && !PrintersImported)
|
||||
{
|
||||
// Import Sqlite printer profiles into local json files
|
||||
DataStorage.ClassicDB.ClassicSqlitePrinterProfiles.ImportPrinters(Instance, ProfilesPath);
|
||||
DataStorage.ClassicDB.ClassicSqlitePrinterProfiles.ImportPrinters(Instance, UserProfilesDirectory);
|
||||
PrintersImported = true;
|
||||
Save();
|
||||
}
|
||||
|
|
@ -564,14 +546,14 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
ProfilesListChanged.CallEvents(null, null);
|
||||
|
||||
// Force sync after any collection change event
|
||||
ApplicationController.SyncPrinterProfiles(null);
|
||||
ApplicationController.SyncPrinterProfiles?.Invoke("ProfileManager.Profiles_CollectionChanged()", null);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
lock(writeLock)
|
||||
{
|
||||
File.WriteAllText(ProfilesDBPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
File.WriteAllText(ProfilesDocPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ using MatterHackers.MatterControl.PrinterCommunication;
|
|||
using MatterHackers.VectorMath;
|
||||
using Newtonsoft.Json;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||
{
|
||||
|
|
@ -61,6 +62,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
public const string device_token = nameof(device_token);
|
||||
public const string device_type = nameof(device_type);
|
||||
public const string expand_thin_walls = nameof(expand_thin_walls);
|
||||
public const string merge_overlapping_lines = nameof(merge_overlapping_lines);
|
||||
public const string extruder_count = nameof(extruder_count);
|
||||
public const string extruders_share_temperature = nameof(extruders_share_temperature);
|
||||
public const string filament_cost = nameof(filament_cost);
|
||||
|
|
@ -103,9 +105,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
public const string start_gcode = nameof(start_gcode);
|
||||
public const string temperature = nameof(temperature);
|
||||
public const string windows_driver = nameof(windows_driver);
|
||||
public const string z_can_be_negative = nameof(z_can_be_negative);
|
||||
public const string z_homes_to_max = nameof(z_homes_to_max);
|
||||
public const string printer_z_after_home = nameof(printer_z_after_home);
|
||||
public const string z_offset_after_home = nameof(z_offset_after_home);
|
||||
}
|
||||
|
||||
public class SettingsHelpers
|
||||
|
|
@ -196,7 +197,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
ProfileManager.ProfilesListChanged.CallEvents(this, null);
|
||||
|
||||
// Force sync after marking for delete
|
||||
ApplicationController.SyncPrinterProfiles(null);
|
||||
ApplicationController.SyncPrinterProfiles("SettingsHelpers.SetMarkedForDelete()", null);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -516,6 +517,20 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
public string ContentSHA1 { get; set; }
|
||||
public string ServerSHA1 { get; set; }
|
||||
|
||||
[OnDeserialized]
|
||||
public void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.Make))
|
||||
{
|
||||
this.Make = "Other";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(this.Model))
|
||||
{
|
||||
this.Model = "Other";
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string ProfilePath => ProfileManager.Instance.ProfilePath(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,16 +223,28 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
if (layerType == NamedSettingsLayers.Material)
|
||||
{
|
||||
// Restore deactivated user overrides by iterating the Material preset we're coming off of
|
||||
RestoreConflictingUserOverrides(activeSettings, activeSettings.MaterialLayer);
|
||||
|
||||
if (activeSettings.GetMaterialPresetKey(extruderIndex) != item.Value)
|
||||
{
|
||||
activeSettings.SetMaterialPreset(extruderIndex, item.Value);
|
||||
|
||||
// Deactivate conflicting user overrides by iterating the Material preset we've just switched to
|
||||
DeactivateConflictingUserOverrides(activeSettings, activeSettings.MaterialLayer);
|
||||
}
|
||||
}
|
||||
else if (layerType == NamedSettingsLayers.Quality)
|
||||
{
|
||||
// Restore deactivated user overrides by iterating the Quality preset we're coming off of
|
||||
RestoreConflictingUserOverrides(activeSettings, activeSettings.QualityLayer);
|
||||
|
||||
if (activeSettings.ActiveQualityKey != item.Value)
|
||||
{
|
||||
activeSettings.ActiveQualityKey = item.Value;
|
||||
|
||||
// Deactivate conflicting user overrides by iterating the Quality preset we've just switched to
|
||||
DeactivateConflictingUserOverrides(activeSettings, activeSettings.QualityLayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -244,6 +256,49 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
editButton.Enabled = item.Text != defaultMenuItemText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restore deactivated user overrides by iterating the active preset and removing/restoring matching items
|
||||
/// </summary>
|
||||
private static void RestoreConflictingUserOverrides(PrinterSettings printerSettings, PrinterSettingsLayer settingsLayer)
|
||||
{
|
||||
if (settingsLayer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var settingsKey in settingsLayer.Keys)
|
||||
{
|
||||
string stagedUserOverride;
|
||||
if (printerSettings.StagedUserSettings.TryGetValue(settingsKey, out stagedUserOverride))
|
||||
{
|
||||
printerSettings.StagedUserSettings.Remove(settingsKey);
|
||||
printerSettings.UserLayer[settingsKey] = stagedUserOverride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move conflicting user overrides to the temporary staging area, allowing presets values to take effect
|
||||
/// </summary>
|
||||
private static void DeactivateConflictingUserOverrides(PrinterSettings printerSettings, PrinterSettingsLayer settingsLayer)
|
||||
{
|
||||
if (settingsLayer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var settingsKey in settingsLayer.Keys)
|
||||
{
|
||||
string userOverride;
|
||||
if (printerSettings.UserLayer.TryGetValue(settingsKey, out userOverride))
|
||||
{
|
||||
printerSettings.UserLayer.Remove(settingsKey);
|
||||
printerSettings.StagedUserSettings.Add(settingsKey, userOverride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private DropDownList CreateDropdown()
|
||||
{
|
||||
var dropDownList = new DropDownList(defaultMenuItemText, maxHeight: 300, useLeftIcons: true)
|
||||
|
|
|
|||
|
|
@ -112,8 +112,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
sliceOptionsMenuDropList.AddItem("Import".Localize()).Selected += (s, e) => { ImportSettingsMenu_Click(); };
|
||||
sliceOptionsMenuDropList.AddItem("Export".Localize()).Selected += (s, e) => { WizardWindow.Show<ExportSettingsPage>("ExportSettingsPage", "Export Settings"); };
|
||||
|
||||
MenuItem settingsHistory = sliceOptionsMenuDropList.AddItem("Settings History".Localize());
|
||||
settingsHistory.Selected += (s, e) => { WizardWindow.Show<PrinterProfileHistoryPage>("PrinterProfileHistory", "Settings History"); };
|
||||
MenuItem settingsHistory = sliceOptionsMenuDropList.AddItem("Restore Settings".Localize());
|
||||
settingsHistory.Selected += (s, e) => { WizardWindow.Show<PrinterProfileHistoryPage>("PrinterProfileHistory", "Restore Settings"); };
|
||||
|
||||
settingsHistory.Enabled = !string.IsNullOrEmpty(AuthenticationData.Instance.ActiveSessionUsername);
|
||||
|
||||
|
|
|
|||
|
|
@ -69,8 +69,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
SettingsKey.recover_position_before_z_home,
|
||||
SettingsKey.resume_gcode,
|
||||
SettingsKey.temperature,
|
||||
SettingsKey.printer_z_after_home,
|
||||
SettingsKey.z_offset_after_home,
|
||||
"z_can_be_negative",
|
||||
"z_homes_to_max",
|
||||
|
||||
// TODO: merge the items below into the list above after some validation - setting that weren't previously mapped to Cura but probably should be.
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
new MappedToBoolString("wipe", "wipeAfterRetraction"),
|
||||
new MappedToBoolString(SettingsKey.center_part_on_bed, "centerObjectInXy"),
|
||||
new MappedToBoolString(SettingsKey.expand_thin_walls, "expandThinWalls"),
|
||||
new MappedToBoolString(SettingsKey.merge_overlapping_lines, "MergeOverlappingLines"),
|
||||
new MappedToBoolString(SettingsKey.fill_thin_gaps, "fillThinGaps"),
|
||||
new MappedToBoolString(SettingsKey.spiral_vase, "continuousSpiralOuterPerimeter"),
|
||||
new MapPositionToPlaceObjectCenter(SettingsKey.print_center, "positionToPlaceObjectCenter"),
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
hiddenSettings.Add("support_material_z_distance");
|
||||
hiddenSettings.Add(SettingsKey.center_part_on_bed);
|
||||
hiddenSettings.Add(SettingsKey.expand_thin_walls);
|
||||
hiddenSettings.Add(SettingsKey.merge_overlapping_lines);
|
||||
hiddenSettings.Add(SettingsKey.fill_thin_gaps);
|
||||
hiddenSettings.Add("infill_overlap_perimeter");
|
||||
hiddenSettings.Add("support_type");
|
||||
|
|
|
|||
|
|
@ -269,19 +269,48 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
int numberOfHeatedExtruders = ActiveSliceSettings.Instance.GetValue<int>(SettingsKey.extruder_count);
|
||||
|
||||
// don't set the extruders to heating if we already waited for them to reach temp
|
||||
// don't set extruder 0 to heating if we already waited for it to reach temp
|
||||
if (ActiveSliceSettings.Instance.GetValue(SettingsKey.heat_extruder_before_homing) != "1")
|
||||
{
|
||||
for (int extruderIndex0Based = 0; extruderIndex0Based < numberOfHeatedExtruders; extruderIndex0Based++)
|
||||
if (extrudersUsed[0])
|
||||
{
|
||||
if (extrudersUsed.Count > extruderIndex0Based
|
||||
double materialTemperature = ActiveSliceSettings.Instance.Helpers.ExtruderTemperature(0);
|
||||
if (materialTemperature != 0)
|
||||
{
|
||||
string setTempString = $"M109 T0 S{materialTemperature}";
|
||||
AddDefaultIfNotPresent(postStartGCode, setTempString, postStartGCodeLines, string.Format("wait for extruder {0} to reach temperature", 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (extrudersUsed.Count > 1)
|
||||
{
|
||||
// start all the extruders heating
|
||||
for (int extruderIndex0Based = 1; extruderIndex0Based < numberOfHeatedExtruders; extruderIndex0Based++)
|
||||
{
|
||||
if (extruderIndex0Based < extrudersUsed.Count
|
||||
&& extrudersUsed[extruderIndex0Based])
|
||||
{
|
||||
double materialTemperature = ActiveSliceSettings.Instance.Helpers.ExtruderTemperature(extruderIndex0Based);
|
||||
if (materialTemperature != 0)
|
||||
{
|
||||
string setTempString = "M109 T{0} S{1}".FormatWith(extruderIndex0Based, materialTemperature);
|
||||
AddDefaultIfNotPresent(postStartGCode, setTempString, postStartGCodeLines, string.Format("wait for extruder {0} to reach temperature", extruderIndex0Based + 1));
|
||||
// always heat the extruders that are used beyond extruder 0
|
||||
postStartGCode.Add($"M104 T{extruderIndex0Based} S{materialTemperature} ; Start heating extruder{extruderIndex0Based+1}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// wait for them to finish
|
||||
for (int extruderIndex0Based = 1; extruderIndex0Based < numberOfHeatedExtruders; extruderIndex0Based++)
|
||||
{
|
||||
if (extruderIndex0Based < extrudersUsed.Count
|
||||
&& extrudersUsed[extruderIndex0Based])
|
||||
{
|
||||
double materialTemperature = ActiveSliceSettings.Instance.Helpers.ExtruderTemperature(extruderIndex0Based);
|
||||
if (materialTemperature != 0)
|
||||
{
|
||||
// always heat the extruders that are used beyond extruder 0
|
||||
postStartGCode.Add($"M109 T{extruderIndex0Based} S{materialTemperature} ; Finish heating extruder{extruderIndex0Based + 1}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@
|
|||
"has_heated_bed": "0",
|
||||
"has_power_control": "0",
|
||||
"has_sd_card_reader": "1",
|
||||
"include_firmware_updater": "Simple Arduino",
|
||||
"heat_extruder_before_homing": "0",
|
||||
"infill_acceleration": "0",
|
||||
"infill_every_layers": "1",
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
Simple
|
||||
General
|
||||
Single
|
||||
Layers
|
||||
Layers & Infill
|
||||
layer_height
|
||||
fill_density
|
||||
Support Material
|
||||
support_material
|
||||
Raft & Support
|
||||
create_raft
|
||||
support_material
|
||||
Printer
|
||||
Connection
|
||||
Description
|
||||
|
|
@ -89,6 +89,7 @@ Advanced
|
|||
randomize_start
|
||||
external_perimeters_first
|
||||
perimeter_start_end_overlap
|
||||
merge_overlapping_lines
|
||||
expand_thin_walls
|
||||
Outer Surface - Top & Bottom
|
||||
top_solid_layers
|
||||
|
|
@ -305,6 +306,7 @@ Advanced
|
|||
has_power_control
|
||||
Behavior
|
||||
z_homes_to_max
|
||||
z_can_be_negative
|
||||
heat_extruder_before_homing
|
||||
extruders_share_temperature
|
||||
Firmware
|
||||
|
|
@ -320,9 +322,6 @@ Advanced
|
|||
print_leveling_required_to_print
|
||||
Probe Settings
|
||||
manual_probe_paper_width
|
||||
Leveling Calibration
|
||||
printer_z_after_home
|
||||
z_offset_after_home
|
||||
Options
|
||||
Print Recovery
|
||||
Recover Settings
|
||||
|
|
|
|||
|
|
@ -460,25 +460,25 @@
|
|||
"DefaultValue": "0",
|
||||
"ReloadUiWhenChanged": true
|
||||
},
|
||||
{
|
||||
"QuickMenuSettings": [ ],
|
||||
"SetSettingsOnChange": [ ],
|
||||
"SlicerConfigName": "heat_extruder_before_homing",
|
||||
"PresentationName": "Heat Before Homing",
|
||||
"HelpText": "Forces the printer to heat the nozzle before homing.",
|
||||
"DataEditType": "CHECK_BOX",
|
||||
"ExtraSettings": "",
|
||||
"ShowAsOverride": true,
|
||||
"ShowIfSet": null,
|
||||
"ResetAtEndOfPrint": false,
|
||||
"DefaultValue": "0"
|
||||
},
|
||||
{
|
||||
"QuickMenuSettings": [ ],
|
||||
"SetSettingsOnChange": [ ],
|
||||
"SlicerConfigName": "heat_extruder_before_homing",
|
||||
"PresentationName": "Heat Before Homing",
|
||||
"HelpText": "Forces the printer to heat the nozzle before homing.",
|
||||
"DataEditType": "CHECK_BOX",
|
||||
"ExtraSettings": "",
|
||||
"ShowAsOverride": true,
|
||||
"ShowIfSet": null,
|
||||
"ResetAtEndOfPrint": false,
|
||||
"DefaultValue": "0"
|
||||
},
|
||||
{
|
||||
"QuickMenuSettings": [ ],
|
||||
"SetSettingsOnChange": [ ],
|
||||
"SlicerConfigName": "expand_thin_walls",
|
||||
"PresentationName": "Expand Thin Walls",
|
||||
"HelpText": "Detect sections of the model that would be too thin to print, expand them, and print them.",
|
||||
"SlicerConfigName": "merge_overlapping_lines",
|
||||
"PresentationName": "Merge Overlapping Lines",
|
||||
"HelpText": "Detect perimeters that cross over themselves and combine them.",
|
||||
"DataEditType": "CHECK_BOX",
|
||||
"ExtraSettings": "",
|
||||
"ShowAsOverride": true,
|
||||
|
|
@ -487,6 +487,20 @@
|
|||
"DefaultValue": "1",
|
||||
"RebuildGCodeOnChange": true
|
||||
},
|
||||
{
|
||||
"QuickMenuSettings": [ ],
|
||||
"SetSettingsOnChange": [ ],
|
||||
"SlicerConfigName": "expand_thin_walls",
|
||||
"PresentationName": "Expand Thin Walls",
|
||||
"HelpText": "Detect sections of the model that would be too thin to print, expand them, and print them.",
|
||||
"DataEditType": "CHECK_BOX",
|
||||
"ExtraSettings": "",
|
||||
"ShowAsOverride": true,
|
||||
"ShowIfSet": null,
|
||||
"ResetAtEndOfPrint": false,
|
||||
"DefaultValue": "1",
|
||||
"RebuildGCodeOnChange": true
|
||||
},
|
||||
{
|
||||
"QuickMenuSettings": [ ],
|
||||
"SetSettingsOnChange": [ ],
|
||||
|
|
@ -950,6 +964,7 @@
|
|||
"ShowIfSet": null,
|
||||
"ResetAtEndOfPrint": false,
|
||||
"DefaultValue": "0",
|
||||
"ReloadUiWhenChanged": true,
|
||||
"RebuildGCodeOnChange": false
|
||||
},
|
||||
{
|
||||
|
|
@ -2528,27 +2543,13 @@
|
|||
{
|
||||
"QuickMenuSettings": [ ],
|
||||
"SetSettingsOnChange": [ ],
|
||||
"SlicerConfigName": "printer_z_after_home",
|
||||
"PresentationName": "Z Home Position",
|
||||
"HelpText": "This is automatically set by MatterControl. You do not need to adjust it.",
|
||||
"DataEditType": "POSITIVE_DOUBLE",
|
||||
"ExtraSettings": "mm",
|
||||
"ShowAsOverride": false,
|
||||
"ShowIfSet": null,
|
||||
"ResetAtEndOfPrint": false,
|
||||
"DefaultValue": "0",
|
||||
"RebuildGCodeOnChange": false
|
||||
},
|
||||
{
|
||||
"QuickMenuSettings": [ ],
|
||||
"SetSettingsOnChange": [ ],
|
||||
"SlicerConfigName": "z_offset_after_home",
|
||||
"PresentationName": "Offset After Homing",
|
||||
"HelpText": "The amount to change the printers home position after a z home has occured. This is used by print leveling and recovery. This should not be manualy edited.",
|
||||
"DataEditType": "POSITIVE_DOUBLE",
|
||||
"ExtraSettings": "mm",
|
||||
"ShowAsOverride": false,
|
||||
"ShowIfSet": null,
|
||||
"SlicerConfigName": "z_can_be_negative",
|
||||
"PresentationName": "Z Can Be Negative",
|
||||
"HelpText": "Allows the printer to attempt going below 0 along the Z axis during the Software Print Leveling wizard, and disables related warnings. Does not override actual endstops, physical or software.",
|
||||
"DataEditType": "CHECK_BOX",
|
||||
"ExtraSettings": "",
|
||||
"ShowAsOverride": true,
|
||||
"ShowIfSet": "!has_hardware_leveling",
|
||||
"ResetAtEndOfPrint": false,
|
||||
"DefaultValue": "0",
|
||||
"RebuildGCodeOnChange": false
|
||||
|
|
|
|||
|
|
@ -5524,3 +5524,39 @@ Translated:It's time to copy your existing printer settings to your MatterHacker
|
|||
English:Location: 'Settings & Controls' -> 'Settings' -> 'Printer' -> 'Custom G-Code' -> 'Start G-Code'
|
||||
Translated:Location: 'Settings & Controls' -> 'Settings' -> 'Printer' -> 'Custom G-Code' -> 'Start G-Code'
|
||||
|
||||
English:none
|
||||
Translated:none
|
||||
|
||||
English:Exit while printing
|
||||
Translated:Exit while printing
|
||||
|
||||
English:Are you sure you want exit while a print is running from SD Card?\n\nNote: If you exit, it is recommended you wait until the print is completed before running MatterControl again.
|
||||
Translated:Are you sure you want exit while a print is running from SD Card?\n\nNote: If you exit, it is recommended you wait until the print is completed before running MatterControl again.
|
||||
|
||||
English:Connect printer and power on
|
||||
Translated:Connect printer and power on
|
||||
|
||||
English:Detect perimeters that cross over themselves and combine them.
|
||||
Translated:Detect perimeters that cross over themselves and combine them.
|
||||
|
||||
English:Merge Overlapping Lines
|
||||
Translated:Merge Overlapping Lines
|
||||
|
||||
English:Restore Settings
|
||||
Translated:Restore Settings
|
||||
|
||||
English:Streaming GCode...
|
||||
Translated:Streaming GCode...
|
||||
|
||||
English:Layers & Infill
|
||||
Translated:Layers & Infill
|
||||
|
||||
English:Raft & Support
|
||||
Translated:Raft & Support
|
||||
|
||||
English:Redeem Code
|
||||
Translated:Redeem Code
|
||||
|
||||
English:Library - Enter Share Code
|
||||
Translated:Library - Enter Share Code
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit df38a59e274103067d99da3542cb2a95c85ea1c2
|
||||
Subproject commit 2dd73fbb995f4f68a8988bc6f9a3452db9132634
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 29170aca289962d3d892d2414b315853a94601f3
|
||||
Subproject commit 33cde2807c65fe1a1ec020b5527c891cfa815cc4
|
||||
|
|
@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
|
|
@ -39,53 +40,43 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class CheckBoxInLibraryIsClickable
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void ClickOnLibraryCheckBoxes()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task ClickOnLibraryCheckBoxes()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Now do the actions specific to this test. (replace this for new tests)
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.ClickByName("Library Tab", 3);
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
testRunner.ClickByName("Library Tab", 3);
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
SystemWindow systemWindow;
|
||||
string itemName = "Row Item Calibration - Box";
|
||||
|
||||
SystemWindow systemWindow;
|
||||
string itemName = "Row Item " + "Calibration - Box";
|
||||
GuiWidget rowItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3);
|
||||
|
||||
GuiWidget rowItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3);
|
||||
SearchRegion rowItemRegion = testRunner.GetRegionByName(itemName, 3);
|
||||
|
||||
SearchRegion rowItemRegion = testRunner.GetRegionByName(itemName, 3);
|
||||
testRunner.ClickByName("Library Edit Button", 3);
|
||||
testRunner.Wait(.5);
|
||||
|
||||
testRunner.ClickByName("Library Edit Button", 3);
|
||||
testRunner.Wait(.5);
|
||||
GuiWidget foundWidget = testRunner.GetWidgetByName("Row Item Select Checkbox", out systemWindow, 3, searchRegion: rowItemRegion);
|
||||
CheckBox checkBoxWidget = foundWidget as CheckBox;
|
||||
Assert.IsTrue(checkBoxWidget != null, "We should have an actual checkbox");
|
||||
Assert.IsTrue(checkBoxWidget.Checked == false, "currently not checked");
|
||||
|
||||
GuiWidget foundWidget = testRunner.GetWidgetByName("Row Item Select Checkbox", out systemWindow, 3, searchRegion: rowItemRegion);
|
||||
CheckBox checkBoxWidget = foundWidget as CheckBox;
|
||||
resultsHarness.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox");
|
||||
resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");
|
||||
testRunner.ClickByName("Row Item Select Checkbox", 3, searchRegion: rowItemRegion);
|
||||
testRunner.ClickByName("Library Tab");
|
||||
Assert.IsTrue(checkBoxWidget.Checked == true, "currently checked");
|
||||
|
||||
testRunner.ClickByName("Row Item Select Checkbox", 3, searchRegion: rowItemRegion);
|
||||
testRunner.ClickByName("Library Tab");
|
||||
resultsHarness.AddTestResult(checkBoxWidget.Checked == true, "currently checked");
|
||||
testRunner.ClickByName(itemName, 3);
|
||||
testRunner.ClickByName("Library Tab");
|
||||
Assert.IsTrue(checkBoxWidget.Checked == false, "currently not checked");
|
||||
|
||||
testRunner.ClickByName(itemName, 3);
|
||||
testRunner.ClickByName("Library Tab");
|
||||
resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
// NOTE: In the future we may want to make the "Local Library Row Item Collection" not clickable.
|
||||
// If that is the case fix this test to click on a child of "Local Library Row Item Collection" instead.
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(4));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
|
|
@ -39,41 +40,33 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class CreateLibraryFolder
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void CreateFolderStarsOutWithTextFiledFocusedAndEditable()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task CreateFolderStarsOutWithTextFiledFocusedAndEditable()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Now do the actions specific to this test. (replace this for new tests)
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
testRunner.ClickByName("Create Folder From Library Button");
|
||||
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
testRunner.ClickByName("Create Folder From Library Button");
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Type("Test Text");
|
||||
testRunner.Wait(.5);
|
||||
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Type("Test Text");
|
||||
testRunner.Wait(.5);
|
||||
SystemWindow containingWindow;
|
||||
GuiWidget textInputWidget = testRunner.GetWidgetByName("Create Folder - Text Input", out containingWindow);
|
||||
MHTextEditWidget textWidgetMH = textInputWidget as MHTextEditWidget;
|
||||
Assert.IsTrue(textWidgetMH != null, "Found Text Widget");
|
||||
Assert.IsTrue(textWidgetMH.Text == "Test Text", "Had the right text");
|
||||
containingWindow.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
|
||||
SystemWindow containingWindow;
|
||||
GuiWidget textInputWidget = testRunner.GetWidgetByName("Create Folder - Text Input", out containingWindow);
|
||||
MHTextEditWidget textWidgetMH = textInputWidget as MHTextEditWidget;
|
||||
resultsHarness.AddTestResult(textWidgetMH != null, "Found Text Widget");
|
||||
resultsHarness.AddTestResult(textWidgetMH.Text == "Test Text", "Had the right text");
|
||||
containingWindow.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,70 +2,64 @@
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MatterHackers.MatterControl.Tests.Automation
|
||||
{
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain, Category("FixNeeded" /* Not Finished */)]
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class ExportItemsFromDownloads
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void ExportAsGcode()
|
||||
[Test, Apartment(ApartmentState.STA), Category("FixNeeded" /* Not Finished */)]
|
||||
public async Task ExportAsGcode()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
string firstItemName = "Row Item Batman";
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Queue Tab");
|
||||
testRunner.ClickByName("Queue Add Button", 2);
|
||||
string firstItemName = "Row Item Batman";
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Queue Tab");
|
||||
testRunner.ClickByName("Queue Add Button", 2);
|
||||
|
||||
//Get parts to add
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
|
||||
//Get parts to add
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
|
||||
|
||||
//Add STL part items to Downloads and then type paths into file dialogue
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
//Add STL part items to Downloads and then type paths into file dialog
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
//Get test results
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName(firstItemName, 2) == true);
|
||||
//Get test results
|
||||
Assert.IsTrue(testRunner.WaitForName(firstItemName, 2) == true);
|
||||
|
||||
testRunner.ClickByName("Queue Edit Button");
|
||||
testRunner.ClickByName(firstItemName);
|
||||
testRunner.ClickByName("Queue Export Button");
|
||||
testRunner.Wait(2);
|
||||
testRunner.ClickByName("Queue Edit Button");
|
||||
testRunner.ClickByName(firstItemName);
|
||||
testRunner.ClickByName("Queue Export Button");
|
||||
testRunner.Wait(2);
|
||||
|
||||
testRunner.WaitForName("Export Item Window", 2);
|
||||
testRunner.ClickByName("Export as GCode Button", 2);
|
||||
testRunner.Wait(2);
|
||||
testRunner.WaitForName("Export Item Window", 2);
|
||||
testRunner.ClickByName("Export as GCode Button", 2);
|
||||
testRunner.Wait(2);
|
||||
|
||||
string gcodeExportPath = MatterControlUtilities.PathToExportGcodeFolder;
|
||||
testRunner.Type(gcodeExportPath);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(2);
|
||||
string gcodeExportPath = MatterControlUtilities.PathToExportGcodeFolder;
|
||||
testRunner.Type(gcodeExportPath);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(2);
|
||||
|
||||
Console.WriteLine(gcodeExportPath);
|
||||
Console.WriteLine(gcodeExportPath);
|
||||
|
||||
resultsHarness.AddTestResult(File.Exists(gcodeExportPath) == true);
|
||||
Debugger.Break();
|
||||
Assert.IsTrue(File.Exists(gcodeExportPath) == true);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
|
|
@ -10,147 +11,123 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class FileMenuTest
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void FileMenuAddPrinter()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task FileMenuAddPrinter()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
testRunner.ClickByName("File Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Add Printer Menu Item");
|
||||
testRunner.Wait(1);
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Select Make", 3));
|
||||
testRunner.ClickByName("File Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Add Printer Menu Item");
|
||||
testRunner.Wait(1);
|
||||
Assert.IsTrue(testRunner.WaitForName("Select Make", 3));
|
||||
|
||||
testRunner.ClickByName("Cancel Wizard Button");
|
||||
testRunner.ClickByName("Cancel Wizard Button");
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
||||
await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void AddToQueueMenuItemAddsSingleFile()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task AddToQueueMenuItemAddsSingleFile()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
testRunner.ClickByName("File Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Add File To Queue Menu Item");
|
||||
testRunner.Wait(2);
|
||||
testRunner.ClickByName("File Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Add File To Queue Menu Item");
|
||||
testRunner.Wait(2);
|
||||
|
||||
string queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
string queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
|
||||
int queueBeforeCount = QueueData.Instance.Count;
|
||||
int queueBeforeCount = QueueData.Instance.Count;
|
||||
|
||||
testRunner.Type(queueItemPath);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(2);
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
|
||||
testRunner.Type(queueItemPath);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(2);
|
||||
Assert.IsTrue(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
|
||||
|
||||
int queueAfterCount = QueueData.Instance.Count;
|
||||
int queueAfterCount = QueueData.Instance.Count;
|
||||
|
||||
resultsHarness.AddTestResult(queueAfterCount == queueBeforeCount + 1);
|
||||
Assert.IsTrue(queueAfterCount == queueBeforeCount + 1);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void AddToQueueMenuItemAddsMultipleFiles()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task AddToQueueMenuItemAddsMultipleFiles()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
testRunner.ClickByName("File Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Add File To Queue Menu Item");
|
||||
testRunner.Wait(2);
|
||||
testRunner.ClickByName("File Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Add File To Queue Menu Item");
|
||||
testRunner.Wait(2);
|
||||
|
||||
string queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
string queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
|
||||
string pathToSecondQueueItem = MatterControlUtilities.GetTestItemPath("Batman.stl");
|
||||
string textForBothQueueItems = String.Format("\"{0}\" \"{1}\"", queueItemPath, pathToSecondQueueItem);
|
||||
string pathToSecondQueueItem = MatterControlUtilities.GetTestItemPath("Batman.stl");
|
||||
string textForBothQueueItems = string.Format("\"{0}\" \"{1}\"", queueItemPath, pathToSecondQueueItem);
|
||||
|
||||
int queueBeforeAddCount = QueueData.Instance.Count;
|
||||
int queueBeforeAddCount = QueueData.Instance.Count;
|
||||
|
||||
testRunner.Type(textForBothQueueItems);
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(2);
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Batman", 2));
|
||||
|
||||
int queueAfterAddCount = QueueData.Instance.Count;
|
||||
testRunner.Type(textForBothQueueItems);
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(2);
|
||||
Assert.IsTrue(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
|
||||
Assert.IsTrue(testRunner.WaitForName("Queue Item Batman", 2));
|
||||
|
||||
resultsHarness.AddTestResult(queueAfterAddCount == queueBeforeAddCount + 2);
|
||||
int queueAfterAddCount = QueueData.Instance.Count;
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
Assert.IsTrue(queueAfterAddCount == queueBeforeAddCount + 2);
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(3));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void AddToQueueMenuItemAddsZipFiles()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task AddToQueueMenuItemAddsZipFiles()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
testRunner.ClickByName("File Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Add File To Queue Menu Item");
|
||||
testRunner.Wait(2);
|
||||
testRunner.ClickByName("File Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Add File To Queue Menu Item");
|
||||
testRunner.Wait(2);
|
||||
|
||||
int beforeCount = QueueData.Instance.Count;
|
||||
int beforeCount = QueueData.Instance.Count;
|
||||
|
||||
string pathToType = MatterControlUtilities.GetTestItemPath("Batman.zip");
|
||||
testRunner.Type(pathToType);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(1);
|
||||
string pathToType = MatterControlUtilities.GetTestItemPath("Batman.zip");
|
||||
testRunner.Type(pathToType);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(1);
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Batman", 1));
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1));
|
||||
resultsHarness.AddTestResult(QueueData.Instance.Count == beforeCount + 2);
|
||||
Assert.IsTrue(testRunner.WaitForName("Queue Item Batman", 1));
|
||||
Assert.IsTrue(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1));
|
||||
Assert.IsTrue(QueueData.Instance.Count == beforeCount + 2);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(3));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using NUnit.Framework;
|
||||
|
|
@ -9,61 +11,55 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class HardwareLevelingUITests
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void HasHardwareLevelingHidesLevelingSettings()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task HasHardwareLevelingHidesLevelingSettings()
|
||||
{
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
//Add printer that has hardware leveling
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);
|
||||
//Add printer that has hardware leveling
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
testRunner.ClickByName("Printer Tab", 1);
|
||||
testRunner.Wait(1);
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
||||
|
||||
//Make sure Print Leveling tab is not visible
|
||||
bool testPrintLeveling = testRunner.WaitForName("Print Leveling Tab", 3);
|
||||
resultsHarness.AddTestResult(testPrintLeveling == false);
|
||||
testRunner.ClickByName("Printer Tab", 1);
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Add printer that does not have hardware leveling
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "3D Factory", "MendelMax 1.5");
|
||||
//Make sure Print Leveling tab is not visible
|
||||
bool testPrintLeveling = testRunner.WaitForName("Print Leveling Tab", 3);
|
||||
Assert.IsTrue(testPrintLeveling == false);
|
||||
|
||||
testRunner.ClickByName("Slice Settings Tab",1);
|
||||
//Add printer that does not have hardware leveling
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "3D Factory", "MendelMax 1.5");
|
||||
|
||||
testRunner.ClickByName("Printer Tab",1);
|
||||
testRunner.ClickByName("Slice Settings Tab", 1);
|
||||
|
||||
//Make sure Print Leveling tab is visible
|
||||
bool printLevelingVisible = testRunner.WaitForName("Print Leveling Tab", 2);
|
||||
resultsHarness.AddTestResult(printLevelingVisible == true);
|
||||
testRunner.ClickByName("Printer Tab", 1);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
//Make sure Print Leveling tab is visible
|
||||
bool printLevelingVisible = testRunner.WaitForName("Print Leveling Tab", 2);
|
||||
Assert.IsTrue(printLevelingVisible == true);
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideHeight: 800);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(4));
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideHeight: 800);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void SoftwareLevelingRequiredCorrectWorkflow()
|
||||
[Test, Apartment(ApartmentState.STA), Category("FixNeeded" /* See https://github.com/MatterHackers/MatterControl/issues/1565 for details */)]
|
||||
public async Task SoftwareLevelingRequiredCorrectWorkflow()
|
||||
{
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// make a jump start printer
|
||||
using (var emulatorProcess = testRunner.LaunchAndConnectToPrinterEmulator("JumpStart", "V1", runSlow: false))
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
|
||||
// make a jump start printer
|
||||
var emualtorProccess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner, false, "JumStart", "V1");
|
||||
|
||||
// make sure it is showing the correct button
|
||||
resultsHarness.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
|
||||
Assert.IsTrue(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
|
||||
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
|
||||
|
||||
// do print leveling
|
||||
testRunner.ClickByName("Next Button", .5);
|
||||
|
|
@ -77,37 +73,29 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
testRunner.ClickByName("Next Button", .5);
|
||||
}
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Done Button", .5), "Found Done button");
|
||||
Assert.IsTrue(testRunner.ClickByName("Done Button", 1), "Found Done button");
|
||||
|
||||
// make sure the button has changed to start print
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Start Print Button", .5), "Start Print showing");
|
||||
resultsHarness.AddTestResult(!testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup hidden");
|
||||
Assert.IsTrue(testRunner.WaitForName("Start Print Button", 5), "Start Print showing");
|
||||
Assert.IsTrue(!testRunner.WaitForName("Finish Setup Button", 1), "Finish Setup hidden");
|
||||
|
||||
// reset to defaults and make sure print leveling is cleared
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Slice Settings Options Menu", 1), "Click Options" );
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Reset to defaults Menu Item", 1), "Select Reset to defaults");
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Yes Button", .5), "Click yes to revert");
|
||||
Assert.IsTrue(testRunner.ClickByName("Slice Settings Options Menu", 1), "Click Options");
|
||||
Assert.IsTrue(testRunner.ClickByName("Reset to defaults Menu Item", 1), "Select Reset to defaults");
|
||||
Assert.IsTrue(testRunner.ClickByName("Yes Button", .5), "Click yes to revert");
|
||||
testRunner.Wait(1);
|
||||
|
||||
// make sure it is showing the correct button
|
||||
resultsHarness.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
|
||||
Assert.IsTrue(!testRunner.WaitForName("Start Print Button", 1), "Start Print hidden");
|
||||
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button", 1), "Finish Setup showing");
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
|
||||
try
|
||||
{
|
||||
emualtorProccess.Kill();
|
||||
}
|
||||
catch { }
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(12));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,56 +1,53 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MatterHackers.MatterControl.Tests.Automation
|
||||
{
|
||||
[TestFixture, Category("MatterControl.UI.Automation")]
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class LibraryDownloadsTests
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void DownloadsAddButtonAddsMultipleFiles()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task DownloadsAddButtonAddsMultipleFiles()
|
||||
{
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Wait(3);
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
testRunner.NavigateToFolder("-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Wait(3);
|
||||
|
||||
testRunner.Wait(2);
|
||||
testRunner.Wait(2);
|
||||
|
||||
// Add both files to the FileOpen dialog
|
||||
testRunner.Type(
|
||||
string.Format(
|
||||
"\"{0}\" \"{1}\"",
|
||||
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
|
||||
MatterControlUtilities.GetTestItemPath("Batman.stl")));
|
||||
// Add both files to the FileOpen dialog
|
||||
testRunner.Type(
|
||||
string.Format(
|
||||
"\"{0}\" \"{1}\"",
|
||||
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
|
||||
MatterControlUtilities.GetTestItemPath("Batman.stl")));
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Fennec Fox", 2), "Fennec Fox item exists");
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman", 2), "Batman item exists");
|
||||
testRunner.Wait(1);
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec Fox", 2), "Fennec Fox item exists");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman", 2), "Batman item exists");
|
||||
testRunner.Wait(1);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = null;
|
||||
|
||||
// TODO: The standard assignment without a try/catch should be used and DeleteDownloadsSubFolder should be called from a TearDown method
|
||||
try
|
||||
{
|
||||
testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
}
|
||||
catch { }
|
||||
|
|
@ -58,46 +55,38 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void DownloadsAddButtonAddsAMFFiles()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task DownloadsAddButtonAddsAMFFiles()
|
||||
{
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
testRunner.NavigateToFolder("-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Wait(2);
|
||||
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Wait(2);
|
||||
//Add AMF part items to Downloads and then type paths into file dialog
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
//Add AMF part items to Downloads and then type paths into file dialogues
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Rook", 2), "Rook item exists");
|
||||
testRunner.Wait(1);
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Rook", 2), "Rook item exists");
|
||||
testRunner.Wait(1);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = null;
|
||||
|
||||
try
|
||||
{
|
||||
testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
}
|
||||
catch { }
|
||||
|
|
@ -105,47 +94,41 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void DownloadsAddButtonAddsZipFiles()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task DownloadsAddButtonAddsZipFiles()
|
||||
{
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
// Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Wait(2);
|
||||
// Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
testRunner.NavigateToFolder("-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Wait(2);
|
||||
|
||||
// Add AMF part items to Downloads and then type paths into file dialogs
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Test.zip"));
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
// Add AMF part items to Downloads and then type paths into file dialogs
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Test.zip"));
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Chinese Dragon", 2), "Chinese Dragon item exists");
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item chichen-itza pyramid", 2), "chichen-itza item exists");
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Circle Calibration", 2), "Circle Calibration item exists");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Chinese Dragon", 2), "Chinese Dragon item exists");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item chichen-itza pyramid", 2), "chichen-itza item exists");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Circle Calibration", 2), "Circle Calibration item exists");
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
AutomationTesterHarness testHarness = null;
|
||||
|
||||
try
|
||||
{
|
||||
testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
catch { }
|
||||
|
||||
|
|
@ -157,48 +140,42 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
catch { }
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(3));
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void RenameDownloadsPrintItem()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task RenameDownloadsPrintItem()
|
||||
{
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Wait(2);
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
testRunner.NavigateToFolder("-Temporary Row Item Collection");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Wait(2);
|
||||
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
//Rename added item
|
||||
testRunner.ClickByName("Library Edit Button", .5);
|
||||
testRunner.ClickByName("Row Item Batman");
|
||||
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Type("Batman Renamed");
|
||||
testRunner.ClickByName("Rename Button");
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman Renamed", 2) == true);
|
||||
//Rename added item
|
||||
testRunner.ClickByName("Library Edit Button", .5);
|
||||
testRunner.ClickByName("Row Item Batman");
|
||||
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Type("Batman Renamed");
|
||||
testRunner.ClickByName("Rename Button");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman Renamed", 2));
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
AutomationTesterHarness testHarness = null;
|
||||
|
||||
try
|
||||
{
|
||||
testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
}
|
||||
catch { }
|
||||
|
|
@ -206,45 +183,37 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void CreateFolder()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task CreateFolder()
|
||||
{
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
|
||||
MatterControlUtilities.CreateDownloadsSubFolder();
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Downloads Row Item Collection");
|
||||
testRunner.NavigateToFolder("-Temporary Row Item Collection");
|
||||
|
||||
//Navigate to Downloads Library Provider
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "-Temporary Row Item Collection");
|
||||
string newFolderName = "New Folder";
|
||||
|
||||
string newFolderName = "New Folder";
|
||||
testRunner.ClickByName("Create Folder From Library Button");
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(newFolderName);
|
||||
testRunner.ClickByName("Create Folder Button");
|
||||
|
||||
testRunner.ClickByName("Create Folder From Library Button");
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(newFolderName);
|
||||
testRunner.ClickByName("Create Folder Button");
|
||||
testRunner.Wait(2);
|
||||
Assert.IsTrue(testRunner.WaitForName(newFolderName + " Row Item Collection", 2), $"{newFolderName} exists");
|
||||
|
||||
testRunner.Wait(2);
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName(newFolderName + " Row Item Collection", 2), $"{newFolderName} exists");
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = null;
|
||||
|
||||
try
|
||||
{
|
||||
testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
}
|
||||
catch { }
|
||||
|
|
@ -252,8 +221,6 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
MatterControlUtilities.DeleteDownloadsSubFolder();
|
||||
}
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using NUnit.Framework;
|
||||
|
|
@ -8,626 +8,497 @@ using NUnit.Framework;
|
|||
namespace MatterHackers.MatterControl.Tests.Automation
|
||||
{
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class AddSingleItemToLocalLibrary
|
||||
public class LocalLibraryTests
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void LocalLibraryAddButtonAddSingleItemToLibrary()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task LocalLibraryAddButtonAddSingleItemToLibrary()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
string itemName = "Row Item " + "Fennec Fox";
|
||||
string itemName = "Row Item Fennec Fox";
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
//Make sure that Item does not exist before the test begins
|
||||
bool rowItemExists = testRunner.WaitForName(itemName, 1);
|
||||
resultsHarness.AddTestResult(rowItemExists == false);
|
||||
//Make sure that Item does not exist before the test begins
|
||||
bool rowItemExists = testRunner.WaitForName(itemName, 1);
|
||||
Assert.IsTrue(rowItemExists == false);
|
||||
|
||||
//Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
//Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
|
||||
//Get Library Item to Add
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(rowItemPath);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
//Get Library Item to Add
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(rowItemPath);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
|
||||
resultsHarness.AddTestResult(rowItemWasAdded == true);
|
||||
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
|
||||
Assert.IsTrue(rowItemWasAdded == true);
|
||||
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class AddMultipleItemsToLocalLibrary
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void LocalLibraryAddButtonAddsMultipleItemsToLibrary()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task LocalLibraryAddButtonAddsMultipleItemsToLibrary()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
//Names of Items to be added
|
||||
string firstItemName = "Row Item " + "Fennec Fox";
|
||||
string secondItemName = "Row Item " + "Batman";
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
//Names of Items to be added
|
||||
string firstItemName = "Row Item Fennec Fox";
|
||||
string secondItemName = "Row Item Batman";
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
//Make sure both Items do not exist before the test begins
|
||||
bool firstItemExists = testRunner.WaitForName(firstItemName, 1);
|
||||
bool secondItemExists = testRunner.WaitForName(secondItemName, 1);
|
||||
resultsHarness.AddTestResult(firstItemExists == false);
|
||||
resultsHarness.AddTestResult(secondItemExists == false);
|
||||
//Make sure both Items do not exist before the test begins
|
||||
bool firstItemExists = testRunner.WaitForName(firstItemName, 1);
|
||||
bool secondItemExists = testRunner.WaitForName(secondItemName, 1);
|
||||
Assert.IsTrue(firstItemExists == false);
|
||||
Assert.IsTrue(secondItemExists == false);
|
||||
|
||||
//Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
//Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
|
||||
//Get Library Item to Add
|
||||
string firstRowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
string secondRowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
|
||||
//Get Library Item to Add
|
||||
string firstRowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
string secondRowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
|
||||
|
||||
string textForBothRowItems = String.Format("\"{0}\" \"{1}\"", firstRowItemPath, secondRowItemPath);
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(textForBothRowItems);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
string textForBothRowItems = string.Format("\"{0}\" \"{1}\"", firstRowItemPath, secondRowItemPath);
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(textForBothRowItems);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
bool firstRowItemWasAdded = testRunner.WaitForName(firstItemName, 2);
|
||||
bool secondRowItemWasAdded = testRunner.WaitForName(secondItemName, 2);
|
||||
Assert.IsTrue(firstRowItemWasAdded == true);
|
||||
Assert.IsTrue(secondRowItemWasAdded == true);
|
||||
|
||||
bool firstRowItemWasAdded = testRunner.WaitForName(firstItemName, 2);
|
||||
bool secondRowItemWasAdded = testRunner.WaitForName(secondItemName, 2);
|
||||
resultsHarness.AddTestResult(firstRowItemWasAdded == true);
|
||||
resultsHarness.AddTestResult(secondRowItemWasAdded == true);
|
||||
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(4));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class AddAMFItemToLocalLibrary
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void LocalLibraryAddButtonAddAMFToLibrary()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task LocalLibraryAddButtonAddAMFToLibrary()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
string itemName = "Row Item " + "Rook";
|
||||
string itemName = "Row Item Rook";
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
//Make sure that Item does not exist before the test begins
|
||||
bool rowItemExists = testRunner.WaitForName(itemName, 1);
|
||||
resultsHarness.AddTestResult(rowItemExists == false);
|
||||
//Make sure that Item does not exist before the test begins
|
||||
bool rowItemExists = testRunner.WaitForName(itemName, 1);
|
||||
Assert.IsTrue(rowItemExists == false);
|
||||
|
||||
//Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
//Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
|
||||
//Get Library Item to Add
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Rook.amf");
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(rowItemPath);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
//Get Library Item to Add
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Rook.amf");
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(rowItemPath);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
|
||||
resultsHarness.AddTestResult(rowItemWasAdded == true);
|
||||
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
|
||||
Assert.IsTrue(rowItemWasAdded == true);
|
||||
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1024, overrideHeight: 800);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 1024, overrideHeight: 800);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class AddZipFileToLocalLibrary
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void LocalLibraryAddButtonAddZipToLibrary()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task LocalLibraryAddButtonAddZipToLibrary()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
//Items in Batman.zip
|
||||
string firstItemName = "Row Item " + "Batman";
|
||||
string secondItemName = "Row Item " + "2013-01-25 Mouthpiece v2";
|
||||
//Items in Batman.zip
|
||||
string firstItemName = "Row Item Batman";
|
||||
string secondItemName = "Row Item 2013-01-25 Mouthpiece v2";
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
//Make sure that Item does not exist before the test begins
|
||||
bool firstItemInZipExists = testRunner.WaitForName(firstItemName, 1);
|
||||
bool secondItemInZipExists = testRunner.WaitForName(secondItemName, 1);
|
||||
resultsHarness.AddTestResult(firstItemInZipExists == false);
|
||||
resultsHarness.AddTestResult(firstItemInZipExists == false);
|
||||
//Make sure that Item does not exist before the test begins
|
||||
bool firstItemInZipExists = testRunner.WaitForName(firstItemName, 1);
|
||||
bool secondItemInZipExists = testRunner.WaitForName(secondItemName, 1);
|
||||
Assert.IsTrue(firstItemInZipExists == false);
|
||||
Assert.IsTrue(firstItemInZipExists == false);
|
||||
|
||||
//Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
//Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
|
||||
//Get Library Item to Add
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.zip");
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(rowItemPath);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
//Get Library Item to Add
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.zip");
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(rowItemPath);
|
||||
testRunner.Wait(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
bool firstItemInZipWasAdded = testRunner.WaitForName(firstItemName, 2);
|
||||
bool secondItemInZipWasAdded = testRunner.WaitForName(secondItemName, 2);
|
||||
resultsHarness.AddTestResult(firstItemInZipWasAdded == true);
|
||||
resultsHarness.AddTestResult(secondItemInZipWasAdded == true);
|
||||
bool firstItemInZipWasAdded = testRunner.WaitForName(firstItemName, 2);
|
||||
bool secondItemInZipWasAdded = testRunner.WaitForName(secondItemName, 2);
|
||||
Assert.IsTrue(firstItemInZipWasAdded == true);
|
||||
Assert.IsTrue(secondItemInZipWasAdded == true);
|
||||
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(4));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class RenameButtonRenamesLibraryRowItem
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void RenameButtonRenameLocalLibraryItem()
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task RenameButtonRenameLocalLibraryItem()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
//Navigate To Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
//Navigate To Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
|
||||
string rowItemToRename = "Row Item " + "Calibration - Box";
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName(rowItemToRename);
|
||||
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
|
||||
string rowItemToRename = "Row Item Calibration - Box";
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName(rowItemToRename);
|
||||
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
|
||||
|
||||
testRunner.Wait(2);
|
||||
testRunner.Wait(2);
|
||||
|
||||
testRunner.Type("Library Item Renamed");
|
||||
testRunner.Type("Library Item Renamed");
|
||||
|
||||
testRunner.ClickByName("Rename Button");
|
||||
testRunner.ClickByName("Rename Button");
|
||||
|
||||
string renamedRowItem = "Row Item " + "Library Item Renamed";
|
||||
bool libraryItemWasRenamed = testRunner.WaitForName(renamedRowItem, 2);
|
||||
bool libraryItemBeforeRenameExists = testRunner.WaitForName(rowItemToRename, 2);
|
||||
string renamedRowItem = "Row Item Library Item Renamed";
|
||||
bool libraryItemWasRenamed = testRunner.WaitForName(renamedRowItem, 2);
|
||||
bool libraryItemBeforeRenameExists = testRunner.WaitForName(rowItemToRename, 2);
|
||||
|
||||
resultsHarness.AddTestResult(libraryItemWasRenamed == true);
|
||||
resultsHarness.AddTestResult(libraryItemBeforeRenameExists == false);
|
||||
Assert.IsTrue(libraryItemWasRenamed == true);
|
||||
Assert.IsTrue(libraryItemBeforeRenameExists == false);
|
||||
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 600);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 600);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class UserCanSuccessfullyCreateAndRenameLibraryFolder
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void RenameButtonRenameLocalLibraryFolder()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task RenameButtonRenamesLocalLibraryFolder()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.Wait(.2);
|
||||
|
||||
//Create New Folder
|
||||
testRunner.ClickByName("Create Folder From Library Button");
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Type("New Folder");
|
||||
testRunner.Wait(.5);
|
||||
testRunner.ClickByName("Create Folder Button");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
//Check for Created Folder
|
||||
string newLibraryFolder = "New Folder Row Item Collection";
|
||||
bool newFolderWasCreated = testRunner.WaitForName(newLibraryFolder, 1);
|
||||
resultsHarness.AddTestResult(newFolderWasCreated == true);
|
||||
// Create New Folder
|
||||
testRunner.ClickByName("Create Folder From Library Button");
|
||||
testRunner.Wait(.5);
|
||||
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.ClickByName("New Folder Row Item Collection");
|
||||
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Type("Renamed Library Folder");
|
||||
testRunner.ClickByName("Rename Button");
|
||||
testRunner.Type("New Folder");
|
||||
testRunner.Wait(.5);
|
||||
|
||||
//Make sure that renamed Library Folder Exists
|
||||
bool renamedLibraryFolderExists = testRunner.WaitForName("Renamed Library Folder Row Item Collection", 2);
|
||||
resultsHarness.AddTestResult(renamedLibraryFolderExists == true);
|
||||
testRunner.ClickByName("Create Folder Button");
|
||||
testRunner.Wait(.2);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
// Confirm newly created folder exists
|
||||
Assert.IsTrue(testRunner.WaitForName("New Folder Row Item Collection", 1), "New folder should appear as GuiWidget");
|
||||
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(.2);
|
||||
|
||||
testRunner.ClickByName("New Folder Row Item Collection");
|
||||
testRunner.Wait(.2);
|
||||
|
||||
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Type("Renamed Library Folder");
|
||||
|
||||
testRunner.ClickByName("Rename Button");
|
||||
testRunner.Wait(.2);
|
||||
|
||||
// Make sure the renamed Library Folder exists
|
||||
Assert.IsTrue(testRunner.WaitForName("Renamed Library Folder Row Item Collection", 2), "Renamed folder should exist");
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class LibraryEditButtonOpensUpPartPreviewWindow
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void ClickLibraryEditButtonOpensPartPreviewWindow()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task ClickLibraryEditButtonOpensPartPreviewWindow()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
|
||||
string rowItem = "Row Item " + "Calibration - Box";
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName(rowItem);
|
||||
string rowItem = "Row Item Calibration - Box";
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName(rowItem);
|
||||
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
|
||||
//Make sure that Export Item Window exists after Export button is clicked
|
||||
bool exportItemWindowExists = testRunner.WaitForName("Part Preview Window", 2);
|
||||
resultsHarness.AddTestResult(exportItemWindowExists == true);
|
||||
//Make sure that Export Item Window exists after Export button is clicked
|
||||
bool exportItemWindowExists = testRunner.WaitForName("Part Preview Window", 2);
|
||||
Assert.IsTrue(exportItemWindowExists == true);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class OneLibraryItemSelectedRemoveButtonRemovesItem
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void RemoveButtonClickedRemovesSingleItem()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task RemoveButtonClickedRemovesSingleItem()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
|
||||
string rowItem = "Row Item " + "Calibration - Box";
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName(rowItem);
|
||||
string rowItem = "Row Item Calibration - Box";
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName(rowItem);
|
||||
|
||||
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
|
||||
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Make sure that Export Item Window exists after Export button is clicked
|
||||
bool rowItemExists = testRunner.WaitForName(rowItem, 1);
|
||||
resultsHarness.AddTestResult(rowItemExists == false);
|
||||
//Make sure that Export Item Window exists after Export button is clicked
|
||||
bool rowItemExists = testRunner.WaitForName(rowItem, 1);
|
||||
Assert.IsTrue(rowItemExists == false);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class MultipleLibraryItemsSelectedRemoveButtonRemovesItem
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void RemoveButtonClickedRemovesMultipleItems()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task RemoveButtonClickedRemovesMultipleItems()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(rowItemPath);
|
||||
testRunner.Type("{Enter}");
|
||||
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
|
||||
testRunner.Wait(1);
|
||||
string rowItemOne = "Row Item " + "Calibration - Box";
|
||||
testRunner.ClickByName(rowItemOne, 1);
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(rowItemPath);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(1);
|
||||
|
||||
string rowItemTwo = "Row Item " + "Fennec Fox";
|
||||
testRunner.ClickByName(rowItemTwo, 1);
|
||||
string rowItemOne = "Row Item Calibration - Box";
|
||||
testRunner.ClickByName(rowItemOne, 1);
|
||||
|
||||
testRunner.Wait(1);
|
||||
string rowItemTwo = "Row Item Fennec Fox";
|
||||
testRunner.ClickByName(rowItemTwo, 1);
|
||||
|
||||
//Make sure row items exist before remove
|
||||
bool rowItemOneExistsBeforeRemove = testRunner.WaitForName(rowItemOne, 2);
|
||||
bool rowItemTwoExistsBeforeRemove = testRunner.WaitForName(rowItemTwo, 2);
|
||||
resultsHarness.AddTestResult(rowItemOneExistsBeforeRemove == true);
|
||||
resultsHarness.AddTestResult(rowItemTwoExistsBeforeRemove == true);
|
||||
testRunner.Wait(1);
|
||||
|
||||
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
|
||||
testRunner.Wait(1);
|
||||
// Make sure row items exist before remove
|
||||
Assert.IsTrue(testRunner.WaitForName(rowItemOne, 2), "rowItemOne should exist before remove");
|
||||
Assert.IsTrue(testRunner.WaitForName(rowItemTwo, 2), "rowItemTwo should exist before remove");
|
||||
|
||||
//Make sure both selected items are removed
|
||||
bool rowItemOneExists = testRunner.WaitForName(rowItemOne, 2);
|
||||
bool rowItemTwoExists = testRunner.WaitForName(rowItemTwo, 2);
|
||||
resultsHarness.AddTestResult(rowItemOneExists == false);
|
||||
resultsHarness.AddTestResult(rowItemTwoExists == false);
|
||||
// Remove items
|
||||
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
|
||||
testRunner.Wait(1);
|
||||
|
||||
// Make sure both selected items are removed
|
||||
Assert.IsFalse(testRunner.WaitForName(rowItemOne, 2), "rowItemOne should *not* exist after remove");
|
||||
Assert.IsFalse(testRunner.WaitForName(rowItemTwo, 2), "rowItemTwo should *not* exist after remove");
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(4));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class AddToQueueButtonAddsSingleItemToQueue
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void AddToQueueFromLibraryButtonAddsItemToQueue()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task AddToQueueFromLibraryButtonAddsItemToQueue()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Select Library Item
|
||||
string rowItemOne = "Row Item " + "Calibration - Box";
|
||||
testRunner.ClickByName(rowItemOne);
|
||||
//Select Library Item
|
||||
string rowItemOne = "Row Item Calibration - Box";
|
||||
testRunner.ClickByName(rowItemOne);
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
|
||||
int queueCountBeforeAdd = QueueData.Instance.Count;
|
||||
int queueCountBeforeAdd = QueueData.Instance.Count;
|
||||
|
||||
//Add Library Item to the Print Queue
|
||||
MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
|
||||
//Add Library Item to the Print Queue
|
||||
MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
|
||||
|
||||
testRunner.Wait(2);
|
||||
testRunner.Wait(2);
|
||||
|
||||
//Make sure that the Queue Count increases by one
|
||||
int queueCountAfterAdd = QueueData.Instance.Count;
|
||||
//Make sure that the Queue Count increases by one
|
||||
int queueCountAfterAdd = QueueData.Instance.Count;
|
||||
|
||||
resultsHarness.AddTestResult(queueCountAfterAdd == queueCountBeforeAdd + 1);
|
||||
Assert.IsTrue(queueCountAfterAdd == queueCountBeforeAdd + 1);
|
||||
|
||||
//Navigate to Queue
|
||||
testRunner.ClickByName("Queue Tab");
|
||||
//Navigate to Queue
|
||||
testRunner.ClickByName("Queue Tab");
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Make sure that the Print Item was added
|
||||
string queueItem = "Queue Item " + "Calibration - Box";
|
||||
bool queueItemWasAdded = testRunner.WaitForName(queueItem, 2);
|
||||
resultsHarness.AddTestResult(queueItemWasAdded == true);
|
||||
//Make sure that the Print Item was added
|
||||
string queueItem = "Queue Item Calibration - Box";
|
||||
bool queueItemWasAdded = testRunner.WaitForName(queueItem, 2);
|
||||
Assert.IsTrue(queueItemWasAdded == true);
|
||||
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class AddToQueueButtonAddsMultipleItemsToQueue
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void AddToQueueFromLibraryButtonAddsItemsToQueue()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task AddToQueueFromLibraryButtonAddsItemsToQueue()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
//Add an item to the library
|
||||
string libraryItemToAdd = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
//Add an item to the library
|
||||
string libraryItemToAdd = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(libraryItemToAdd);
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type(libraryItemToAdd);
|
||||
testRunner.Wait(2);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Library Edit Button");
|
||||
testRunner.Wait(1);
|
||||
|
||||
int queueCountBeforeAdd = QueueData.Instance.Count;
|
||||
int queueCountBeforeAdd = QueueData.Instance.Count;
|
||||
|
||||
//Select both Library Items
|
||||
string rowItemOne = "Row Item " + "Calibration - Box";
|
||||
testRunner.ClickByName(rowItemOne);
|
||||
//Select both Library Items
|
||||
string rowItemOne = "Row Item Calibration - Box";
|
||||
testRunner.ClickByName(rowItemOne);
|
||||
|
||||
string rowItemTwo = "Row Item " + "Fennec Fox";
|
||||
testRunner.ClickByName(rowItemTwo);
|
||||
string rowItemTwo = "Row Item Fennec Fox";
|
||||
testRunner.ClickByName(rowItemTwo);
|
||||
|
||||
//Click the Add To Queue button
|
||||
testRunner.Wait(1);
|
||||
MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
|
||||
testRunner.Wait(2);
|
||||
|
||||
//Click the Add To Queue button
|
||||
testRunner.Wait(1);
|
||||
MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
|
||||
testRunner.Wait(2);
|
||||
//Make sure Queue Count increases by the correct amount
|
||||
int queueCountAfterAdd = QueueData.Instance.Count;
|
||||
|
||||
//Make sure Queue Count increases by the correct amount
|
||||
int queueCountAfterAdd = QueueData.Instance.Count;
|
||||
Assert.IsTrue(queueCountAfterAdd == queueCountBeforeAdd + 2);
|
||||
|
||||
resultsHarness.AddTestResult(queueCountAfterAdd == queueCountBeforeAdd + 2);
|
||||
//Navigate to the Print Queue
|
||||
testRunner.ClickByName("Queue Tab");
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Navigate to the Print Queue
|
||||
testRunner.ClickByName("Queue Tab");
|
||||
testRunner.Wait(1);
|
||||
//Test that both added print items exist
|
||||
string queueItemOne = "Queue Item Calibration - Box";
|
||||
string queueItemTwo = "Queue Item Fennec_Fox";
|
||||
bool queueItemOneWasAdded = testRunner.WaitForName(queueItemOne, 2);
|
||||
bool queueItemTwoWasAdded = testRunner.WaitForName(queueItemTwo, 2);
|
||||
|
||||
Assert.IsTrue(queueItemOneWasAdded == true);
|
||||
Assert.IsTrue(queueItemTwoWasAdded == true);
|
||||
|
||||
//Test that both added print items exist
|
||||
string queueItemOne = "Queue Item " + "Calibration - Box";
|
||||
string queueItemTwo = "Queue Item " + "Fennec_Fox";
|
||||
bool queueItemOneWasAdded = testRunner.WaitForName(queueItemOne, 2);
|
||||
bool queueItemTwoWasAdded = testRunner.WaitForName(queueItemTwo, 2);
|
||||
|
||||
resultsHarness.AddTestResult(queueItemOneWasAdded == true);
|
||||
resultsHarness.AddTestResult(queueItemTwoWasAdded == true);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(3));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class ClickLibraryTumbnailWidgetOpensPartPreview
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void LibraryItemThumbnailClickedOpensPartPreview()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task LibraryItemThumbnailClickedOpensPartPreview()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
//Make sure Part Preview Window does not exists before we click the view button
|
||||
bool partPreviewExistsOne = testRunner.WaitForName("Part Preview Window", 1);
|
||||
resultsHarness.AddTestResult(partPreviewExistsOne == false);
|
||||
Assert.IsFalse(testRunner.WaitForName("Part Preview Window", 1), "Preview Window should not exist before we click the view button");
|
||||
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
testRunner.Wait(1);
|
||||
|
||||
string libraryRowItemName = "Row Item " + "Calibration - Box";
|
||||
testRunner.ClickByName(libraryRowItemName);
|
||||
// Click Library Item View Button
|
||||
testRunner.ClickByName("Row Item Calibration - Box View Button");
|
||||
|
||||
testRunner.Wait(1);
|
||||
Assert.IsTrue(testRunner.WaitForName("Part Preview Window", 2), "Part Preview Window should be open after View button is clicked");
|
||||
testRunner.Wait(.2);
|
||||
|
||||
//Click Library Item View Button
|
||||
string libraryItemViewButton = "Row Item " + "Calibration - Box" + " View Button";
|
||||
testRunner.ClickByName(libraryItemViewButton);
|
||||
|
||||
//Make sure that Part Preview Window opens after View button is clicked
|
||||
bool partPreviewWindowExists = testRunner.WaitForName("Part Preview Window", 1.5);
|
||||
resultsHarness.AddTestResult(partPreviewWindowExists == true);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@
|
|||
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.ApplicationDomain, Version=9.0.0.0, Culture=neutral, PublicKeyToken=afbd8211e0c40e2c, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.ApplicationDomain.9.0.0.0\lib\net40\NUnit.ApplicationDomain.dll</HintPath>
|
||||
<Reference Include="NUnit.ApplicationDomain, Version=10.0.0.0, Culture=neutral, PublicKeyToken=afbd8211e0c40e2c, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.ApplicationDomain.10.0.00\lib\net40\NUnit.ApplicationDomain.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
|
|
@ -109,10 +109,6 @@
|
|||
<Project>{195cbe56-e654-437b-ab05-3be1b9452497}</Project>
|
||||
<Name>Agg.Tests</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\WindowsFileDialogs\WindowsFileDialogs.csproj">
|
||||
<Project>{a526dc5d-65f3-461b-805f-d3ac9665f5c9}</Project>
|
||||
<Name>WindowsFileDialogs</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
|
|
@ -10,72 +11,55 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class ShowTerminalButtonClickedOpensTerminal
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void ClickingShowTerminalButtonOpensTerminal()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task ClickingShowTerminalButtonOpensTerminal()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.ClickByName("SettingsAndControls", 5);
|
||||
testRunner.Wait(2);
|
||||
testRunner.ClickByName("Options Tab", 6);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
testRunner.ClickByName("SettingsAndControls", 5);
|
||||
testRunner.Wait(2);
|
||||
testRunner.ClickByName("Options Tab", 6);
|
||||
|
||||
bool terminalWindowExists1 = testRunner.WaitForName("Gcode Terminal", 0);
|
||||
resultsHarness.AddTestResult(terminalWindowExists1 == false, "Terminal Window does not exist");
|
||||
bool terminalWindowExists1 = testRunner.WaitForName("Gcode Terminal", 0);
|
||||
Assert.IsTrue(terminalWindowExists1 == false, "Terminal Window does not exist");
|
||||
|
||||
testRunner.ClickByName("Show Terminal Button", 6);
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Show Terminal Button", 6);
|
||||
testRunner.Wait(1);
|
||||
|
||||
SystemWindow containingWindow;
|
||||
GuiWidget terminalWindow = testRunner.GetWidgetByName("Gcode Terminal", out containingWindow, 3);
|
||||
resultsHarness.AddTestResult(terminalWindow != null, "Terminal Window exists after Show Terminal button is clicked");
|
||||
containingWindow.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
SystemWindow containingWindow;
|
||||
GuiWidget terminalWindow = testRunner.GetWidgetByName("Gcode Terminal", out containingWindow, 3);
|
||||
Assert.IsTrue(terminalWindow != null, "Terminal Window exists after Show Terminal button is clicked");
|
||||
containingWindow.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class ConfigureNotificationSettingsButtonClickedOpensNotificationWindow
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain, Category("FixNeeded" /* Not Finished */)]
|
||||
//DOES NOT WORK
|
||||
public void ClickingConfigureNotificationSettingsButtonOpensWindow()
|
||||
[Test, Apartment(ApartmentState.STA), Category("FixNeeded" /* Not Finished */)]
|
||||
public async Task ConfigureNotificationSettingsButtonOpensNotificationWindow()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
testRunner.ClickByName("SettingsAndControls", 5);
|
||||
testRunner.ClickByName("Options Tab", 6);
|
||||
testRunner.ClickByName("SettingsAndControls", 5);
|
||||
testRunner.ClickByName("Options Tab", 6);
|
||||
|
||||
bool printNotificationsWindowExists1 = testRunner.WaitForName("Notification Options Window", 3);
|
||||
resultsHarness.AddTestResult(printNotificationsWindowExists1 == false, "Print Notification Window does not exist");
|
||||
bool printNotificationsWindowExists1 = testRunner.WaitForName("Notification Options Window", 3);
|
||||
Assert.IsTrue(printNotificationsWindowExists1 == false, "Print Notification Window does not exist");
|
||||
|
||||
testRunner.ClickByName("Configure Notification Settings Button", 6);
|
||||
bool printNotificationsWindowExists2 = testRunner.WaitForName("Notification Options Window", 3);
|
||||
resultsHarness.AddTestResult(printNotificationsWindowExists2 == true, "Print Notifications Window exists after Configure button is clicked");
|
||||
testRunner.ClickByName("Configure Notification Settings Button", 6);
|
||||
bool printNotificationsWindowExists2 = testRunner.WaitForName("Notification Options Window", 3);
|
||||
Assert.IsTrue(printNotificationsWindowExists2 == true, "Print Notifications Window exists after Configure button is clicked");
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
||||
await MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
|
|
@ -12,386 +13,330 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class PartPreviewTests
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void CopyButtonClickedMakesCopyOfPartOnBed()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task CopyButtonMakesCopyOfPart()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
SystemWindow systemWindow;
|
||||
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
testRunner.ClickByName("Row Item Calibration - Box View Button");
|
||||
testRunner.Wait(1);
|
||||
|
||||
// Get View3DWidget
|
||||
View3DWidget view3D = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3) as View3DWidget;
|
||||
|
||||
// Click Edit button to make edit controls visible
|
||||
testRunner.ClickByName("3D View Edit");
|
||||
testRunner.WaitForName("3D View Copy", 3);
|
||||
Assert.AreEqual(1, view3D.MeshGroups.Count, "Should have 1 part before copy");
|
||||
|
||||
|
||||
// Click Copy button and count MeshGroups
|
||||
testRunner.ClickByName("3D View Copy");
|
||||
testRunner.WaitUntil(() => view3D.MeshGroups.Count == 2, 3);
|
||||
Assert.AreEqual(2, view3D.MeshGroups.Count, "Should have 2 parts after copy");
|
||||
|
||||
// Click Copy button a second time and count MeshGroups
|
||||
testRunner.ClickByName("3D View Copy");
|
||||
testRunner.WaitUntil(() => view3D.MeshGroups.Count == 3, 3);
|
||||
Assert.AreEqual(3, view3D.MeshGroups.Count, "Should have 3 parts after 2nd copy");
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 800);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task GroupAndUngroup()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
SystemWindow systemWindow;
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
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();
|
||||
Assert.IsTrue(partCountBeforeCopy == 1);
|
||||
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
|
||||
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 View 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(500);
|
||||
int partCountAfterCopy = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partCountAfterCopy == 2);
|
||||
testRunner.Wait(1);
|
||||
}
|
||||
|
||||
//Click Copy button a second time and count MeshGroups again
|
||||
//Get MeshGroupCount before Group is clicked
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int partsOnBedBeforeGroup = view3D.MeshGroups.Count();
|
||||
Assert.IsTrue(partsOnBedBeforeGroup == 6);
|
||||
|
||||
//Click Group Button and get MeshGroup count after Group button is clicked
|
||||
testRunner.ClickByName("3D View Group");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int partsOnBedAfterGroup = view3D.MeshGroups.Count();
|
||||
Assert.IsTrue(partsOnBedAfterGroup == 1);
|
||||
|
||||
testRunner.ClickByName("3D View Ungroup");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int partsOnBedAfterUngroup = view3D.MeshGroups.Count();
|
||||
Assert.IsTrue(partsOnBedAfterUngroup == 6);
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task RemoveButtonRemovesParts()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
SystemWindow systemWindow;
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
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();
|
||||
Assert.IsTrue(partCountBeforeCopy == 1);
|
||||
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
testRunner.ClickByName(copyButtonName);
|
||||
System.Threading.Thread.Sleep(500);
|
||||
int partCountAfterSecondCopy = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partCountAfterSecondCopy == 3);
|
||||
view3D.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
testRunner.Wait(1);
|
||||
}
|
||||
|
||||
//Get MeshGroupCount before Group is clicked
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int partsOnBedBeforeRemove = view3D.MeshGroups.Count();
|
||||
Assert.IsTrue(partsOnBedBeforeRemove == 6);
|
||||
|
||||
//Check that MeshCount decreases by 1
|
||||
testRunner.ClickByName("3D View Remove");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int meshCountAfterRemove = view3D.MeshGroups.Count();
|
||||
Assert.IsTrue(meshCountAfterRemove == 5);
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(3));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void GroupAndUngroup()
|
||||
[Test, Apartment(ApartmentState.STA), Category("FixNeeded" /* Not Finished */)]
|
||||
public async Task UndoRedoCopy()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
SystemWindow systemWindow;
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
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();
|
||||
Assert.IsTrue(partCountBeforeCopy == 1);
|
||||
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
|
||||
SystemWindow systemWindow;
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
testRunner.ClickByName(copyButtonName);
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
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(2000);
|
||||
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(2000);
|
||||
int partsOnBedAfterGroup = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partsOnBedAfterGroup == 1);
|
||||
|
||||
testRunner.ClickByName("3D View Ungroup");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int partsOnBedAfterUngroup = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partsOnBedAfterUngroup == 6);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
testRunner.Wait(1);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(4));
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void RemoveButtonRemovesParts()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
for (int x = 0; x <= 4; x++)
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
|
||||
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");
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
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(2000);
|
||||
int partsOnBedBeforeRemove= view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partsOnBedBeforeRemove == 6);
|
||||
|
||||
//Check that MeshCount decreases by 1
|
||||
testRunner.ClickByName("3D View Remove");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int meshCountAfterRemove = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(meshCountAfterRemove == 5);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(3));
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain, Category("FixNeeded" /* Not Finished */)]
|
||||
public void UndoRedoCopy()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
|
||||
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");
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
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);
|
||||
}
|
||||
|
||||
testRunner.Wait(1);
|
||||
|
||||
for(int x = 0; x <= 4; x++)
|
||||
{
|
||||
|
||||
int meshCountBeforeUndo = view3D.MeshGroups.Count();
|
||||
testRunner.ClickByName("3D View Undo");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int meshCountAfterUndo = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(meshCountAfterUndo == meshCountBeforeUndo - 1);
|
||||
|
||||
}
|
||||
|
||||
testRunner.Wait(1);
|
||||
|
||||
for(int z = 0; z <= 4; z++)
|
||||
{
|
||||
int meshCountBeforeRedo = view3D.MeshGroups.Count();
|
||||
testRunner.ClickByName("3D View Redo");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int meshCountAfterRedo = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(meshCountAfterRedo == meshCountBeforeRedo + 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(11));
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void UndoRedoDelete()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
|
||||
SystemWindow systemWindow;
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
testRunner.ClickByName("Row Item Calibration - Box", 1);
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
|
||||
//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", 1);
|
||||
int partCountBeforeCopy = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(partCountBeforeCopy == 1);
|
||||
testRunner.Wait(.5);
|
||||
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
testRunner.ClickByName(copyButtonName, 1);
|
||||
testRunner.Wait(.2);
|
||||
int meshCount = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(meshCount == partCountBeforeCopy + i + 1);
|
||||
}
|
||||
|
||||
int meshCountAfterCopy = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(meshCountAfterCopy == 6);
|
||||
testRunner.ClickByName("3D View Remove", 1);
|
||||
testRunner.Wait(.1);
|
||||
int meshCountAfterRemove = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(meshCountAfterRemove == 5);
|
||||
|
||||
int meshCountBeforeUndo = view3D.MeshGroups.Count();
|
||||
testRunner.ClickByName("3D View Undo");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int meshCountAfterUndo = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(meshCountAfterUndo == 6);
|
||||
Assert.IsTrue(meshCountAfterUndo == meshCountBeforeUndo - 1);
|
||||
|
||||
}
|
||||
|
||||
testRunner.Wait(1);
|
||||
|
||||
for (int z = 0; z <= 4; z++)
|
||||
{
|
||||
int meshCountBeforeRedo = view3D.MeshGroups.Count();
|
||||
testRunner.ClickByName("3D View Redo");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
int meshCountAfterRedo = view3D.MeshGroups.Count();
|
||||
resultsHarness.AddTestResult(meshCountAfterRedo == 5);
|
||||
Assert.IsTrue(meshCountAfterRedo == meshCountBeforeRedo + 1);
|
||||
|
||||
partPreview.CloseOnIdle();
|
||||
testRunner.Wait(.1);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 800);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(10));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void SaveAsToQueue()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task CopyRemoveUndoRedo()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
SystemWindow systemWindow;
|
||||
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
testRunner.ClickByName("Row Item Calibration - Box", 1);
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
|
||||
// Get View3DWidget
|
||||
View3DWidget view3D = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3) as View3DWidget;
|
||||
|
||||
// Click Edit button to make edit controls visible
|
||||
testRunner.ClickByName("3D View Edit", 1);
|
||||
testRunner.WaitForName("3D View Copy", 3);
|
||||
Assert.AreEqual(1, view3D.MeshGroups.Count, "Should have 1 part before copy");
|
||||
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
|
||||
//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");
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Click Edit button to make edit controls visible
|
||||
testRunner.ClickByName("3D View Edit");
|
||||
testRunner.Wait(1);
|
||||
|
||||
SystemWindow systemWindow;
|
||||
GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
|
||||
View3DWidget view3D = partPreview as View3DWidget;
|
||||
|
||||
for (int i = 0; i <= 2; i++)
|
||||
{
|
||||
testRunner.ClickByName("3D View Copy");
|
||||
testRunner.Wait(1);
|
||||
}
|
||||
|
||||
//Click Save As button to save changes to the part
|
||||
testRunner.ClickByName("Save As Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Save As Menu Item");
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Type in name of new part and then save to Print Queue
|
||||
testRunner.Type("Save As Print Queue");
|
||||
MatterControlUtilities.NavigateToFolder(testRunner,"Print Queue Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Save As Save Button");
|
||||
|
||||
view3D.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
|
||||
//Make sure there is a new Queue item with a name that matches the new part
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Queue Tab");
|
||||
testRunner.Wait(1);
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Save As Print Queue", 5));
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
testRunner.ClickByName("3D View Copy", 1);
|
||||
testRunner.Wait(.2);
|
||||
}
|
||||
|
||||
Assert.AreEqual(6, view3D.MeshGroups.Count, "Should have 6 parts after batch copy");
|
||||
|
||||
testRunner.ClickByName("3D View Remove", 1);
|
||||
testRunner.WaitUntil(() => view3D.MeshGroups.Count == 5, 3);
|
||||
Assert.AreEqual(5, view3D.MeshGroups.Count, "Should have 5 parts after Remove");
|
||||
|
||||
testRunner.ClickByName("3D View Undo");
|
||||
testRunner.WaitUntil(() => view3D.MeshGroups.Count == 6, 3);
|
||||
Assert.AreEqual(6, view3D.MeshGroups.Count, "Should have 6 parts after Undo");
|
||||
|
||||
testRunner.ClickByName("3D View Redo");
|
||||
testRunner.WaitUntil(() => view3D.MeshGroups.Count == 5, 3);
|
||||
Assert.AreEqual(5, view3D.MeshGroups.Count, "Should have 5 parts after Redo");
|
||||
|
||||
view3D.CloseOnIdle();
|
||||
testRunner.Wait(.1);
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 800);
|
||||
}
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task SaveAsToQueue()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
//Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Click Edit button to make edit controls visible
|
||||
testRunner.ClickByName("3D View Edit");
|
||||
testRunner.Wait(1);
|
||||
|
||||
SystemWindow systemWindow;
|
||||
GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
|
||||
View3DWidget view3D = partPreview as View3DWidget;
|
||||
|
||||
for (int i = 0; i <= 2; i++)
|
||||
{
|
||||
testRunner.ClickByName("3D View Copy");
|
||||
testRunner.Wait(1);
|
||||
}
|
||||
|
||||
//Click Save As button to save changes to the part
|
||||
testRunner.ClickByName("Save As Menu");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Save As Menu Item");
|
||||
testRunner.Wait(1);
|
||||
|
||||
//Type in name of new part and then save to Print Queue
|
||||
testRunner.Type("Save As Print Queue");
|
||||
testRunner.NavigateToFolder("Print Queue Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Save As Save Button");
|
||||
|
||||
view3D.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
|
||||
//Make sure there is a new Queue item with a name that matches the new part
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Queue Tab");
|
||||
testRunner.Wait(1);
|
||||
Assert.IsTrue(testRunner.WaitForName("Queue Item Save As Print Queue", 5));
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
|
|
@ -11,48 +12,41 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class PrinterNameChangePersists
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void PrinterNameStaysChanged()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task PrinterNameStaysChanged()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Now do the actions specific to this test. (replace this for new tests)
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
||||
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);
|
||||
Assert.IsTrue(testRunner.ClickByName("Printer Tab", 1), "Click Printer Tab");
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Printer Tab", 1), "Click Printer Tab");
|
||||
string widgetName = "Printer Name Edit";
|
||||
testRunner.ClickByName(widgetName);
|
||||
|
||||
string widgetName = "Printer Name Edit";
|
||||
testRunner.ClickByName(widgetName);
|
||||
SystemWindow window;
|
||||
var textWidget = testRunner.GetWidgetByName(widgetName, out window);
|
||||
string newName = "Updated name";
|
||||
textWidget.Text = newName;
|
||||
testRunner.ClickByName("Printer Tab", 1);
|
||||
testRunner.Wait(4);
|
||||
|
||||
SystemWindow window;
|
||||
var textWidget = testRunner.GetWidgetByName(widgetName, out window);
|
||||
string newName = "Updated name";
|
||||
textWidget.Text = newName;
|
||||
testRunner.ClickByName("Printer Tab", 1);
|
||||
testRunner.Wait(4);
|
||||
//Check to make sure the Printer dropdown gets the name change
|
||||
testRunner.ClickByName("Printers... Menu", 2);
|
||||
testRunner.Wait(1);
|
||||
Assert.IsTrue(testRunner.NameExists(newName + " Menu Item"), "Widget with updated printer name exists");
|
||||
|
||||
//Check to make sure the Printer dropdown gets the name change
|
||||
testRunner.ClickByName("Printers... Menu", 2);
|
||||
testRunner.Wait(1);
|
||||
resultsHarness.AddTestResult(testRunner.NameExists(newName + " Menu Item"), "Widget with updated printer name exists");
|
||||
//Make sure the Active profile name changes as well
|
||||
Assert.IsTrue(ProfileManager.Instance.ActiveProfile.Name == newName, "ActiveProfile has updated name");
|
||||
|
||||
//Make sure the Active profile name changes as well
|
||||
resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfile.Name == newName, "ActiveProfile has updated name");
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(5));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
|
|
@ -14,102 +16,97 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class SliceSetingsTests
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void RaftEnabledPassedToSliceEngine()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task RaftEnabledPassedToSliceEngine()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
//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);
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
|
||||
testRunner.ClickByName("Layer View Tab");
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
testRunner.Wait(.2);
|
||||
|
||||
testRunner.ClickByName("Bread Crumb Button Home", 1);
|
||||
// Add the Calibration box to the queue and selects it
|
||||
testRunner.ClickByName("Row Item Calibration - Box Print Button");
|
||||
testRunner.Wait(1);
|
||||
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);
|
||||
testRunner.ClickByName("Layer View Tab");
|
||||
testRunner.Wait(.2);
|
||||
|
||||
testRunner.ClickByName("Raft / Priming Tab", 1);
|
||||
testRunner.ClickByName("Bread Crumb Button Home", 1);
|
||||
testRunner.Wait(.2);
|
||||
|
||||
testRunner.ClickByName("Create Raft Checkbox", 1);
|
||||
testRunner.Wait(1.5);
|
||||
testRunner.ClickByName("Generate Gcode Button", 1);
|
||||
testRunner.Wait(5);
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
||||
testRunner.Wait(.2);
|
||||
|
||||
//Call compare slice settings methode here
|
||||
resultsHarness.AddTestResult(MatterControlUtilities.CompareExpectedSliceSettingValueWithActualVaue("enableRaft", "True"));
|
||||
testRunner.ClickByName("Raft / Priming Tab", 1);
|
||||
testRunner.Wait(.2);
|
||||
|
||||
testRunner.ClickByName("Create Raft Checkbox", 1);
|
||||
testRunner.Wait(1.5);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
testRunner.ClickByName("Generate Gcode Button", 1);
|
||||
testRunner.Wait(2);
|
||||
|
||||
testRunner.WaitUntil(() => MatterControlUtilities.CompareExpectedSliceSettingValueWithActualVaue("enableRaft", "True"), 10);
|
||||
|
||||
//Call compare slice settings method here
|
||||
Assert.IsTrue(MatterControlUtilities.CompareExpectedSliceSettingValueWithActualVaue("enableRaft", "True"));
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 800);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(3));
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 800);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void PauseOnLayerDoesPauseOnPrint()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task PauseOnLayerDoesPauseOnPrint()
|
||||
{
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner();
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
using (var emulatorProcess = testRunner.LaunchAndConnectToPrinterEmulator())
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner, MatterControlUtilities.PrepAction.CloseSignInAndPrinterSelect);
|
||||
Assert.IsTrue(ProfileManager.Instance.ActiveProfile != null);
|
||||
|
||||
var emualtorProccess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner);
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
||||
|
||||
resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfile != null);
|
||||
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("General Tab", 1));
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Single Print Tab", 1));
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Layer(s) To Pause:" + " Edit"));
|
||||
Assert.IsTrue(testRunner.ClickByName("General Tab", 1));
|
||||
Assert.IsTrue(testRunner.ClickByName("Single Print Tab", 1));
|
||||
Assert.IsTrue(testRunner.ClickByName("Layer(s) To Pause: Edit"));
|
||||
testRunner.Type("4;2;a;not;6");
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Layer View Tab"));
|
||||
Assert.IsTrue(testRunner.ClickByName("Layer View Tab"));
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Generate Gcode Button", 1));
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Display Checkbox", 10));
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Sync To Print Checkbox", 1));
|
||||
Assert.IsTrue(testRunner.ClickByName("Generate Gcode Button", 1));
|
||||
Assert.IsTrue(testRunner.ClickByName("Display Checkbox", 10));
|
||||
Assert.IsTrue(testRunner.ClickByName("Sync To Print Checkbox", 1));
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Start Print Button", 1));
|
||||
Assert.IsTrue(testRunner.ClickByName("Start Print Button", 1));
|
||||
|
||||
WaitForLayerAndResume(resultsHarness, testRunner, 2);
|
||||
WaitForLayerAndResume(resultsHarness, testRunner, 4);
|
||||
WaitForLayerAndResume(resultsHarness, testRunner, 6);
|
||||
WaitForLayerAndResume(testRunner, 2);
|
||||
WaitForLayerAndResume(testRunner, 4);
|
||||
WaitForLayerAndResume(testRunner, 6);
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Done Button", 30));
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Print Again Button", 1));
|
||||
Assert.IsTrue(testRunner.WaitForName("Done Button", 30));
|
||||
Assert.IsTrue(testRunner.WaitForName("Print Again Button", 1));
|
||||
|
||||
try
|
||||
{
|
||||
emualtorProccess.Kill();
|
||||
}
|
||||
catch {}
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 200);
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(19));
|
||||
await MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 90);
|
||||
}
|
||||
|
||||
private static void WaitForLayerAndResume(AutomationTesterHarness resultsHarness, AutomationRunner testRunner, int indexToWaitFor)
|
||||
private static void WaitForLayerAndResume(AutomationRunner testRunner, int indexToWaitFor)
|
||||
{
|
||||
testRunner.WaitForName("Resume Button", 30);
|
||||
|
||||
|
|
@ -117,182 +114,155 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
GuiWidget layerNumber = testRunner.GetWidgetByName("Current GCode Layer Edit", out containingWindow, 20);
|
||||
|
||||
layerNumber.Invalidate();
|
||||
testRunner.WaitUntil(() =>
|
||||
{
|
||||
return layerNumber.Text == indexToWaitFor.ToString();
|
||||
}, 2);
|
||||
testRunner.WaitUntil(() => layerNumber.Text == indexToWaitFor.ToString(), 2);
|
||||
|
||||
resultsHarness.AddTestResult(layerNumber.Text == indexToWaitFor.ToString());
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Resume Button", 1));
|
||||
Assert.IsTrue(layerNumber.Text == indexToWaitFor.ToString());
|
||||
Assert.IsTrue(testRunner.ClickByName("Resume Button", 1));
|
||||
testRunner.Wait(.1);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void ClearingCheckBoxClearsUserOverride()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task ClearingCheckBoxClearsUserOverride()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
//Navigate to Local Library
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);
|
||||
//Navigate to Local Library
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Printer Tab", 1), "Switch to Printers tab");
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Features Tab", 1), "Switch to Features tab");
|
||||
Assert.IsTrue(testRunner.ClickByName("Printer Tab", 1), "Switch to Printers tab");
|
||||
Assert.IsTrue(testRunner.ClickByName("Features Tab", 1), "Switch to Features tab");
|
||||
|
||||
CheckAndUncheckSetting(resultsHarness, testRunner, SettingsKey.heat_extruder_before_homing, "Heat Before Homing Checkbox", false);
|
||||
CheckAndUncheckSetting(testRunner, SettingsKey.heat_extruder_before_homing, "Heat Before Homing Checkbox", false);
|
||||
|
||||
CheckAndUncheckSetting(resultsHarness, testRunner, SettingsKey.has_fan, "Has Fan Checkbox", true);
|
||||
CheckAndUncheckSetting(testRunner, SettingsKey.has_fan, "Has Fan Checkbox", true);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(20));
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void DeleteProfileWorksForGuest()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task DeleteProfileWorksForGuest()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// assert no profiles
|
||||
resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0);
|
||||
// assert no profiles
|
||||
Assert.IsTrue(ProfileManager.Instance.ActiveProfiles.Count() == 0);
|
||||
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
// assert one profile
|
||||
resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 1);
|
||||
// assert one profile
|
||||
Assert.IsTrue(ProfileManager.Instance.ActiveProfiles.Count() == 1);
|
||||
|
||||
MatterControlUtilities.DeleteSelectedPrinter(testRunner);
|
||||
MatterControlUtilities.DeleteSelectedPrinter(testRunner);
|
||||
|
||||
// assert no profiles
|
||||
resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfiles.Count() == 0);
|
||||
// assert no profiles
|
||||
Assert.IsTrue(ProfileManager.Instance.ActiveProfiles.Count() == 0);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(3));
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900);
|
||||
}
|
||||
|
||||
private static void CheckAndUncheckSetting(AutomationTesterHarness resultsHarness, AutomationRunner testRunner, string settingToChange, string checkBoxName, bool expected)
|
||||
private static void CheckAndUncheckSetting(AutomationRunner testRunner, string settingToChange, string checkBoxName, bool expected)
|
||||
{
|
||||
// Assert that the checkbox is currently unchecked, and there is no user override
|
||||
resultsHarness.AddTestResult(ActiveSliceSettings.Instance.GetValue<bool>(settingToChange) == expected);
|
||||
resultsHarness.AddTestResult(ActiveSliceSettings.Instance.UserLayer.ContainsKey(settingToChange) == false);
|
||||
Assert.IsTrue(ActiveSliceSettings.Instance.GetValue<bool>(settingToChange) == expected);
|
||||
Assert.IsTrue(ActiveSliceSettings.Instance.UserLayer.ContainsKey(settingToChange) == false);
|
||||
|
||||
// Click the checkbox
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName(checkBoxName, 1));
|
||||
Assert.IsTrue(testRunner.ClickByName(checkBoxName, 1));
|
||||
testRunner.Wait(2);
|
||||
|
||||
// Assert the checkbox is checked and the user override is set
|
||||
resultsHarness.AddTestResult(ActiveSliceSettings.Instance.GetValue<bool>(settingToChange) != expected);
|
||||
resultsHarness.AddTestResult(ActiveSliceSettings.Instance.UserLayer.ContainsKey(settingToChange) == true);
|
||||
Assert.IsTrue(ActiveSliceSettings.Instance.GetValue<bool>(settingToChange) != expected);
|
||||
Assert.IsTrue(ActiveSliceSettings.Instance.UserLayer.ContainsKey(settingToChange) == true);
|
||||
|
||||
// Click the cancel user override button
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Restore " + settingToChange, 1));
|
||||
Assert.IsTrue(testRunner.ClickByName("Restore " + settingToChange, 1));
|
||||
testRunner.Wait(2);
|
||||
|
||||
// Assert the checkbox is unchecked and there is no user override
|
||||
resultsHarness.AddTestResult(ActiveSliceSettings.Instance.GetValue<bool>(settingToChange) == expected);
|
||||
resultsHarness.AddTestResult(ActiveSliceSettings.Instance.UserLayer.ContainsKey(settingToChange) == false);
|
||||
Assert.IsTrue(ActiveSliceSettings.Instance.GetValue<bool>(settingToChange) == expected);
|
||||
Assert.IsTrue(ActiveSliceSettings.Instance.UserLayer.ContainsKey(settingToChange) == false);
|
||||
}
|
||||
|
||||
//Stress Test check & uncheck 1000x
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain, Category("FixNeeded" /* Not Finished */)]
|
||||
public void HasHeatedBedCheckUncheck()
|
||||
[Test, Apartment(ApartmentState.STA), Category("FixNeeded" /* Not Finished */)]
|
||||
public async Task HasHeatedBedCheckUncheck()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
//Navigate to Local Library
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
||||
|
||||
Assert.IsTrue(testRunner.ClickByName("Printer Tab"));
|
||||
testRunner.Wait(1);
|
||||
|
||||
Assert.IsTrue(testRunner.ClickByName("Features Tab"));
|
||||
testRunner.Wait(2);
|
||||
|
||||
for (int i = 0; i <= 1000; i++)
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
//Navigate to Local Library
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Printer Tab"));
|
||||
testRunner.Wait(1);
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Features Tab"));
|
||||
testRunner.Wait(2);
|
||||
|
||||
for (int i = 0; i <= 1000; i++)
|
||||
{
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Has Heated Bed Checkbox"));
|
||||
testRunner.Wait(.5);
|
||||
}
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
Assert.IsTrue(testRunner.ClickByName("Has Heated Bed Checkbox"));
|
||||
testRunner.Wait(.5);
|
||||
}
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(1010));
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void HasHeatedBedCheckedHidesBedTemperatureOptions()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task HasHeatedBedCheckedHidesBedTemperatureOptions()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
//Navigate to Settings Tab and make sure Bed Temp Text box is visible
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);
|
||||
//Navigate to Settings Tab and make sure Bed Temp Text box is visible
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
||||
|
||||
testRunner.ClickByName("Filament Tab", 1);
|
||||
testRunner.ClickByName("Temperatures Tab", 1);
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Bed Temperature Textbox", 2));
|
||||
testRunner.ClickByName("Filament Tab", 1);
|
||||
testRunner.ClickByName("Temperatures Tab", 1);
|
||||
Assert.IsTrue(testRunner.WaitForName("Bed Temperature Textbox", 2));
|
||||
|
||||
//Uncheck Has Heated Bed checkbox and make sure Bed Temp Textbox is not visible
|
||||
testRunner.ClickByName("Printer Tab",1);
|
||||
testRunner.ClickByName("Features Tab", 1);
|
||||
testRunner.DragByName("Show Reset Connection Checkbox", 1, offset: new Agg.Point2D(-40, 0));
|
||||
testRunner.MoveToByName("Show Reset Connection Checkbox", 1, offset: new Agg.Point2D(0, 120));
|
||||
testRunner.Drop();
|
||||
testRunner.ClickByName("Has Heated Bed Checkbox", 1);
|
||||
testRunner.Wait(.5);
|
||||
testRunner.ClickByName("Filament Tab", 1);
|
||||
bool bedTemperatureTextBoxVisible = testRunner.WaitForName("Bed Temperature Textbox", 2);
|
||||
resultsHarness.AddTestResult(bedTemperatureTextBoxVisible == false);
|
||||
//Uncheck Has Heated Bed checkbox and make sure Bed Temp Textbox is not visible
|
||||
testRunner.ClickByName("Printer Tab", 1);
|
||||
testRunner.ClickByName("Features Tab", 1);
|
||||
testRunner.DragByName("Show Reset Connection Checkbox", 1, offset: new Agg.Point2D(-40, 0));
|
||||
testRunner.MoveToByName("Show Reset Connection Checkbox", 1, offset: new Agg.Point2D(0, 120));
|
||||
testRunner.Drop();
|
||||
testRunner.ClickByName("Has Heated Bed Checkbox", 1);
|
||||
testRunner.Wait(.5);
|
||||
testRunner.ClickByName("Filament Tab", 1);
|
||||
bool bedTemperatureTextBoxVisible = testRunner.WaitForName("Bed Temperature Textbox", 2);
|
||||
Assert.IsTrue(bedTemperatureTextBoxVisible == false);
|
||||
|
||||
//Make sure Bed Temperature Options are not visible in printer controls
|
||||
testRunner.ClickByName("Controls Tab");
|
||||
bool bedTemperatureControlsWidget = testRunner.WaitForName("Bed Temperature Controls Widget", 2);
|
||||
resultsHarness.AddTestResult(bedTemperatureTextBoxVisible == false);
|
||||
//Make sure Bed Temperature Options are not visible in printer controls
|
||||
testRunner.ClickByName("Controls Tab");
|
||||
bool bedTemperatureControlsWidget = testRunner.WaitForName("Bed Temperature Controls Widget", 2);
|
||||
Assert.IsTrue(bedTemperatureTextBoxVisible == false);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 550);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(5));
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 550);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.GuiAutomation;
|
||||
|
|
@ -11,59 +12,53 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
||||
public class SqLiteLibraryProviderTests
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public void LibraryQueueViewRefreshesOnAddItem()
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task LibraryQueueViewRefreshesOnAddItem()
|
||||
{
|
||||
// Run a copy of MatterControl
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
testRunner.ClickByName("Library Tab", 5);
|
||||
testRunner.ClickByName("Library Tab", 5);
|
||||
|
||||
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
testRunner.ClickByName("Row Item Calibration - Box View Button");
|
||||
testRunner.Wait(1);
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Row Item Calibration - Box");
|
||||
testRunner.ClickByName("Row Item Calibration - Box View Button");
|
||||
testRunner.Wait(1);
|
||||
|
||||
SystemWindow systemWindow;
|
||||
GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
|
||||
View3DWidget view3D = partPreview as View3DWidget;
|
||||
SystemWindow systemWindow;
|
||||
GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
|
||||
View3DWidget view3D = partPreview as View3DWidget;
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("3D View Edit", 3));
|
||||
Assert.IsTrue(testRunner.ClickByName("3D View Edit", 3));
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("3D View Copy", 3), "Click Copy");
|
||||
// wait for the copy to finish
|
||||
testRunner.Wait(.1);
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("3D View Remove", 3), "Click Delete");
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu", 3), "Click Save As Menu");
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu Item", 3), "Click Save As");
|
||||
Assert.IsTrue(testRunner.ClickByName("3D View Copy", 3), "Click Copy");
|
||||
// wait for the copy to finish
|
||||
testRunner.Wait(.1);
|
||||
Assert.IsTrue(testRunner.ClickByName("3D View Remove", 3), "Click Delete");
|
||||
Assert.IsTrue(testRunner.ClickByName("Save As Menu", 3), "Click Save As Menu");
|
||||
Assert.IsTrue(testRunner.ClickByName("Save As Menu Item", 3), "Click Save As");
|
||||
|
||||
testRunner.Wait(1);
|
||||
testRunner.Wait(1);
|
||||
|
||||
testRunner.Type("0Test Part");
|
||||
resultsHarness.AddTestResult(MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"));
|
||||
testRunner.Type("0Test Part");
|
||||
Assert.IsTrue(testRunner.NavigateToFolder("Local Library Row Item Collection"));
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Save As Save Button", 1));
|
||||
Assert.IsTrue(testRunner.ClickByName("Save As Save Button", 1));
|
||||
|
||||
view3D.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
view3D.CloseOnIdle();
|
||||
testRunner.Wait(.5);
|
||||
|
||||
// ensure that it is now in the library folder (that the folder updated)
|
||||
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item " + "0Test Part", 5), "The part we added should be in the library");
|
||||
// ensure that it is now in the library folder (that the folder updated)
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item 0Test Part", 5), "The part we added should be in the library");
|
||||
|
||||
testRunner.Wait(.5);
|
||||
testRunner.Wait(.5);
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(8));
|
||||
await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,10 +2,6 @@
|
|||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.4.14350" newVersion="2.6.4.14350" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
<packages>
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
|
||||
<package id="NUnit" version="3.4.1" targetFramework="net45" />
|
||||
<package id="NUnit.ApplicationDomain" version="9.0.0.0" targetFramework="net45" />
|
||||
<package id="NUnit.ApplicationDomain" version="10.0.00" targetFramework="net45" />
|
||||
</packages>
|
||||
|
|
@ -53,8 +53,8 @@
|
|||
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.ApplicationDomain, Version=9.0.0.0, Culture=neutral, PublicKeyToken=afbd8211e0c40e2c, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.ApplicationDomain.9.0.0.0\lib\net40\NUnit.ApplicationDomain.dll</HintPath>
|
||||
<Reference Include="NUnit.ApplicationDomain, Version=10.0.0.0, Culture=neutral, PublicKeyToken=afbd8211e0c40e2c, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.ApplicationDomain.10.0.00\lib\net40\NUnit.ApplicationDomain.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.engine, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
|
|
@ -78,6 +78,7 @@
|
|||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MatterControl\BrailleGrade2Tests.cs" />
|
||||
<Compile Include="MatterControl\PerformanceTests.cs" />
|
||||
<Compile Include="MatterControl\ImportSettingsTests.cs" />
|
||||
<Compile Include="MatterControl\SettingsParseTests.cs" />
|
||||
|
|
@ -106,6 +107,10 @@
|
|||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\BrailleBuilder\BrailleBuilder.csproj">
|
||||
<Project>{70FBB82C-558D-4B5F-BE75-A922D392E650}</Project>
|
||||
<Name>BrailleBuilder</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MatterControl.csproj">
|
||||
<Project>{0B8D6F56-BD7F-4426-B858-D9292B084656}</Project>
|
||||
<Name>MatterControl</Name>
|
||||
|
|
@ -146,10 +151,6 @@
|
|||
<Project>{D3E41B4E-BFBB-44CA-94C8-95C00F754FDD}</Project>
|
||||
<Name>VectorMath</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\WindowsFileDialogs\WindowsFileDialogs.csproj">
|
||||
<Project>{A526DC5D-65F3-461B-805F-D3AC9665F5C9}</Project>
|
||||
<Name>WindowsFileDialogs</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
using MatterHackers.MatterControl.Plugins.BrailleBuilder;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MatterControl.Tests.MatterControl
|
||||
{
|
||||
[TestFixture, Category("TextCreator")]
|
||||
public class BrailleGrade2Tests
|
||||
{
|
||||
[Test]
|
||||
public static void ConvertBrailleText()
|
||||
{
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("taylor") == "taylor");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("Taylor") == ",taylor");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("TayLor") == ",tay,lor");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("energy") == "5}gy");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("men") == "m5");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("runabout") == "runab");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("afternoon") == "afn");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("really") == "re,y");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("glance") == "gl.e");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("station") == "/,n");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("as") == "z");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("abby") == "a2y");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("commitment") == "-mit;t");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("mother") == "\"m");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("myself") == "myf");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("lochness") == "lo*;s");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("Seven o'clock") == ",sev5 o'c");
|
||||
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("test") == "te/");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("that") == "t");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("will") == "w");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("show") == "%{");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("our") == "|r");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("with") == ")");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("braille") == "brl");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertWord("conformance") == "3=m.e");
|
||||
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("go to sleep") == "g 6sleep");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("go to") == "g to");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("here it is") == "\"h x is");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("test that will show our conformance with braille") == "te/ t w %{ |r 3=m.e ) brl");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("so we can create some strings and then this gives us the output that is expected") == "s we c cr1te \"s /r+s & !n ? gives u ! |tput t is expect$");
|
||||
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("Waltz, bad nymph, for quick jigs vex.") == ",waltz1 bad nymph1 = qk jigs vex4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("Quick zephyrs blow, vexing daft Jim.") == ",qk zephyrs bl{1 vex+ daft ,jim4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("Sphinx of black quartz, judge my vow.") == ",sph9x ( black qu>tz1 judge my v{4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("Two driven jocks help fax my big quiz.") == ",two driv5 jocks help fax my big quiz4");
|
||||
// Assert.IsTrue(BrailleGrade2.ConvertString("Five quacking zephyrs jolt my wax bed.") == ",five quack+ zephyrs jolt my wax b$4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("The five boxing wizards jump quickly.") == ",! five box+ wiz>ds jump qkly4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("Pack my box with five dozen liquor jugs.") == ",pack my box ) five doz5 liquor jugs4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("The quick brown fox jumps over the lazy dog.") == ",! qk br{n fox jumps ov} ! lazy dog4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("Jinxed wizards pluck ivy from the big quilt.") == ",j9x$ wiz>ds pluck ivy f ! big quilt4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("Crazy Fredrick bought many very exquisite opal jewels.") == ",crazy ,fr$rick b\"| _m v exquisite opal jewels4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("We promptly judged antique ivory buckles for the next prize.") == ",we promptly judg$ antique ivory buckles =! next prize4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("A mad boxer shot a quick, gloved jab to the jaw of his dizzy opponent.") == ",a mad box} %ot a qk1 glov$ jab 6! jaw ( 8 dizzy opp\"ont4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("Jaded zombies acted quaintly but kept driving their oxen forward.") == ",jad$ zombies act$ qua9tly b kept driv+ _! ox5 =w>d4");
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("14. The job requires extra pluck and zeal from every young wage earner.") == "#ad4 ,! job requires extra pluck & z1l f e \"y wage e>n}4");
|
||||
|
||||
Assert.IsTrue(BrailleGrade2.ConvertString("Just wanting to put together some more tests to show the effectiveness of our converter.") == ",j want+ 6put tgr \"s m te/s 6%{ ! e6ective;s ( |r 3v}t}4");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
toImport.UserLayer
|
||||
};
|
||||
|
||||
printerSettings.Merge(printerSettings.UserLayer, toImport, sourceFilter);
|
||||
printerSettings.Merge(printerSettings.UserLayer, toImport, sourceFilter, false);
|
||||
|
||||
Assert.AreEqual(printerSettings.GetValue(SettingsKey.cancel_gcode), newValue, "Imported setting applied");
|
||||
Assert.IsEmpty(printerSettings.GetValue(notAnExistingKey), "Invalid settings keys should be skipped");
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace MatterHackers.MatterControl.Tests
|
|||
}
|
||||
|
||||
#if !__ANDROID__
|
||||
[Test, RunInApplicationDomain, Category("FixNeeded" /* Disabled until MCWS production is updated */)]
|
||||
[Test]
|
||||
public void LibraryProviderSqlite_NavigationWorking()
|
||||
{
|
||||
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
|
||||
|
|
@ -63,8 +63,8 @@ namespace MatterHackers.MatterControl.Tests
|
|||
testProvider.DataReloaded += (sender, e) => { dataReloaded = true; };
|
||||
Thread.Sleep(3000); // wait for the library to finish initializing
|
||||
UiThread.InvokePendingActions();
|
||||
Assert.IsTrue(testProvider.CollectionCount == 0, "Start with a new database for these tests.");
|
||||
Assert.IsTrue(testProvider.ItemCount == 3, "Start with a new database for these tests.");
|
||||
Assert.AreEqual(0, testProvider.CollectionCount, "Start with a new database for these tests.");
|
||||
Assert.AreEqual(3, testProvider.ItemCount, "Start with a new database for these tests.");
|
||||
|
||||
// create a collection and make sure it is on disk
|
||||
dataReloaded = false; // it has been loaded for the default set of parts
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
|
|
@ -41,7 +43,9 @@ using MatterHackers.Agg.UI.Tests;
|
|||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrintLibrary.Provider;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MatterHackers.MatterControl.Tests.Automation
|
||||
|
|
@ -51,6 +55,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
private static bool saveImagesForDebug = true;
|
||||
|
||||
private static event EventHandler unregisterEvents;
|
||||
|
||||
private static int testID = 0;
|
||||
|
||||
private static string runName = DateTime.Now.ToString("yyyy-MM-ddTHH-mm-ss");
|
||||
|
|
@ -61,14 +67,6 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
Assert.IsTrue(testRunner.ClickByName(" Remove All Menu Item", 2));
|
||||
}
|
||||
|
||||
public static string DefaultTestImages
|
||||
{
|
||||
get
|
||||
{
|
||||
return TestContext.CurrentContext.ResolveProjectPath(4, "Tests", "TestData", "TestImages");
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateDownloadsSubFolder()
|
||||
{
|
||||
Directory.CreateDirectory(PathToDownloadsSubFolder);
|
||||
|
|
@ -93,8 +91,27 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
testRunner.ClickByName("Sign Out Menu Item", 2);
|
||||
testRunner.Wait(.5);
|
||||
|
||||
testRunner.ClickByName("Yes Button");
|
||||
testRunner.Wait(5);
|
||||
// Rather than waiting a fixed amount of time, we wait for the ReloadAll to complete before returning
|
||||
testRunner.WaitForReloadAll(() => testRunner.ClickByName("Yes Button"));
|
||||
}
|
||||
|
||||
public static void WaitForReloadAll(this AutomationRunner testRunner, Action reloadAllAction)
|
||||
{
|
||||
// Wire up a block and release mechanism to wait until the sign in process has completed
|
||||
AutoResetEvent resetEvent = new AutoResetEvent(false);
|
||||
ApplicationController.Instance.DoneReloadingAll.RegisterEvent((s, e) => resetEvent.Set(), ref unregisterEvents);
|
||||
|
||||
// Start the procedure that begins a ReloadAll event in MatterControl
|
||||
reloadAllAction();
|
||||
|
||||
// Wait until DoneReloadingAll completes
|
||||
resetEvent.WaitOne();
|
||||
|
||||
// Remove our DoneReloadingAll listener
|
||||
unregisterEvents(null, null);
|
||||
|
||||
// Wait for any post DoneReloadingAll code to finish up and return
|
||||
testRunner.Wait(.2);
|
||||
}
|
||||
|
||||
public static string PathToExportGcodeFolder
|
||||
|
|
@ -107,7 +124,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
return TestContext.CurrentContext.ResolveProjectPath(4, "Tests", "TestData", "QueueItems", queueItemToLoad);
|
||||
}
|
||||
|
||||
public static void CloseMatterControl(AutomationRunner testRunner)
|
||||
private static void CloseMatterControlViaMenu(AutomationRunner testRunner)
|
||||
{
|
||||
SystemWindow mcWindowLocal = MatterControlApplication.Instance;
|
||||
testRunner.ClickByName("File Menu", 5);
|
||||
|
|
@ -125,18 +142,27 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
CloseSignInAndPrinterSelect,
|
||||
};
|
||||
|
||||
public static void PrepForTestRun(AutomationRunner testRunner, PrepAction preAction = PrepAction.CloseSignInAndPrinterSelect)
|
||||
public static void CloseSignInAndPrinterSelect(this AutomationRunner testRunner, PrepAction preAction = PrepAction.CloseSignInAndPrinterSelect)
|
||||
{
|
||||
switch (preAction)
|
||||
// Non-MCCentral builds won't have the plugin. Reduce the wait time for these cases
|
||||
if (testRunner.WaitForName("Connection Wizard Skip Sign In Button", 0.5))
|
||||
{
|
||||
case PrepAction.CloseSignInAndPrinterSelect:
|
||||
testRunner.ClickByName("Connection Wizard Skip Sign In Button", 5);
|
||||
testRunner.ClickByName("Cancel Wizard Button", 5);
|
||||
break;
|
||||
testRunner.ClickByName("Connection Wizard Skip Sign In Button");
|
||||
}
|
||||
|
||||
testRunner.ClickByName("Cancel Wizard Button", 5);
|
||||
}
|
||||
|
||||
public class PrintEmulatorProcess: Process
|
||||
{
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
this.Kill();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
||||
public static Process LaunchAndConnectToPrinterEmulator(AutomationRunner testRunner, bool runSlow = false, string make = "Airwolf 3D", string model = "HD")
|
||||
public static Process LaunchAndConnectToPrinterEmulator(this AutomationRunner testRunner, string make = "Airwolf 3D", string model = "HD", bool runSlow = false)
|
||||
{
|
||||
// Load the TestEnv config
|
||||
var config = TestAutomationConfig.Load();
|
||||
|
|
@ -144,7 +170,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
// Create the printer
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, make, model);
|
||||
|
||||
var process = new Process();
|
||||
var process = new PrintEmulatorProcess();
|
||||
process.StartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = "python",
|
||||
|
|
@ -180,34 +206,15 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
string fullPath = TestContext.CurrentContext.ResolveProjectPath(4, "Tests", "temp", runName, "Test0", "data", "gcode");
|
||||
|
||||
foreach (string file in Directory.GetFiles(fullPath))
|
||||
foreach (string iniPath in Directory.GetFiles(fullPath, "*.ini"))
|
||||
{
|
||||
if (file.Contains(".ini"))
|
||||
var settings = PrinterSettingsLayer.LoadFromIni(iniPath);
|
||||
|
||||
string currentValue;
|
||||
|
||||
if (settings.TryGetValue(sliceSetting, out currentValue))
|
||||
{
|
||||
|
||||
FileInfo f = new FileInfo(file);
|
||||
string fullName = f.FullName;
|
||||
string[] lines = File.ReadAllLines(fullName);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
|
||||
if (line.Contains(sliceSetting))
|
||||
{
|
||||
line.Trim(' ');
|
||||
string[] settingNameAndValue = line.Split('=');
|
||||
string settingName = settingNameAndValue[0].Trim();
|
||||
string settingValue = string.Empty;
|
||||
if (settingNameAndValue.Length == 2)
|
||||
{
|
||||
settingValue = settingNameAndValue[1].Trim();
|
||||
}
|
||||
|
||||
if (settingValue == expectedValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentValue.Trim() == expectedValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -219,38 +226,40 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
// 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);
|
||||
|
||||
testRunner.WaitForReloadAll(() => testRunner.ClickByName("Yes Button", 5));
|
||||
}
|
||||
|
||||
public static void AddAndSelectPrinter(AutomationRunner testRunner, string make, string model)
|
||||
{
|
||||
string manufacturer = make + " Menu Item";
|
||||
string printer = model + " Menu Item";
|
||||
string printerProfile = String.Format("{0} {1} Profile", make, model);
|
||||
|
||||
testRunner.ClickByName("Printers... Menu", 2);
|
||||
testRunner.Wait(.2);
|
||||
|
||||
testRunner.ClickByName("Add New Printer... Menu Item", 2);
|
||||
testRunner.Wait(.2);
|
||||
|
||||
/* This prompt is no longer shown and causes a 2 second delay. Remove this block once confirmed
|
||||
testRunner.ClickByName("Connection Wizard Skip Sign In Button", 2);
|
||||
testRunner.Wait(.2); */
|
||||
|
||||
testRunner.ClickByName("Select Make", 2);
|
||||
|
||||
testRunner.Wait(.2);
|
||||
testRunner.Type(make);
|
||||
|
||||
testRunner.ClickByName(manufacturer, 2);
|
||||
testRunner.Type(make);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
testRunner.ClickByName("Select Model", 2);
|
||||
testRunner.Wait(.2);
|
||||
|
||||
testRunner.ClickByName(printer, 2);
|
||||
testRunner.ClickByName(model + " Menu Item", 2);
|
||||
testRunner.Wait(.2);
|
||||
|
||||
testRunner.ClickByName("Save & Continue Button", 2);
|
||||
testRunner.Wait(2);
|
||||
|
||||
testRunner.WaitForName("Cancel Wizard Button", 3);
|
||||
testRunner.ClickByName("Cancel Wizard Button", 2);
|
||||
testRunner.Wait(1);
|
||||
}
|
||||
|
|
@ -332,7 +341,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
return ApplicationController.Instance.CurrentLibraryDataView.CurrentLibraryProvider;
|
||||
}
|
||||
|
||||
public static bool NavigateToFolder(AutomationRunner testRunner, string libraryRowItemName)
|
||||
public static bool NavigateToFolder(this AutomationRunner testRunner, string libraryRowItemName)
|
||||
{
|
||||
bool goodNavigate = true;
|
||||
|
||||
|
|
@ -347,19 +356,33 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
return goodNavigate;
|
||||
}
|
||||
|
||||
public static AutomationTesterHarness RunTest(
|
||||
Action<AutomationTesterHarness> testToRun,
|
||||
public static async Task RunTest(
|
||||
AutomationTest testMethod,
|
||||
string staticDataPathOverride = null,
|
||||
double maxTimeToRun = 60,
|
||||
QueueTemplate queueItemFolderToAdd = QueueTemplate.None,
|
||||
int overrideWidth = -1, int overrideHeight = -1)
|
||||
int overrideWidth = -1,
|
||||
int overrideHeight = -1,
|
||||
string defaultTestImages = null)
|
||||
{
|
||||
// Walk back a step in the stack and output the callers name
|
||||
StackTrace st = new StackTrace(false);
|
||||
Debug.WriteLine("\r\n ***** Running automation test: {0} {1} ", st.GetFrames().Skip(1).First().GetMethod().Name, DateTime.Now);
|
||||
|
||||
if (staticDataPathOverride == null)
|
||||
{
|
||||
// Popping one directory above MatterControl, then back down into MatterControl ensures this works in MCCentral as well and MatterControl
|
||||
staticDataPathOverride = TestContext.CurrentContext.ResolveProjectPath(5, "MatterControl", "StaticData");
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
string outputDirectory = "Debug";
|
||||
#else
|
||||
string outputDirectory = "Release";
|
||||
#endif
|
||||
|
||||
Environment.CurrentDirectory = TestContext.CurrentContext.ResolveProjectPath(5, "MatterControl", "bin", outputDirectory);
|
||||
|
||||
#if !__ANDROID__
|
||||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new FileSystemStaticData(staticDataPathOverride);
|
||||
|
|
@ -373,8 +396,16 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
MatterControlUtilities.AddItemsToQueue(queueTemplateDirectory);
|
||||
}
|
||||
|
||||
if (defaultTestImages == null)
|
||||
{
|
||||
defaultTestImages = TestContext.CurrentContext.ResolveProjectPath(4, "Tests", "TestData", "TestImages");
|
||||
}
|
||||
|
||||
MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(overrideWidth, overrideHeight);
|
||||
return AutomationTesterHarness.ShowWindowAndExecuteTests(matterControlWindow, testToRun, maxTimeToRun);
|
||||
|
||||
var config = TestAutomationConfig.Load();
|
||||
|
||||
await AutomationRunner.ShowWindowAndExecuteTests(matterControlWindow, testMethod, maxTimeToRun, defaultTestImages, config.AutomationInputType);
|
||||
}
|
||||
|
||||
public static void LibraryAddSelectionToQueue(AutomationRunner testRunner)
|
||||
|
|
@ -424,15 +455,15 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
}
|
||||
|
||||
public static void SwitchToAdvancedSettings(AutomationRunner testRunner, AutomationTesterHarness resultsHarness)
|
||||
public static void SwitchToAdvancedSettings(AutomationRunner testRunner)
|
||||
{
|
||||
if (testRunner.NameExists("SettingsAndControls"))
|
||||
{
|
||||
testRunner.ClickByName("SettingsAndControls", 1);
|
||||
testRunner.Wait(.5);
|
||||
}
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("User Level Dropdown", 1), "Click Settings Mode dropdown");
|
||||
resultsHarness.AddTestResult(testRunner.ClickByName("Advanced Menu Item", 1), "Click 'Advanced' settings");
|
||||
testRunner.ClickByName("User Level Dropdown", 1);
|
||||
testRunner.ClickByName("Advanced Menu Item", 1);
|
||||
testRunner.Wait(.5);
|
||||
}
|
||||
}
|
||||
|
|
@ -466,6 +497,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
/// </summary>
|
||||
public string Printer { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public AutomationRunner.InputType AutomationInputType { get; set; } = AutomationRunner.InputType.Native;
|
||||
|
||||
public static TestAutomationConfig Load()
|
||||
{
|
||||
TestAutomationConfig config = null;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
{
|
||||
class PrinterChooserUnitTests
|
||||
{
|
||||
[Test, Category("FixNeeded" /* Disabled until MCWS production is updated */)]
|
||||
[Test]
|
||||
public void PrinterChooserHonorsWhitelist()
|
||||
{
|
||||
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
|
||||
|
|
@ -63,6 +63,5 @@ namespace MatterControl.Tests.MatterControl
|
|||
Assert.IsTrue(!string.IsNullOrEmpty(expectedItem) && expectedItem == "Esagonò");
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
|
||||
namespace MatterControl.Tests
|
||||
{
|
||||
|
|
@ -101,23 +103,21 @@ namespace MatterControl.Tests
|
|||
}
|
||||
|
||||
#if !__ANDROID__
|
||||
[Test, RequiresSTA, RunInApplicationDomain]
|
||||
public void MatterControlRuns()
|
||||
[Test, Apartment(ApartmentState.STA), RunInApplicationDomain]
|
||||
public async Task MatterControlRuns()
|
||||
{
|
||||
Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner();
|
||||
{
|
||||
MatterControlUtilities.PrepForTestRun(testRunner, MatterControlUtilities.PrepAction.CloseSignInAndPrinterSelect);
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
resultsHarness.AddTestResult(testRunner.NameExists("SettingsAndControls"));
|
||||
Assert.IsTrue(testRunner.NameExists("SettingsAndControls"));
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 200);
|
||||
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
||||
await MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 90);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -18,24 +18,23 @@ namespace MatterControl.Tests.MatterControl
|
|||
[Test]
|
||||
public void CheckIfShouldBeShownParseTests()
|
||||
{
|
||||
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.has_heated_bed, "0" };
|
||||
var profile = GettProfile(settings);
|
||||
var profile = GetProfile(settings);
|
||||
Assert.IsFalse(SliceSettingsWidget.ParseShowString("has_heated_bed", profile, null));
|
||||
Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed", profile, null));
|
||||
}
|
||||
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.has_heated_bed, "1" };
|
||||
var profile = GettProfile(settings);
|
||||
var profile = GetProfile(settings);
|
||||
Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed", profile, null));
|
||||
Assert.IsFalse(SliceSettingsWidget.ParseShowString("!has_heated_bed", profile, null));
|
||||
}
|
||||
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.has_heated_bed, "0", SettingsKey.auto_connect, "0" };
|
||||
var profile = GettProfile(settings);
|
||||
var profile = GetProfile(settings);
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
|
||||
|
|
@ -43,7 +42,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
}
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.has_heated_bed, "0", SettingsKey.auto_connect, "1" };
|
||||
var profile = GettProfile(settings);
|
||||
var profile = GetProfile(settings);
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
|
||||
Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
|
||||
|
|
@ -51,7 +50,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
}
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "0" };
|
||||
var profile = GettProfile(settings);
|
||||
var profile = GetProfile(settings);
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
|
||||
Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
|
||||
|
|
@ -59,7 +58,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
}
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "1" };
|
||||
var profile = GettProfile(settings);
|
||||
var profile = GetProfile(settings);
|
||||
Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
|
||||
|
|
@ -68,7 +67,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "1", SettingsKey.has_fan, "1" };
|
||||
var profile = GettProfile(settings);
|
||||
var profile = GetProfile(settings);
|
||||
Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect&has_fan", profile, null));
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect&!has_fan", profile, null));
|
||||
Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect&has_fan", profile, null));
|
||||
|
|
@ -84,19 +83,19 @@ namespace MatterControl.Tests.MatterControl
|
|||
// percent first layer extrusion width
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.first_layer_extrusion_width, "%150", SettingsKey.nozzle_diameter, ".4" };
|
||||
Assert.AreEqual(GettProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .6, .0001);
|
||||
Assert.AreEqual(GetProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .6, .0001);
|
||||
}
|
||||
|
||||
// absolute first layer extrusion width
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.first_layer_extrusion_width, ".75", SettingsKey.nozzle_diameter, ".4" };
|
||||
Assert.AreEqual(GettProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .75, .0001);
|
||||
Assert.AreEqual(GetProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .75, .0001);
|
||||
}
|
||||
|
||||
// 0 first layer extrusion width
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.first_layer_extrusion_width, "0", SettingsKey.nozzle_diameter, ".4" };
|
||||
Assert.AreEqual(GettProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .4, .0001);
|
||||
Assert.AreEqual(GetProfile(settings).GetValue<double>(SettingsKey.first_layer_extrusion_width), .4, .0001);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,24 +104,24 @@ namespace MatterControl.Tests.MatterControl
|
|||
// normal single
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.extruder_count, "1", SettingsKey.extruders_share_temperature, "0" };
|
||||
Assert.AreEqual(GettProfile(settings).GetValue<int>(SettingsKey.extruder_count), 1);
|
||||
Assert.AreEqual(GetProfile(settings).GetValue<int>(SettingsKey.extruder_count), 1);
|
||||
}
|
||||
|
||||
// normal multiple
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.extruder_count, "2", SettingsKey.extruders_share_temperature, "0" };
|
||||
Assert.AreEqual(GettProfile(settings).GetValue<int>(SettingsKey.extruder_count), 2);
|
||||
Assert.AreEqual(GetProfile(settings).GetValue<int>(SettingsKey.extruder_count), 2);
|
||||
}
|
||||
|
||||
// shared temp
|
||||
{
|
||||
string[] settings = new string[] { SettingsKey.extruder_count, "2", SettingsKey.extruders_share_temperature, "1" };
|
||||
Assert.AreEqual(GettProfile(settings).GetValue<int>(SettingsKey.extruder_count), 1);
|
||||
Assert.AreEqual(GetProfile(settings).GetValue<int>(SettingsKey.extruder_count), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PrinterSettings GettProfile(string[] settings)
|
||||
PrinterSettings GetProfile(string[] settings)
|
||||
{
|
||||
Dictionary<string, string> dictionary = new Dictionary<string, string>();
|
||||
for(int i=0; i<settings.Length; i+=2)
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.4.14350" newVersion="2.6.4.14350" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="2638cd05610744eb" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.4.1.0" newVersion="3.4.1.0" />
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
<packages>
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
|
||||
<package id="NUnit" version="3.4.1" targetFramework="net45" />
|
||||
<package id="NUnit.ApplicationDomain" version="9.0.0.0" targetFramework="net45" />
|
||||
<package id="NUnit.ApplicationDomain" version="10.0.00" targetFramework="net45" />
|
||||
<package id="NUnit3TestAdapter" version="3.4.1" targetFramework="net45" />
|
||||
</packages>
|
||||
|
|
@ -7,6 +7,8 @@ using System.IO;
|
|||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using MatterHackers.Localizations;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -62,7 +64,6 @@ namespace MatterHackers.MatterControl
|
|||
this.ActiveSessionUsername = null;
|
||||
this.ActiveSessionEmail = null;
|
||||
this.ActiveClientToken = null;
|
||||
// this.LastSessionUsername = null;
|
||||
|
||||
ApplicationController.Instance.ChangeCloudSyncStatus(userAuthenticated: false, reason: "Session Cleared".Localize());
|
||||
SessionUpdateTrigger.CallEvents(null, null);
|
||||
|
|
@ -156,5 +157,21 @@ namespace MatterHackers.MatterControl
|
|||
ApplicationSettings.Instance.set($"{ApplicationController.EnvironmentName}LastSessionUsername", value);
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string FileSystemSafeUserName => MakeValidFileName(this.ActiveSessionUsername);
|
||||
|
||||
private static string MakeValidFileName(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
string invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars()));
|
||||
string invalidRegStr = string.Format(@"([{0}]*\.+$)|([{0}]+)", invalidChars);
|
||||
|
||||
return Regex.Replace(name, invalidRegStr, "_");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue