Extract tests to dedicated assemblies
This commit is contained in:
parent
939bafa214
commit
314496ba7b
21 changed files with 658 additions and 242 deletions
|
|
@ -27,7 +27,6 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
|
@ -45,75 +44,6 @@ namespace MatterHackers.MatterControl.HtmlParsing
|
|||
|
||||
public ElementState CurrentElementState { get { return elementQueue.Peek(); } }
|
||||
|
||||
[Test]
|
||||
public static void TestSplitOnSpacesNotInQuotes()
|
||||
{
|
||||
{
|
||||
string test1 = "one two three";
|
||||
string[] results = SplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "two");
|
||||
Assert.IsTrue(results[2] == "three");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one 'two three' four";
|
||||
string[] results = SplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "'two three'");
|
||||
Assert.IsTrue(results[2] == "four");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one 'two three''four' five";
|
||||
string[] results = SplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "'two three''four'");
|
||||
Assert.IsTrue(results[2] == "five");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one \"two three\" four";
|
||||
string[] results = SplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "\"two three\"");
|
||||
Assert.IsTrue(results[2] == "four");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one \"'two' three\" four";
|
||||
string[] results = SplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "\"'two' three\"");
|
||||
Assert.IsTrue(results[2] == "four");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one '\"two\" three' four";
|
||||
string[] results = SplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "'\"two\" three'");
|
||||
Assert.IsTrue(results[2] == "four");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "<img src=\"https://lh6.ggpht.com/FMF8JYN2rGgceXpkG1GTUlmS4Z7qfron0Fm9NDi1Oqxg_TmDLMIThQuvnBXHhJD38_GK3RSnxFCX28Cp5ekxRhzx6g=s243\" alt=\"White PLA Filament - 1.75mm\" title=\"White PLA Filament - 1.75mm\" style=\"width:243px;height:183px;\">";
|
||||
string[] results = SplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 5);
|
||||
Assert.IsTrue(results[0] == "<img");
|
||||
Assert.IsTrue(results[1] == "src=\"https://lh6.ggpht.com/FMF8JYN2rGgceXpkG1GTUlmS4Z7qfron0Fm9NDi1Oqxg_TmDLMIThQuvnBXHhJD38_GK3RSnxFCX28Cp5ekxRhzx6g=s243\"");
|
||||
Assert.IsTrue(results[2] == "alt=\"White PLA Filament - 1.75mm\"");
|
||||
Assert.IsTrue(results[3] == "title=\"White PLA Filament - 1.75mm\"");
|
||||
Assert.IsTrue(results[4] == "style=\"width:243px;height:183px;\">");
|
||||
}
|
||||
}
|
||||
|
||||
public static string UrlDecode(string htmlContent)
|
||||
{
|
||||
string decoded = htmlContent.Replace("™", "™");
|
||||
|
|
@ -247,8 +177,6 @@ namespace MatterHackers.MatterControl.HtmlParsing
|
|||
|
||||
private void ParseTypeContent(int openPosition, int closePosition, string htmlContent)
|
||||
{
|
||||
TestSplitOnSpacesNotInQuotes();
|
||||
|
||||
string text = htmlContent.Substring(openPosition, closePosition - openPosition);
|
||||
ElementState currentElementState = new ElementState(elementQueue.Peek());
|
||||
int afterTypeName = typeNameEndRegex.Match(htmlContent, openPosition).Index;
|
||||
|
|
|
|||
|
|
@ -226,8 +226,6 @@
|
|||
<Compile Include="SlicerConfiguration\SlicerMapping\EngineMappingMatterSlice.cs" />
|
||||
<Compile Include="SlicerConfiguration\Slicing\SliceLayer.cs" />
|
||||
<Compile Include="SlicerConfiguration\Slicing\SliceLayers.cs" />
|
||||
<Compile Include="SlicerConfiguration\Slicing\Tests\SliceLayersTests.cs" />
|
||||
<Compile Include="SlicerConfiguration\Slicing\Tests\UnitTests.cs" />
|
||||
<Compile Include="Utilities\FieldValidation.cs" />
|
||||
<Compile Include="PartPreviewWindow\CreateDiscreteMeshes.cs" />
|
||||
<Compile Include="CustomWidgets\EditableNumberDisplay.cs" />
|
||||
|
|
@ -245,8 +243,6 @@
|
|||
<Compile Include="SlicerConfiguration\SlicerMapping\EngineMappingSlic3r.cs" />
|
||||
<Compile Include="SlicerConfiguration\SlicerMapping\MappingClasses.cs" />
|
||||
<Compile Include="SlicerConfiguration\SlicerMapping\EngineMapingBase.cs" />
|
||||
<Compile Include="Testing\ReleaseTests.cs" />
|
||||
<Compile Include="Testing\TestingDispatch.cs" />
|
||||
<Compile Include="ApplicationView\WidescreenPanel.cs" />
|
||||
<Compile Include="ConfigurationPage\PrintLeveling\PrintLevelPages.cs" />
|
||||
<Compile Include="AboutPage\ContactForm.cs" />
|
||||
|
|
@ -358,9 +354,6 @@
|
|||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Posix" />
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>Submodules\agg-sharp\AggTests\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK">
|
||||
<HintPath>Submodules\agg-sharp\PlatformWin32\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
|
|||
|
|
@ -93,11 +93,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfInstaller", "PrinterDriv
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Nat", "..\CloudServicesPlugin\Mono.Nat\Mono.Nat.csproj", "{F5D74163-145F-47BF-83DC-D0E07249C6CA}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{FBE6DF29-85A9-4A8B-B739-35BE4CA0A9B7}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{9EA7B05F-E58F-44DF-BD33-EEA28553D220}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.nuget\NuGet.Config = .nuget\NuGet.Config
|
||||
.nuget\NuGet.exe = .nuget\NuGet.exe
|
||||
.nuget\NuGet.targets = .nuget\NuGet.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrintNotifications", "..\CloudServicesPlugin\PrintNotifications\PrintNotifications.csproj", "{291CD87C-2C58-4369-9D85-238C7EB31542}"
|
||||
|
|
@ -120,6 +121,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextCreator", "TextCreator\
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataConverters3D", "Submodules\agg-sharp\DataConverters3D\DataConverters3D.csproj", "{04667764-DC7B-4B95-AEF6-B4E6C87A54E9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterControl.Tests", "Tests\MatterControl.Tests\MatterControl.Tests.csproj", "{E1455E5C-127C-4282-8CC5-452C300E91D0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agg.Tests", "Submodules\agg-sharp\Tests\Agg.Tests\Agg.Tests.csproj", "{195CBE56-E654-437B-AB05-3BE1B9452497}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterSlice.Tests", "Submodules\MatterSlice\Tests\MatterSlice.Tests\MatterSlice.Tests.csproj", "{8CD15B23-D30F-470E-99BA-9276FB7CABD4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -1070,6 +1077,78 @@ Global
|
|||
{04667764-DC7B-4B95-AEF6-B4E6C87A54E9}.Release64|x64.ActiveCfg = Release64|x64
|
||||
{04667764-DC7B-4B95-AEF6-B4E6C87A54E9}.Release64|x64.Build.0 = Release64|x64
|
||||
{04667764-DC7B-4B95-AEF6-B4E6C87A54E9}.Release64|x86.ActiveCfg = Release64|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug64|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug64|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug64|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug64|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug64|x64.ActiveCfg = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Debug64|x86.ActiveCfg = Debug|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release64|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release64|Any CPU.Build.0 = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release64|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release64|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release64|x64.ActiveCfg = Release|Any CPU
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0}.Release64|x86.ActiveCfg = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug64|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug64|Any CPU.Build.0 = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug64|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug64|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug64|x64.ActiveCfg = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Debug64|x86.ActiveCfg = Debug|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release64|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release64|Any CPU.Build.0 = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release64|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release64|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release64|x64.ActiveCfg = Release|Any CPU
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497}.Release64|x86.ActiveCfg = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug64|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug64|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug64|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug64|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug64|x64.ActiveCfg = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Debug64|x86.ActiveCfg = Debug|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release64|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release64|Any CPU.Build.0 = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release64|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release64|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release64|x64.ActiveCfg = Release|Any CPU
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4}.Release64|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -1106,6 +1185,9 @@ Global
|
|||
{002B1D12-4DBB-4ECF-B481-5EBECBC1666E} = {8F938919-F383-4BAE-BB95-13AB2A94088E}
|
||||
{F49EC1DD-D645-4709-8667-B57318AF67B0} = {32E5B656-D6DF-415E-9E7E-D03F1D8C3A8A}
|
||||
{04667764-DC7B-4B95-AEF6-B4E6C87A54E9} = {2AB9B589-5C98-4C05-BBEA-F97DAE168EAB}
|
||||
{E1455E5C-127C-4282-8CC5-452C300E91D0} = {FBE6DF29-85A9-4A8B-B739-35BE4CA0A9B7}
|
||||
{195CBE56-E654-437B-AB05-3BE1B9452497} = {FBE6DF29-85A9-4A8B-B739-35BE4CA0A9B7}
|
||||
{8CD15B23-D30F-470E-99BA-9276FB7CABD4} = {FBE6DF29-85A9-4A8B-B739-35BE4CA0A9B7}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = MatterControl.csproj
|
||||
|
|
|
|||
|
|
@ -99,11 +99,6 @@ namespace MatterHackers.MatterControl
|
|||
string commandUpper = command.ToUpper();
|
||||
switch (commandUpper)
|
||||
{
|
||||
case "TEST":
|
||||
Testing.TestingDispatch testDispatch = new Testing.TestingDispatch();
|
||||
testDispatch.RunTests();
|
||||
return;
|
||||
|
||||
case "FORCE_SOFTWARE_RENDERING":
|
||||
forceSofwareRendering = true;
|
||||
GL.ForceSoftwareRendering();
|
||||
|
|
@ -259,13 +254,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
#endif
|
||||
|
||||
MatterHackers.PolygonMesh.UnitTests.UnitTests.Run();
|
||||
MatterHackers.RayTracer.UnitTests.Run();
|
||||
MatterHackers.Agg.Tests.UnitTests.Run();
|
||||
MatterHackers.VectorMath.Tests.UnitTests.Run();
|
||||
MatterHackers.Agg.UI.Tests.UnitTests.Run();
|
||||
MatterHackers.MatterControl.Slicing.Tests.UnitTests.Run();
|
||||
|
||||
// you can turn this on to debug some bounds issues
|
||||
//GuiWidget.DebugBoundsUnderMouse = true;
|
||||
}
|
||||
|
|
@ -637,5 +625,33 @@ namespace MatterHackers.MatterControl
|
|||
base.OnClosing(out CancelClose);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AssertDebugNotDefined()
|
||||
{
|
||||
#if DEBUG
|
||||
throw new Exception("DEBUG is defined and should not be!");
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void CheckKnownAssemblyConditionalCompSymbols()
|
||||
{
|
||||
MatterControlApplication.AssertDebugNotDefined();
|
||||
MatterHackers.GCodeVisualizer.GCodeFile.AssertDebugNotDefined();
|
||||
MatterHackers.Agg.Graphics2D.AssertDebugNotDefined();
|
||||
MatterHackers.Agg.UI.SystemWindow.AssertDebugNotDefined();
|
||||
ClipperLib.Clipper.AssertDebugNotDefined();
|
||||
MatterHackers.Csg.Utilities.AssertDebugNotDefined();
|
||||
MatterHackers.Agg.ImageProcessing.InvertLightness.AssertDebugNotDefined();
|
||||
MatterHackers.Localizations.TranslationMap.AssertDebugNotDefined();
|
||||
MatterHackers.MarchingSquares.MarchingSquaresByte.AssertDebugNotDefined();
|
||||
MatterHackers.MatterControl.PluginSystem.MatterControlPlugin.AssertDebugNotDefined();
|
||||
MatterHackers.MatterSlice.MatterSlice.AssertDebugNotDefined();
|
||||
MatterHackers.MeshVisualizer.MeshViewerWidget.AssertDebugNotDefined();
|
||||
MatterHackers.RenderOpenGl.GLMeshTrianglePlugin.AssertDebugNotDefined();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
namespace MatterHackers.MatterControl.Slicing.Tests
|
||||
{
|
||||
public static class UnitTests
|
||||
{
|
||||
private static bool ranTests = false;
|
||||
|
||||
public static bool RanTests { get { return ranTests; } }
|
||||
|
||||
public static void Run()
|
||||
{
|
||||
if (!ranTests)
|
||||
{
|
||||
SliceLayersTests layerTests = new SliceLayersTests();
|
||||
layerTests.SliceLayersGeneratingCorrectSegmets();
|
||||
|
||||
ranTests = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 183204caa9035f392c3fb09f4ebbec01d0fb15c9
|
||||
Subproject commit 108fbbc8e6f757c089063114782d47ad6f03a70b
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit e2537da2f53c63843ce8349ed81bfffc87e9f214
|
||||
Subproject commit 1b04e552d6edc20c090431d02b9c6a9b1e2325bf
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace MatterHackers.MatterControl.Testing
|
||||
{
|
||||
public static class ReleaseTests
|
||||
{
|
||||
public static void AssertDebugNotDefined()
|
||||
{
|
||||
#if DEBUG
|
||||
throw new Exception("DEBUG is defined and should not be!");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MatterHackers.MatterControl.Testing
|
||||
{
|
||||
public class TestingDispatch
|
||||
{
|
||||
private bool hadErrors = false;
|
||||
|
||||
public bool HadErrors { get { return hadErrors; } }
|
||||
|
||||
private string errorLogFileName = null;
|
||||
|
||||
public TestingDispatch()
|
||||
{
|
||||
string exePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
errorLogFileName = Path.Combine(exePath, "ErrorLog.txt");
|
||||
string firstLine = string.Format("MatterControl Errors: {0:yyyy-MM-dd hh:mm:ss tt}", DateTime.Now);
|
||||
using (StreamWriter file = new StreamWriter(errorLogFileName))
|
||||
{
|
||||
file.WriteLine(firstLine);
|
||||
}
|
||||
}
|
||||
|
||||
public void RunTests()
|
||||
{
|
||||
try { ReleaseTests.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.GCodeVisualizer.GCodeFile.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.Agg.Graphics2D.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.Agg.UI.SystemWindow.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { ClipperLib.Clipper.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.Csg.CSGTests.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.Agg.ImageProcessing.InvertLightness.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.Localizations.TranslationMap.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.MarchingSquares.MarchingSquaresByte.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.MatterControl.PluginSystem.MatterControlPlugin.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.MatterSlice.MatterSlice.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.MeshVisualizer.MeshViewerWidget.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
try { MatterHackers.RenderOpenGl.GLMeshTrianglePlugin.AssertDebugNotDefined(); }
|
||||
catch (Exception e) { DumpException(e); }
|
||||
|
||||
if (!HadErrors)
|
||||
{
|
||||
File.Delete(errorLogFileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void DumpException(Exception e)
|
||||
{
|
||||
hadErrors = true;
|
||||
using (StreamWriter w = File.AppendText(errorLogFileName))
|
||||
{
|
||||
w.WriteLine(e.Message);
|
||||
w.Write(e.StackTrace);
|
||||
w.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
114
Tests/MatterControl.Tests/MatterControl.Tests.csproj
Normal file
114
Tests/MatterControl.Tests/MatterControl.Tests.csproj
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E1455E5C-127C-4282-8CC5-452C300E91D0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MatterControl.Tests</RootNamespace>
|
||||
<AssemblyName>MatterControl.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.core, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.core.interfaces, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.util, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.VisualStudio.TestAdapter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4cb40d35494691ac, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MatterControl\HtmlParser.cs" />
|
||||
<Compile Include="MatterControl\ReleaseBuildTests.cs" />
|
||||
<Compile Include="MatterControl\SliceLayersTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\MatterControl.csproj">
|
||||
<Project>{0b8d6f56-bd7f-4426-b858-d9292b084656}</Project>
|
||||
<Name>MatterControl</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\agg\Agg.csproj">
|
||||
<Project>{657dbc6d-c3ea-4398-a3fa-ddb73c14f71b}</Project>
|
||||
<Name>Agg</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\Gui\Gui.csproj">
|
||||
<Project>{74f6bb6c-9d02-4512-a59a-21940e35c532}</Project>
|
||||
<Name>Gui</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\PlatformAbstract\PlatformAbstract.csproj">
|
||||
<Project>{3e4aaba8-d85f-4922-88c6-5c1b2d2308fb}</Project>
|
||||
<Name>PlatformAbstract</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\PlatformWin32\PlatformWin32.csproj">
|
||||
<Project>{670bddff-927b-425d-9dd1-22acb14356eb}</Project>
|
||||
<Name>PlatformWin32</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\PolygonMesh\PolygonMesh.csproj">
|
||||
<Project>{86f6aaf2-9b50-40b8-a427-1897d76471c5}</Project>
|
||||
<Name>PolygonMesh</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\VectorMath\VectorMath.csproj">
|
||||
<Project>{d3e41b4e-bfbb-44ca-94c8-95c00f754fdd}</Project>
|
||||
<Name>VectorMath</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
117
Tests/MatterControl.Tests/MatterControl/HtmlParser.cs
Normal file
117
Tests/MatterControl.Tests/MatterControl/HtmlParser.cs
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MatterHackers.MatterControl.HtmlParsing
|
||||
{
|
||||
[TestFixture, Category("MatterControl.HtmlParsing")]
|
||||
public class HtmlParserTests
|
||||
{
|
||||
|
||||
private static string[] HtmlParserSplitOnSpacesNotInQuotes(string methodParameter)
|
||||
{
|
||||
MethodInfo method = typeof(HtmlParser).GetMethod("SplitOnSpacesNotInQuotes", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
return method.Invoke(null, parameters: new object[] { methodParameter }) as string[];
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestSplitOnSpacesNotInQuotes()
|
||||
{
|
||||
{
|
||||
string test1 = "one two three";
|
||||
string[] results = HtmlParserSplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "two");
|
||||
Assert.IsTrue(results[2] == "three");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one 'two three' four";
|
||||
string[] results = HtmlParserSplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "'two three'");
|
||||
Assert.IsTrue(results[2] == "four");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one 'two three''four' five";
|
||||
string[] results = HtmlParserSplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "'two three''four'");
|
||||
Assert.IsTrue(results[2] == "five");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one \"two three\" four";
|
||||
string[] results = HtmlParserSplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "\"two three\"");
|
||||
Assert.IsTrue(results[2] == "four");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one \"'two' three\" four";
|
||||
string[] results = HtmlParserSplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "\"'two' three\"");
|
||||
Assert.IsTrue(results[2] == "four");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "one '\"two\" three' four";
|
||||
string[] results = HtmlParserSplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 3);
|
||||
Assert.IsTrue(results[0] == "one");
|
||||
Assert.IsTrue(results[1] == "'\"two\" three'");
|
||||
Assert.IsTrue(results[2] == "four");
|
||||
}
|
||||
|
||||
{
|
||||
string test1 = "<img src=\"https://lh6.ggpht.com/FMF8JYN2rGgceXpkG1GTUlmS4Z7qfron0Fm9NDi1Oqxg_TmDLMIThQuvnBXHhJD38_GK3RSnxFCX28Cp5ekxRhzx6g=s243\" alt=\"White PLA Filament - 1.75mm\" title=\"White PLA Filament - 1.75mm\" style=\"width:243px;height:183px;\">";
|
||||
string[] results = HtmlParserSplitOnSpacesNotInQuotes(test1);
|
||||
Assert.IsTrue(results.Length == 5);
|
||||
Assert.IsTrue(results[0] == "<img");
|
||||
Assert.IsTrue(results[1] == "src=\"https://lh6.ggpht.com/FMF8JYN2rGgceXpkG1GTUlmS4Z7qfron0Fm9NDi1Oqxg_TmDLMIThQuvnBXHhJD38_GK3RSnxFCX28Cp5ekxRhzx6g=s243\"");
|
||||
Assert.IsTrue(results[2] == "alt=\"White PLA Filament - 1.75mm\"");
|
||||
Assert.IsTrue(results[3] == "title=\"White PLA Filament - 1.75mm\"");
|
||||
Assert.IsTrue(results[4] == "style=\"width:243px;height:183px;\">");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
72
Tests/MatterControl.Tests/MatterControl/ReleaseBuildTests.cs
Normal file
72
Tests/MatterControl.Tests/MatterControl/ReleaseBuildTests.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
using MatterHackers.MatterControl;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace MatterControl.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ReleaseBuildTests
|
||||
{
|
||||
private static Type debuggableAttribute = typeof(DebuggableAttribute);
|
||||
|
||||
[Test, Category("ReleaseQuality")]
|
||||
public void MatterControlAssemblyIsOptimized()
|
||||
{
|
||||
#if(!DEBUG)
|
||||
IsAssemblyOptimized(Assembly.Load("MatterControl, Culture=neutral, PublicKeyToken=null"));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test, Category("ReleaseQuality")]
|
||||
public void MatterControlDependenciesAreOptimized()
|
||||
{
|
||||
#if(!DEBUG)
|
||||
var matterControl = Assembly.Load("MatterControl, Culture=neutral, PublicKeyToken=null");
|
||||
|
||||
// Loop over all referenced assemblies to verify they are optimized and lack (symbols and Debug compile flag)
|
||||
foreach(var assemblyName in matterControl.GetReferencedAssemblies())
|
||||
{
|
||||
var assembly = Assembly.Load(assemblyName.FullName);
|
||||
var firstNamespace = assembly.GetTypes().First().Namespace;
|
||||
|
||||
// Only validate our assemblies
|
||||
if (firstNamespace.Contains("MatterHackers") || firstNamespace.Contains("MatterControl"))
|
||||
{
|
||||
IsAssemblyOptimized(assembly);
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine(string.Join("\r\n", matterControl.GetReferencedAssemblies().Select(a => a.Name).ToArray()));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test, Category("ReleaseQuality")]
|
||||
public void ClassicDebugComplicationFlagTests()
|
||||
{
|
||||
#if(!DEBUG)
|
||||
MatterControlApplication.CheckKnownAssemblyConditionalCompSymbols();
|
||||
#endif
|
||||
}
|
||||
|
||||
private static void IsAssemblyOptimized(Assembly assm)
|
||||
{
|
||||
var matchedAttributes = assm.GetCustomAttributes(debuggableAttribute, false);
|
||||
var assemblyName = assm.GetName();
|
||||
|
||||
if (matchedAttributes.Count() == 0)
|
||||
{
|
||||
Assert.Inconclusive("Symbols likely missing from Release build: " + assemblyName.FullName + ". \r\n\r\nTo resolve the issue, switch Project Properties -> Build -> Advanced -> Debug Info property to 'pdb-only'");
|
||||
}
|
||||
|
||||
var debuggable = matchedAttributes.First() as DebuggableAttribute;
|
||||
Assert.IsFalse(debuggable.IsJITOptimizerDisabled, "Referenced assembly is not optimized: " + assemblyName.Name);
|
||||
Assert.IsFalse(debuggable.IsJITTrackingEnabled, "Referenced assembly is has symbols: " + assemblyName.Name);
|
||||
Console.WriteLine("Assembly is optimized: " + assemblyName.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ using System.IO;
|
|||
|
||||
namespace MatterHackers.MatterControl.Slicing.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
[TestFixture, Category("MatterControl.Slicing")]
|
||||
public class SliceLayersTests
|
||||
{
|
||||
[Test]
|
||||
|
|
@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.Slicing.Tests
|
|||
return;
|
||||
}
|
||||
|
||||
string pathToMesh = Path.Combine("..", "..", "TestMeshes", "SliceLayers");
|
||||
string pathToMesh = Path.Combine("..", "..", "..", "TestData", "TestMeshes", "SliceLayers");
|
||||
string meshFileName = Path.Combine(pathToMesh, "Box20x20x10.stl");
|
||||
Mesh cubeMesh = StlProcessing.Load(meshFileName);
|
||||
|
||||
36
Tests/MatterControl.Tests/Properties/AssemblyInfo.cs
Normal file
36
Tests/MatterControl.Tests/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MatterControl.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("MatterHackers, Inc.")]
|
||||
[assembly: AssemblyProduct("MatterControl.Tests")]
|
||||
[assembly: AssemblyCopyright("2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("ecbee48f-eea8-4700-9635-6d8513f8ffcb")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
5
Tests/MatterControl.Tests/packages.config
Normal file
5
Tests/MatterControl.Tests/packages.config
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
||||
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" />
|
||||
</packages>
|
||||
8
Tests/TestRunner/MatterControl.nunit
Normal file
8
Tests/TestRunner/MatterControl.nunit
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<NUnitProject>
|
||||
<Settings activeconfig="Default" processModel="Multiple" domainUsage="Single" />
|
||||
<Config name="Default" binpathtype="Auto" runtimeFramework="v4.0.21006">
|
||||
<assembly path="..\MatterControl.Tests\bin\Debug\MatterControl.Tests.dll" />
|
||||
<assembly path="..\..\Submodules\agg-sharp\Tests\Agg.Tests\bin\Debug\Agg.Tests.dll" />
|
||||
<assembly path="..\..\Submodules\MatterSlice\Tests\MatterSlice.Tests\bin\Debug\MatterSlice.Tests.dll" />
|
||||
</Config>
|
||||
</NUnitProject>
|
||||
80
Tests/TestRunner/TestRunner/Program.cs
Normal file
80
Tests/TestRunner/TestRunner/Program.cs
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
|
||||
namespace TestRunner
|
||||
{
|
||||
class Program
|
||||
{
|
||||
private const string outputFileName = "result.xml";
|
||||
|
||||
// Currently just running from the bin folder
|
||||
private const string nunitPath = "NUnit-2.6.4";
|
||||
//private const string nunitPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "NUnit 2.6.3");
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Uri siteBaseUri = new Uri(args[0]);
|
||||
|
||||
//SimulateZipPost();
|
||||
//return;
|
||||
|
||||
if (File.Exists(outputFileName))
|
||||
{
|
||||
File.Delete(outputFileName);
|
||||
}
|
||||
|
||||
string binPath = null;
|
||||
|
||||
if (Directory.Exists(nunitPath))
|
||||
{
|
||||
binPath = Path.Combine(nunitPath, "bin\\nunit-console-x86.exe");
|
||||
}
|
||||
|
||||
// Run the unit tests
|
||||
if (!string.IsNullOrWhiteSpace(binPath) && File.Exists(binPath))
|
||||
{
|
||||
Process process = new Process();
|
||||
process.StartInfo.Arguments = string.Format(
|
||||
"{0} /xml:{1} /noshadow:true",
|
||||
Path.GetFullPath("../../../MatterControl.nunit"),
|
||||
Path.GetFullPath(outputFileName));
|
||||
process.StartInfo.FileName = binPath;
|
||||
process.StartInfo.UseShellExecute = true;
|
||||
process.Start();
|
||||
|
||||
process.WaitForExit();
|
||||
}
|
||||
|
||||
// Post the results
|
||||
if (File.Exists(outputFileName))
|
||||
{
|
||||
var uri = new Uri(siteBaseUri, "testresults/create/");
|
||||
|
||||
// Post the file to the server
|
||||
var client = new WebClient();
|
||||
var bytes = client.UploadFile(uri, outputFileName);
|
||||
|
||||
string reportID = UTF8Encoding.UTF8.GetString(bytes);
|
||||
|
||||
// Launch the results
|
||||
Process.Start(new Uri(siteBaseUri, "testresults/details/" + reportID).AbsoluteUri);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SimulateZipPost(Uri baseUri)
|
||||
{
|
||||
var uri = new Uri(baseUri, "testresults/createfromzip/");
|
||||
|
||||
// Post the file to the server
|
||||
var client = new WebClient();
|
||||
var bytes = client.UploadFile(uri, @"E:\sources\websites\matterdata\TestResult4.zip");
|
||||
|
||||
string reportID = System.Text.UTF8Encoding.UTF8.GetString(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Tests/TestRunner/TestRunner/Properties/AssemblyInfo.cs
Normal file
36
Tests/TestRunner/TestRunner/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TestRunner")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestRunner")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("053add9e-15c5-4ca2-8669-88889e28ef32")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
55
Tests/TestRunner/TestRunner/TestRunner.csproj
Normal file
55
Tests/TestRunner/TestRunner/TestRunner.csproj
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{33677C3F-145C-476B-A882-2A44179CDECB}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestRunner</RootNamespace>
|
||||
<AssemblyName>TestRunner</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
20
Tests/TestRunner/TestRunner/TestRunner.sln
Normal file
20
Tests/TestRunner/TestRunner/TestRunner.sln
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRunner", "TestRunner.csproj", "{33677C3F-145C-476B-A882-2A44179CDECB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{33677C3F-145C-476B-A882-2A44179CDECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{33677C3F-145C-476B-A882-2A44179CDECB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{33677C3F-145C-476B-A882-2A44179CDECB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{33677C3F-145C-476B-A882-2A44179CDECB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Loading…
Add table
Add a link
Reference in a new issue