From 0d35c3f36abbbdee9f1d9271da9c3721e5e7bcac Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 19 Jun 2019 19:08:38 +0200 Subject: [PATCH] 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. --- tests/controls/label.cpp | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/tests/controls/label.cpp b/tests/controls/label.cpp index 3b52fb02f6..1b8f744cd8 100644 --- a/tests/controls/label.cpp +++ b/tests/controls/label.cpp @@ -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 some markup"; - c->SetLabelText(testLabel); - CHECK( c->GetLabel() == testLabel ); - - c->SetLabelText("label with some markup and &mnemonic"); - CHECK( c->GetLabel() == "label with some markup 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 some markup"; - c->SetLabel(testLabel); - CHECK( c->GetLabelText() == testLabel ); - - c->SetLabel("label with some markup and &mnemonic"); - CHECK( c->GetLabelText() == "label with some markup and mnemonic"); } } // anonymous namespace