From 25cc1f720a8911c6c1eac9addbe038a99bd4f58f Mon Sep 17 00:00:00 2001
From: Tim Young <tim.young@lightsys.org>
Date: Fri, 28 Sep 2018 08:20:48 -0500
Subject: [PATCH] Get testall working.  Yay!

---
 EduNetworkBuilder/ListBoxWindow.cs | 45 ++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/EduNetworkBuilder/ListBoxWindow.cs b/EduNetworkBuilder/ListBoxWindow.cs
index 9fed7b5..0a40c7f 100644
--- a/EduNetworkBuilder/ListBoxWindow.cs
+++ b/EduNetworkBuilder/ListBoxWindow.cs
@@ -643,10 +643,51 @@ namespace EduNetworkBuilder
             //In regression, this is the test all button
             if (MyMode == LBContents.regressiontest)
             {
-                ClosingRegression = true;
-                Close();
+                //Loop through all the visible puzzles & process them in-order.
+                RegressionTestAll();
             }
         }
+
+        private void RegressionTestAll()
+        {
+            PuzzleInfo pi;
+            List<string> Puzzles = NB.GetPuzzleNames();
+            NBSettings oursettings = NB.GetSettings();
+            if (Puzzles == null) return;
+            foreach (string OnePuzzle in Puzzles)
+            {
+                pi = NB.GetPuzzleInfoFromName(OnePuzzle);
+                //shown_name = pi.PuzzleName;
+                List<string> tags = new List<string>(pi.PuzzleTags);
+                if (oursettings.HasReplay(OnePuzzle)) tags.Add(TestString);
+                else continue; //Do not try it if there is no replay
+                if (oursettings.HasPassed(OnePuzzle)) continue; //No need to test it again if it passed
+                if (oursettings.HasFailed(OnePuzzle)) tags.Add(FailedString);
+                if (!oursettings.HasFailed(OnePuzzle) && !oursettings.HasPassed(OnePuzzle)
+                    && oursettings.HasReplay(OnePuzzle))
+                    tags.Add(Untested);
+                foreach (string tag in tags)
+                {
+                    if (isChecked(tag))
+                    {
+                        
+                        //Visible = false;
+                        BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
+                        if (myWin != null)
+                        {
+                            //myWin.Activate();
+                            myWin.replayNetwork(OnePuzzle, 1);
+                            //Return back to the listbox window
+                            Visible = true;
+                            Activate();
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+
+
         private void AddRoute()
         {
             NB_IPAddress newip = new NB_IPAddress(NB.ZeroIPString, NB.ZeroIPString, NB.ZeroIPString);