Browse Source

Small improvements.

Martin Edlund 5 years ago
parent
commit
3593f41ca6

+ 4 - 4
SketchAssistant/SketchAssistantWPF/InternalLine.cs

@@ -88,7 +88,7 @@ namespace SketchAssistantWPF
         }
 
         /// <summary>
-        /// A function that will take to matrixes and populate the with the line data of this line object
+        /// A function that will take two matrixes and populate them with the line data of this line object
         /// </summary>
         /// <param name="boolMatrix">The Matrix of booleans, in which is saved wether there is a line at this position.</param>
         /// <param name="listMatrix">The Matrix of Lists of integers, in which is saved which lines are at this position</param>
@@ -120,14 +120,14 @@ namespace SketchAssistantWPF
             if (linePoints.Count > 1)
             {
                 //if this is a point or not
-                bool isP = true;
+                var localIsPoint = true;
                 //check if its a point
                 foreach(Point p in linePoints)
                 {
                     if (p.X != linePoints[0].X || p.Y != linePoints[0].Y)
-                        isP = false;
+                        localIsPoint = false;
                 }
-                if (!isP) {
+                if (!localIsPoint) {
                     List<Point> newList = new List<Point>();
                     List<Point> tempList = new List<Point>();
                     //Since Point is non-nullable, we must ensure the nullPoints, 

+ 4 - 4
SketchAssistant/SketchAssistantWPF/MVP_Model.cs

@@ -282,7 +282,7 @@ namespace SketchAssistantWPF
                     default:
                         break;
                 }
-                //TODO: Add check if overlay needs to be added
+                //TODO: For the person implementing overlay: Add check if overlay needs to be added
                 programPresenter.UpdateRightLines(rightLineList);
             }
             RepopulateDeletionMatrixes();
@@ -313,7 +313,7 @@ namespace SketchAssistantWPF
                     default:
                         break;
                 }
-                //TODO: Add check if overlay needs to be added
+                //TODO: For the person implementing overlay: Add check if overlay needs to be added
                 programPresenter.UpdateRightLines(rightLineList);
                 RepopulateDeletionMatrixes();
             }
@@ -362,7 +362,7 @@ namespace SketchAssistantWPF
                 rightLineList.Add(new Tuple<bool, InternalLine>(true, newLine));
                 newLine.PopulateMatrixes(isFilledMatrix, linesMatrix);
                 programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Draw, newLine.GetID())));
-                //TODO: Add check if overlay needs to be added
+                //TODO: For the person implementing overlay: Add check if overlay needs to be added
                 programPresenter.UpdateRightLines(rightLineList);
                 currentLine.Clear();
                 programPresenter.UpdateCurrentLine(currentLine);
@@ -399,7 +399,7 @@ namespace SketchAssistantWPF
                             rightLineList[lineID] = new Tuple<bool, InternalLine>(false, rightLineList[lineID].Item2);
                         }
                         RepopulateDeletionMatrixes();
-                        //TODO: Add check if overlay needs to be added
+                        //TODO: For the person implementing overlay: Add check if overlay needs to be added
                         programPresenter.UpdateRightLines(rightLineList);
                     }
                 }

+ 11 - 5
SketchAssistant/SketchAssistantWPF/MainWindow.xaml.cs

@@ -503,11 +503,17 @@ namespace SketchAssistantWPF
         private async void Debug(int option)
         {
             Point[] points;
-            if (option == 1)
-                points = debugDat.debugPoints1;
-            else if (option == 2)
-                points = debugDat.debugPoints2;
-            else { return; }
+            switch (option)
+            {
+                case 1:
+                    points = debugDat.debugPoints1;
+                    break;
+                case 2:
+                    points = debugDat.debugPoints2;
+                    break;
+                default:
+                    return;
+            }
             dispatcherTimer.Stop();
             debugRunning = true;
             ProgramPresenter.Tick(); await Task.Delay(10);

+ 4 - 6
SketchAssistant/WhiteTests/UITest.cs

@@ -20,21 +20,20 @@ namespace WhiteTests
     {
         private TestStack.White.Application application;
 
-        public void setupapp()
+        public Window setupapp()
         {
             string outputDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
             string editedDir = outputDir.Replace("WhiteTests", "SketchAssistantWPF");
             string app_path = editedDir + @"\SketchAssistantWPF.exe";
             ProcessStartInfo processStart = new ProcessStartInfo(app_path, "-debug");
             application = Application.Launch(processStart);
-            Window mainWindow = application.GetWindow("Sketch Assistant");
+            return application.GetWindow("Sketch Assistant");
         }
 
         [TestMethod]
         public void CreateCanvasTest()
         {
-            setupapp();
-            Window mainWindow = application.GetWindow("Sketch Assistant");
+            Window mainWindow = setupapp();
             Thread.Sleep(20);
             Assert.AreEqual("none", mainWindow.Get<TextBox>(SearchCriteria.ByAutomationId("LastActionBox")).Text.ToString());
             mainWindow.Get<Button>(SearchCriteria.ByAutomationId("CanvasButton")).Click();
@@ -46,8 +45,7 @@ namespace WhiteTests
         [TestMethod]
         public void DrawLineTest()
         {
-            setupapp();
-            Window mainWindow = application.GetWindow("Sketch Assistant");
+            Window mainWindow = setupapp();
             Thread.Sleep(20);
             Assert.AreEqual("none", mainWindow.Get<TextBox>(SearchCriteria.ByAutomationId("LastActionBox")).Text.ToString());
             mainWindow.Get<Button>(SearchCriteria.ByAutomationId("CanvasButton")).Click();