diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2013-10-08 11:31:19 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-15 05:20:25 (GMT) |
commit | 9a6b005b53c7ee0f55230be5d1f21d8cc0eeb51d (patch) | |
tree | fc1b4d99040179e20f16871f0ff9841ca4bc86dd /tests | |
parent | 9afc8096fb5395216cd5813fb1859ff45b087d92 (diff) | |
download | Qt-9a6b005b53c7ee0f55230be5d1f21d8cc0eeb51d.zip Qt-9a6b005b53c7ee0f55230be5d1f21d8cc0eeb51d.tar.gz Qt-9a6b005b53c7ee0f55230be5d1f21d8cc0eeb51d.tar.bz2 |
QWizard: give all buttons an objectName
Only Commit, Finish and Cancel didn't have an object name, yet.
Also Extract Method on the switch statement, add a test, and
use QStringBuilder.
Task-number: QTBUG-29924
Reported-by: Leo Arias
Change-Id: I8c29606bc53e9d4caab631da2089e971a9da2d75
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
(cherry picked from qtbase/1ea191276ea49ce2334d21b1f4a2c66ee8889466)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qwizard/tst_qwizard.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp index 54693b8..0439bd9 100644 --- a/tests/auto/qwizard/tst_qwizard.cpp +++ b/tests/auto/qwizard/tst_qwizard.cpp @@ -57,6 +57,8 @@ //TESTED_CLASS= //TESTED_FILES= +Q_DECLARE_METATYPE(QWizard::WizardButton); + static QImage grabWidget(QWidget *window) { return QPixmap::grabWidget(window).toImage(); @@ -105,6 +107,8 @@ private slots: void setWizardStyle(); void removePage(); void sideWidget(); + void objectNames_data(); + void objectNames(); // task-specific tests below me: void task161660_buttonSpacing(); @@ -2414,6 +2418,44 @@ void tst_QWizard::task161660_buttonSpacing() #endif } +void tst_QWizard::objectNames_data() +{ + QTest::addColumn<QWizard::WizardButton>("wizardButton"); + QTest::addColumn<QString>("buttonName"); + + QTest::newRow("BackButton") << QWizard::BackButton << QString::fromLatin1("__qt__passive_wizardbutton0"); + QTest::newRow("NextButton") << QWizard::NextButton << QString::fromLatin1("__qt__passive_wizardbutton1"); + QTest::newRow("CommitButton") << QWizard::CommitButton << QString::fromLatin1("qt_wizard_commit"); + QTest::newRow("FinishButton") << QWizard::FinishButton << QString::fromLatin1("qt_wizard_finish"); + QTest::newRow("CancelButton") << QWizard::CancelButton << QString::fromLatin1("qt_wizard_cancel"); + QTest::newRow("HelpButton") << QWizard::HelpButton << QString::fromLatin1("__qt__passive_wizardbutton5"); + QTest::newRow("CustomButton1") << QWizard::CustomButton1 << QString::fromLatin1("__qt__passive_wizardbutton6"); + QTest::newRow("CustomButton2") << QWizard::CustomButton2 << QString::fromLatin1("__qt__passive_wizardbutton7"); + QTest::newRow("CustomButton3") << QWizard::CustomButton3 << QString::fromLatin1("__qt__passive_wizardbutton8"); +} + +void tst_QWizard::objectNames() +{ + QFETCH(QWizard::WizardButton, wizardButton); + QFETCH(QString, buttonName); + + QWizard wizard; + QList<QWizard::WizardButton> buttons = QList<QWizard::WizardButton>() + << QWizard::BackButton + << QWizard::NextButton + << QWizard::CommitButton + << QWizard::FinishButton + << QWizard::CancelButton + << QWizard::HelpButton + << QWizard::CustomButton1 + << QWizard::CustomButton2 + << QWizard::CustomButton3 + ; + QVERIFY(buttons.contains(wizardButton)); + QVERIFY(wizard.button(wizardButton)); + QCOMPARE(wizard.button(wizardButton)->objectName(), buttonName); +} + class task177716_CommitPage : public QWizardPage { Q_OBJECT |