Make a test-all button

This commit is contained in:
Tim Young 2018-09-28 08:07:54 -05:00
parent c10db3a8bb
commit 03c9f3404a

View File

@ -396,10 +396,13 @@ namespace EduNetworkBuilder
if (MyMode == LBContents.regressiontest) if (MyMode == LBContents.regressiontest)
{ {
cbLoadPuzzlesAtStart.Visible = false; cbLoadPuzzlesAtStart.Visible = false;
btnReset.Visible = false; btnReset.Visible = true;
btnReset.Text = "Close";
tbSearchBox.Visible = false; tbSearchBox.Visible = false;
btnOK.Text = "Test"; btnAdd.Text = "Test All";
btnOK.Text = "Test One";
PuzzleInfo pi; PuzzleInfo pi;
string shown_name; string shown_name;
@ -408,6 +411,7 @@ namespace EduNetworkBuilder
NBSettings oursettings = NB.GetSettings(); NBSettings oursettings = NB.GetSettings();
if (Puzzles == null) return; if (Puzzles == null) return;
bool wasfinished = false; bool wasfinished = false;
int count = 0;
foreach (string str in Puzzles) foreach (string str in Puzzles)
{ {
wasfinished = false; wasfinished = false;
@ -443,6 +447,7 @@ namespace EduNetworkBuilder
MPE.HasTest = oursettings.HasReplay(puzzle_name); MPE.HasTest = oursettings.HasReplay(puzzle_name);
if (selected == "" && !wasfinished) selected = shown_name; //Select the first unfinished puzzle if (selected == "" && !wasfinished) selected = shown_name; //Select the first unfinished puzzle
lbWindowData.Items.Add(MPE); lbWindowData.Items.Add(MPE);
if(MPE.HasTest) count++; //we can only test-all if there are tests to do
break; break;
} }
} }
@ -460,6 +465,8 @@ namespace EduNetworkBuilder
{ {
btnOK.Enabled = false; btnOK.Enabled = false;
} }
if (count > 0) btnAdd.Enabled = true;
else btnAdd.Enabled = false;
} }
} }
@ -633,7 +640,7 @@ namespace EduNetworkBuilder
} }
Close(); Close();
} }
//In regression, this is the close button //In regression, this is the test all button
if (MyMode == LBContents.regressiontest) if (MyMode == LBContents.regressiontest)
{ {
ClosingRegression = true; ClosingRegression = true;
@ -742,12 +749,22 @@ namespace EduNetworkBuilder
private void btnReset_Click(object sender, EventArgs e) private void btnReset_Click(object sender, EventArgs e)
{ {
DialogResult answer = MessageBox.Show(NB.Translate("LBW_btnResetYouSure"), NB.Translate("LBW_btnResetForget"), MessageBoxButtons.YesNo); if (MyMode == LBContents.regressiontest)
if (answer == System.Windows.Forms.DialogResult.Yes)
{ {
NBSettings oursettings = NB.GetSettings(); //In regressiontest mode, this is the cancel.
oursettings.ScoreList.Clear(); ClosingRegression = true;
UpdateForm(); Close();
return;
}
else
{
DialogResult answer = MessageBox.Show(NB.Translate("LBW_btnResetYouSure"), NB.Translate("LBW_btnResetForget"), MessageBoxButtons.YesNo);
if (answer == System.Windows.Forms.DialogResult.Yes)
{
NBSettings oursettings = NB.GetSettings();
oursettings.ScoreList.Clear();
UpdateForm();
}
} }
} }