diff options
Diffstat (limited to 'tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp')
-rw-r--r-- | tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp index 2149ee7c44..baf727d766 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp +++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp @@ -1,33 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QtTest/QtTest> +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + +#include <QTest> #include <qapplication.h> #include <qdebug.h> @@ -51,6 +26,7 @@ private Q_SLOTS: void getSetCheck(); void task198202(); void QTBUG_31046(); + void QTBUG_19983(); void settingCustomWidgets(); void i18n(); void setValueReentrancyGuard(); @@ -108,7 +84,7 @@ void tst_QProgressDialog::autoShow() // in order to test for the setValue() behavior instead // See autoShowCtor() for the ctor timer check dlg.setValue(value); - QThread::msleep(delay); + QThread::sleep(std::chrono::milliseconds{delay}); dlg.setValue(min+1); QCOMPARE(dlg.isVisible(), expectedAutoShow); } @@ -117,7 +93,7 @@ void tst_QProgressDialog::autoShowCtor() { QProgressDialog dlg; QVERIFY(!dlg.isVisible()); - QThread::msleep(dlg.minimumDuration()); + QThread::sleep(std::chrono::milliseconds{dlg.minimumDuration()}); QTRY_VERIFY(dlg.isVisible()); } @@ -205,11 +181,34 @@ void tst_QProgressDialog::QTBUG_31046() { QProgressDialog dlg("", "", 50, 60); dlg.setValue(0); - QThread::msleep(200); + QThread::sleep(std::chrono::milliseconds{200}); dlg.setValue(50); QCOMPARE(50, dlg.value()); } +void tst_QProgressDialog::QTBUG_19983() +{ + QProgressDialog tempDlg; + tempDlg.setRange(0, 0); + tempDlg.setLabelText("This is a test."); + + QPushButton *btnOne = new QPushButton("Cancel", &tempDlg); + tempDlg.setCancelButton(btnOne); + tempDlg.show(); + QVERIFY(QTest::qWaitForWindowExposed(&tempDlg)); + const auto btnOneGeometry = btnOne->geometry(); + QVERIFY(QPoint(0,0) != btnOneGeometry.topLeft()); + + tempDlg.cancel(); + QVERIFY(!tempDlg.isVisible()); + + QPushButton *btnTwo = new QPushButton("Cancel", &tempDlg); + tempDlg.setCancelButton(btnTwo); + tempDlg.show(); + QVERIFY(QTest::qWaitForWindowExposed(&tempDlg)); + QCOMPARE(btnOneGeometry, btnTwo->geometry()); +} + void tst_QProgressDialog::settingCustomWidgets() { QPointer<QLabel> l = new QLabel; |