Put all wxControl label unit tests inside a loop

There doesn't seem to be any reason to write some of them out
explicitly.

No real changes.
This commit is contained in:
Vadim Zeitlin
2019-06-19 19:08:38 +02:00
parent 5e98099699
commit 0d35c3f36a

View File

@@ -53,43 +53,16 @@ void DoTestLabel(wxControl* c)
c->SetLabel(l);
CHECK( c->GetLabel() == l );
// GetLabelText() should always return unescaped version of the label
CHECK( c->GetLabelText() == wxControl::RemoveMnemonics(l) );
// GetLabelText() should always return the string passed to SetLabelText()
c->SetLabelText(l);
CHECK( c->GetLabelText() == l );
// And GetLabel() should be the escaped version of the text
CHECK( l == wxControl::RemoveMnemonics(c->GetLabel()) );
}
// test calls to SetLabelText() and then to GetLabel()
wxString testLabel = "label without mnemonics and markup";
c->SetLabelText(testLabel);
CHECK( c->GetLabel() == testLabel );
c->SetLabelText("label with &mnemonic");
CHECK( c->GetLabel() == "label with &&mnemonic" );
testLabel = "label with <span foreground='blue'>some</span> <b>markup</b>";
c->SetLabelText(testLabel);
CHECK( c->GetLabel() == testLabel );
c->SetLabelText("label with <span foreground='blue'>some</span> <b>markup</b> and &mnemonic");
CHECK( c->GetLabel() == "label with <span foreground='blue'>some</span> <b>markup</b> and &&mnemonic" );
// test calls to SetLabel() and then to GetLabelText()
testLabel = "label without mnemonics and markup";
c->SetLabel(testLabel);
CHECK( c->GetLabelText() == testLabel );
c->SetLabel("label with &mnemonic");
CHECK( c->GetLabelText() == "label with mnemonic" );
testLabel = "label with <span foreground='blue'>some</span> <b>markup</b>";
c->SetLabel(testLabel);
CHECK( c->GetLabelText() == testLabel );
c->SetLabel("label with <span foreground='blue'>some</span> <b>markup</b> and &mnemonic");
CHECK( c->GetLabelText() == "label with <span foreground='blue'>some</span> <b>markup</b> and mnemonic");
}
} // anonymous namespace