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