Commits

Lars Brubaker  committed 4e5da5b

Fixe a gcode parsing bug.
Building some TextEdit unit tests.
Building docs for some dlls.

  • Participants
  • Parent commits 8c21a05

Comments (0)

Files changed (5)

File Csg/Csg.csproj

     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
     <PlatformTarget>AnyCPU</PlatformTarget>
-    <DocumentationFile>
-    </DocumentationFile>
+    <DocumentationFile>bin\Release\MatterHackers.Csg.XML</DocumentationFile>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="Microsoft.CSharp" />

File Csg/Solids/LinearExtrude.cs

             }
         }
 
+        /// <summary>
+        /// The constructor takes an array of doubles as the input to the polygon to extrude.
+        /// </summary>
+        /// <param name="points">Pairs of double values that will be used as the coordinates of the polygon points.</param>
+        /// <param name="height"></param>
+        /// <param name="alignment"></param>
+        /// <param name="twistRadians"></param>
+        /// <param name="name"></param>
         public LinearExtrude(double[] points, double height, Alignment alignment = Alignment.z, double twistRadians = 0, string name = "")
         {
             if ((points.Length % 2) != 0)
             }
         }
 
+        /// <summary>
+        /// The constructor takes an array of Vector2s as the input to the polygon to extrude.
+        /// </summary>
+        /// <param name="points"></param>
+        /// <param name="height"></param>
+        /// <param name="alignment"></param>
+        /// <param name="twistRadians"></param>
+        /// <param name="name"></param>
         public LinearExtrude(Vector2[] points, double height, Alignment alignment = Alignment.z, double twistRadians = 0, string name = "")
             : base(name)
         {

File Gui/UnitTests.cs

         [Test]
         public void ButtonClick()
         {
+            gotClick = false;
             RectangleWidget container = new RectangleWidget();
             container.LocalBounds = new rect_d(0, 0, 200, 200);
             Button button = new Button(100, 100, "Test");
         [Test]
         public void WindowBlocksButtonClick()
         {
+            gotClick = false;
             RectangleWidget container = new RectangleWidget();
             container.LocalBounds = new rect_d(0, 0, 200, 200);
             Button button = new Button(100, 100, "Test");
         }
     }
 
+    public class TextEditTests
+    {
+        public void SendKey(Keys keyDown, char keyPressed, GUIWidget reciever)
+        {
+            KeyEventArgs keyDownEvent = new KeyEventArgs(keyDown);
+            reciever.OnKeyDown(keyDownEvent);
+            if (!keyDownEvent.SuppressKeyPress)
+            {
+                KeyPressEventArgs keyPressEvent = new KeyPressEventArgs(keyPressed);
+                reciever.OnKeyPress(keyPressEvent);
+            }
+        }
+
+        [Test]
+        public void TextEditGetsInput()
+        {
+            RectangleWidget container = new RectangleWidget();
+            container.LocalBounds = new rect_d(0, 0, 200, 200);
+            TextEditWidget editField1 = new TextEditWidget("", 0, 0, pixelWidth: 20);
+            container.AddChild(editField1);
+
+            container.OnLayout();
+
+            Assert.IsTrue(editField1.Text == "");
+            SendKey(Keys.D, 'd', container);
+            Assert.IsTrue(editField1.Text == "", "It should still empyt as it has not been selected.");
+            Assert.IsTrue(editField1.Text == "");
+
+            // select it
+            container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
+            container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
+            SendKey(Keys.D, 'd', container);
+            Assert.IsTrue(editField1.Text == "d", "It should have a d it it.");
+        }
+    }
+
     public static class UnitTests
     {
         static bool ranTests = false;
                 RenderTests renderTests = new RenderTests();
                 renderTests.DoubleBufferTests();
 
-                (new ButtonTests()).ButtonClick();
-                (new ButtonTests()).WindowBlocksButtonClick();
+                ButtonTests buttonTests = new ButtonTests();
+                buttonTests.ButtonClick();
+                buttonTests.WindowBlocksButtonClick();
+
+                TextEditTests textEditTests = new TextEditTests();
+                textEditTests.TextEditGetsInput();
             }
         }
     }

File VectorMath/VectorMath.csproj

     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
     <PlatformTarget>AnyCPU</PlatformTarget>
+    <DocumentationFile>bin\Release\MatterHackers.VectorMath.XML</DocumentationFile>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="nunit.framework">

File examples/GCodeVisualizer/GCodeModel.cs

         void ParseGLine(string lineString, FabricationMachineState machineState)
         {
             string[] splitOnSpace = lineString.Split(' ');
-            switch (splitOnSpace[0].Substring(1).Trim())
+            string skipGithoutSemiColon = splitOnSpace[0].Split(';')[0].Substring(1).Trim();
+            switch (skipGithoutSemiColon)
             {
                 case "0":
                     // goto coordinate (have to read it)
                     // G28 	Return to home position (machine zero, aka machine reference point)
                     break;
 
+                case "29":
+                    // G29 Probe the z-bed in 3 places
+                    break;
+
                 case "90": // G90 is Absolute Distance Mode
                     machineState.movmentIsAbsolute = true;
                     break;