summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-26 22:30:27 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-26 22:35:48 +0100
commit4a8273a6fc2e741e811cf5dabc9a3c240306cf7f (patch)
tree2148abc88f8543eecdc0b97b2dd92594836af9b2 /tests/auto/widgets/dialogs
parent036c5db468164297d213764c59a4b59daa76d90a (diff)
parent1c2be58fecaff1de5f2849192eb712984ebd59bd (diff)
Merge remote-tracking branch 'origin/stable' into dev
For the conflicts in msvc_nmake.cpp the ifdefs are extended since we need to support windows phone in the target branch while it is not there in the current stable branch (as of Qt 5.2). Conflicts: configure qmake/generators/win32/msvc_nmake.cpp src/3rdparty/angle/src/libEGL/Surface.cpp src/angle/src/common/common.pri src/corelib/global/qglobal.h src/corelib/io/qstandardpaths.cpp src/plugins/platforms/qnx/qqnxintegration.cpp src/plugins/platforms/qnx/qqnxscreeneventhandler.h src/plugins/platforms/xcb/qglxintegration.h src/widgets/kernel/win.pri tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp tools/configure/configureapp.cpp Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
Diffstat (limited to 'tests/auto/widgets/dialogs')
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp9
-rw-r--r--tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp30
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp42
3 files changed, 80 insertions, 1 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 816d375b97..3a1f650351 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -212,7 +212,14 @@ void tst_QFileSystemModel::rootPath()
QString oldRootPath = model->rootPath();
const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
QVERIFY(!documentPaths.isEmpty());
- const QString documentPath = documentPaths.front();
+ QString documentPath = documentPaths.front();
+ // In particular on Linux, ~/Documents (the first
+ // DocumentsLocation) may not exist, so choose ~ in that case:
+ if (!QFile::exists(documentPath)) {
+ documentPath = QDir::homePath();
+ qWarning("%s: first documentPath \"%s\" does not exist. Using ~ (\"%s\") instead.",
+ Q_FUNC_INFO, qPrintable(documentPaths.front()), qPrintable(documentPath));
+ }
root = model->setRootPath(documentPath);
QTRY_VERIFY(model->rowCount(root) >= 0);
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
index 68502f0d8d..060fa51293 100644
--- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
+++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
@@ -57,6 +57,8 @@ public:
virtual ~tst_QProgressDialog();
private slots:
+ void autoShow_data();
+ void autoShow();
void getSetCheck();
void task198202();
void QTBUG_31046();
@@ -70,6 +72,34 @@ tst_QProgressDialog::~tst_QProgressDialog()
{
}
+void tst_QProgressDialog::autoShow_data()
+{
+ QTest::addColumn<int>("min");
+ QTest::addColumn<int>("max");
+ QTest::addColumn<int>("delay");
+ QTest::addColumn<bool>("expectedAutoShow");
+
+ QTest::newRow("50_to_100_long") << 50 << 100 << 100 << true; // 50*100ms = 5s
+ QTest::newRow("50_to_100_short") << 50 << 1 << 100 << false; // 50*1ms = 50ms
+
+ QTest::newRow("0_to_100_long") << 0 << 100 << 100 << true; // 100*100ms = 10s
+ QTest::newRow("0_to_10_short") << 0 << 10 << 100 << false; // 10*100ms = 1s
+}
+
+void tst_QProgressDialog::autoShow()
+{
+ QFETCH(int, min);
+ QFETCH(int, max);
+ QFETCH(int, delay);
+ QFETCH(bool, expectedAutoShow);
+
+ QProgressDialog dlg("", "", min, max);
+ dlg.setValue(0);
+ QThread::msleep(delay);
+ dlg.setValue(min+1);
+ QCOMPARE(dlg.isVisible(), expectedAutoShow);
+}
+
// Testing get/set functions
void tst_QProgressDialog::getSetCheck()
{
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 4506d0af14..a711bc28e3 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -52,6 +52,8 @@
#include <QWizard>
#include <QTreeWidget>
+Q_DECLARE_METATYPE(QWizard::WizardButton);
+
static QImage grabWidget(QWidget *window)
{
return window->grab().toImage();
@@ -100,6 +102,8 @@ private slots:
void setWizardStyle();
void removePage();
void sideWidget();
+ void objectNames_data();
+ void objectNames();
// task-specific tests below me:
void task177716_disableCommitButton();
@@ -2384,6 +2388,44 @@ void tst_QWizard::sideWidget()
QVERIFY(wizard.sideWidget() == 0);
}
+void tst_QWizard::objectNames_data()
+{
+ QTest::addColumn<QWizard::WizardButton>("wizardButton");
+ QTest::addColumn<QString>("buttonName");
+
+ QTest::newRow("BackButton") << QWizard::BackButton << QStringLiteral("__qt__passive_wizardbutton0");
+ QTest::newRow("NextButton") << QWizard::NextButton << QStringLiteral("__qt__passive_wizardbutton1");
+ QTest::newRow("CommitButton") << QWizard::CommitButton << QStringLiteral("qt_wizard_commit");
+ QTest::newRow("FinishButton") << QWizard::FinishButton << QStringLiteral("qt_wizard_finish");
+ QTest::newRow("CancelButton") << QWizard::CancelButton << QStringLiteral("qt_wizard_cancel");
+ QTest::newRow("HelpButton") << QWizard::HelpButton << QStringLiteral("__qt__passive_wizardbutton5");
+ QTest::newRow("CustomButton1") << QWizard::CustomButton1 << QStringLiteral("__qt__passive_wizardbutton6");
+ QTest::newRow("CustomButton2") << QWizard::CustomButton2 << QStringLiteral("__qt__passive_wizardbutton7");
+ QTest::newRow("CustomButton3") << QWizard::CustomButton3 << QStringLiteral("__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