diff options
Diffstat (limited to 'tests/auto/widgets')
63 files changed, 702 insertions, 1186 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index e6a0c5e86b..ac7ba02700 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -69,10 +69,8 @@ private slots: void showMaximized(); void showMinimized(); void showFullScreen(); -#ifndef Q_OS_WINCE void showAsTool(); void toolDialogPosition(); -#endif void deleteMainDefault(); void deleteInExec(); #ifndef QT_NO_SIZEGRIP @@ -358,8 +356,6 @@ void tst_QDialog::showFullScreen() QVERIFY(!dialog.isVisible()); } -// No real support for Qt::Tool on WinCE -#ifndef Q_OS_WINCE void tst_QDialog::showAsTool() { #if defined(Q_OS_UNIX) @@ -379,10 +375,7 @@ void tst_QDialog::showAsTool() QCOMPARE(dialog.wasActive(), false); } } -#endif -// No real support for Qt::Tool on WinCE -#ifndef Q_OS_WINCE // Verify that pos() returns the same before and after show() // for a dialog with the Tool window type. void tst_QDialog::toolDialogPosition() @@ -394,7 +387,6 @@ void tst_QDialog::toolDialogPosition() const QPoint afterShowPosition = dialog.pos(); QCOMPARE(afterShowPosition, beforeShowPosition); } -#endif class Dialog : public QDialog { diff --git a/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro b/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro index 2a11a29420..4ea23a896f 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro +++ b/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro @@ -8,18 +8,6 @@ QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qfiledialog.cpp -wince* { - addFiles.files = *.cpp - addFiles.path = . - filesInDir.files = *.pro - filesInDir.path = someDir - DEPLOYMENT += addFiles filesInDir -} - -wince* { - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" linux*: CONFIG += insignificant_test # Crashes on different Linux distros diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 51ac2f0615..7d4fe2d499 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -183,9 +183,6 @@ void tst_QFiledialog::init() QFileDialogPrivate::setLastVisitedDirectory(QUrl()); // populate the sidebar with some default settings QNonNativeFileDialog fd; -#if defined(Q_OS_WINCE) - QTest::qWait(1000); -#endif } void tst_QFiledialog::cleanup() diff --git a/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro b/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro index fb432a7d21..1b35b2e4ac 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro +++ b/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro @@ -6,17 +6,4 @@ QT += core-private gui-private SOURCES += tst_qfiledialog2.cpp -wince* { - addFiles.files = *.cpp - addFiles.path = . - filesInDir.files = *.pro - filesInDir.path = someDir - DEPLOYMENT += addFiles filesInDir -} - -wince* { - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - +DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 0648f8364c..f08d78acf7 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -54,7 +54,7 @@ #include <qpa/qplatformdialoghelper.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) #include "../../../network-settings.h" #endif @@ -118,7 +118,7 @@ private slots: #ifndef Q_OS_MAC void task227930_correctNavigationKeyboardBehavior(); #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void task226366_lowerCaseHardDriveWindows(); #endif void completionOnLevelAfterRoot(); @@ -148,9 +148,6 @@ private: tst_QFileDialog2::tst_QFileDialog2() : tempDir(QDir::tempPath() + "/tst_qfiledialog2.XXXXXX") { -#if defined(Q_OS_WINCE) - qApp->setAutoMaximizeThreshold(-1); -#endif } void tst_QFileDialog2::cleanupSettingsFile() @@ -177,9 +174,6 @@ void tst_QFileDialog2::init() QFileDialogPrivate::setLastVisitedDirectory(QUrl()); // populate the sidebar with some default settings QNonNativeFileDialog fd; -#if defined(Q_OS_WINCE) - QTest::qWait(1000); -#endif } void tst_QFileDialog2::cleanup() @@ -199,11 +193,7 @@ void tst_QFileDialog2::listRoot() fd.show(); QCOMPARE(qt_test_isFetchedRoot(),false); fd.setDirectory(""); -#ifdef Q_OS_WINCE - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QCOMPARE(qt_test_isFetchedRoot(),true); } #endif @@ -297,7 +287,7 @@ void tst_QFileDialog2::showNameFilterDetails() void tst_QFileDialog2::unc() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Only test UNC on Windows./ QString dir("\\\\" + QtNetworkSettings::winServerName() + "\\testsharewritable"); #else @@ -645,7 +635,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() } #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows() { QNonNativeFileDialog fd; @@ -675,7 +665,7 @@ void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows() void tst_QFileDialog2::completionOnLevelAfterRoot() { QNonNativeFileDialog fd; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) fd.setDirectory("C:/"); QDir current = fd.directory(); QStringList entryList = current.entryList(QStringList(), QDir::Dirs); @@ -719,7 +709,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot() fd.show(); QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit"); QTest::qWait(2000); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) //I love testlib :D for (int i = 0; i < 5; i++) QTest::keyClick(edit, testDir.at(i).toLower().toLatin1() - 'a' + Qt::Key_A); @@ -730,7 +720,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot() QTest::qWait(200); QTest::keyClick(edit->completer()->popup(), Qt::Key_Down); QTest::qWait(200); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QCOMPARE(edit->text(), testDir); #else QTRY_COMPARE(edit->text(), QString("etc")); @@ -864,33 +854,21 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() fd.setDirectory(current.absolutePath()); fd.setViewMode(QFileDialog::Detail); fd.show(); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QTreeView *tree = fd.findChild<QTreeView*>("treeView"); tree->header()->setSortIndicator(3,Qt::DescendingOrder); QTest::qWait(200); QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox"); QPushButton *button = buttonBox->button(QDialogButtonBox::Open); QTest::mouseClick(button, Qt::LeftButton); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QNonNativeFileDialog fd2; fd2.setFileMode(QFileDialog::Directory); fd2.restoreState(fd.saveState()); current.cd("aaaaaaaaaaaaaaaaaa"); fd2.setDirectory(current.absolutePath()); fd2.show(); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QTreeView *tree2 = fd2.findChild<QTreeView*>("treeView"); tree2->setFocus(); @@ -900,22 +878,14 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() QPushButton *button2 = buttonBox2->button(QDialogButtonBox::Open); fd2.selectFile("g"); QTest::mouseClick(button2, Qt::LeftButton); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QLatin1String("/g")); QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName()); fd3.restoreState(fd.saveState()); fd3.setFileMode(QFileDialog::Directory); fd3.show(); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QTreeView *tree3 = fd3.findChild<QTreeView*>("treeView"); tree3->setFocus(); @@ -924,11 +894,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() QDialogButtonBox *buttonBox3 = fd3.findChild<QDialogButtonBox*>("buttonBox"); QPushButton *button3 = buttonBox3->button(QDialogButtonBox::Open); QTest::mouseClick(button3, Qt::LeftButton); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QCOMPARE(fd3.selectedFiles().first(), tempFile->fileName()); current.cd("aaaaaaaaaaaaaaaaaa"); @@ -1010,11 +976,7 @@ void tst_QFileDialog2::task251321_sideBarHiddenEntries() sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath())); QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center()); // give the background processes more time on windows mobile -#ifdef Q_OS_WINCE - QTest::qWait(1000); -#else QTest::qWait(250); -#endif QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model"); QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2); diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index ad7600c784..00693ba6f7 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -40,7 +40,7 @@ #include <QStyle> #include <QtGlobal> #include <QTemporaryDir> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) # include <qt_windows.h> // for SetFileAttributes #endif @@ -332,7 +332,7 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi return false; } file.close(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (initial_files.at(i)[0] == '.') { QString hiddenFile = QDir::toNativeSeparators(file.fileName()); wchar_t nativeHiddenFile[MAX_PATH]; @@ -369,14 +369,9 @@ void tst_QFileSystemModel::rowCount() QSignalSpy spy2(model, SIGNAL(rowsInserted(QModelIndex,int,int))); QSignalSpy spy3(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); -#if !defined(Q_OS_WINCE) QStringList files = QStringList() << "b" << "d" << "f" << "h" << "j" << ".a" << ".c" << ".e" << ".g"; QString l = "b,d,f,h,j,.a,.c,.e,.g"; -#else - // Cannot hide them on CE - QStringList files = QStringList() << "b" << "d" << "f" << "h" << "j"; - QString l = "b,d,f,h,j"; -#endif + QVERIFY(createFiles(tmp, files)); QModelIndex root = model->setRootPath(tmp); @@ -404,9 +399,6 @@ static inline QString lastEntry(const QModelIndex &root) void tst_QFileSystemModel::rowsInserted() { -#if defined(Q_OS_WINCE) - QSKIP("Watching directories does not work on CE(see #137910)"); -#endif QString tmp = flatDirTestPath; rowCount(); QModelIndex root = model->index(model->rootPath()); @@ -461,9 +453,6 @@ void tst_QFileSystemModel::rowsRemoved_data() void tst_QFileSystemModel::rowsRemoved() { -#if defined(Q_OS_WINCE) - QSKIP("Watching directories does not work on CE(see #137910)"); -#endif QString tmp = flatDirTestPath; rowCount(); QModelIndex root = model->index(model->rootPath()); @@ -552,7 +541,6 @@ void tst_QFileSystemModel::filters_data() QTest::addColumn<int>("dirFilters"); QTest::addColumn<QStringList>("nameFilters"); QTest::addColumn<int>("rowCount"); -#if !defined(Q_OS_WINCE) QTest::newRow("no dirs") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs) << QStringList() << 2; QTest::newRow("no dirs - dot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 1; QTest::newRow("no dirs - dotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 1; @@ -574,30 +562,6 @@ void tst_QFileSystemModel::filters_data() (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "a") << 1; QTest::newRow("dir+files+hid+dot+cas+alldir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive | QDir::AllDirs) << (QStringList() << "Z") << 1; -#else - QTest::qWait(3000); // We need to calm down a bit... - QTest::newRow("no dirs") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs) << QStringList() << 0; - QTest::newRow("no dirs - dot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 1; - QTest::newRow("no dirs - dotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 1; - QTest::newRow("no dirs - dotanddotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 0; - QTest::newRow("one dir - dot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 2; - QTest::newRow("one dir - dotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 2; - QTest::newRow("one dir - dotanddotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 1; - QTest::newRow("one dir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs) << QStringList() << 1; - QTest::newRow("no dir + hidden") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::Hidden) << QStringList() << 0; - QTest::newRow("dir+hid+files") << (QStringList() << "a" << "b" << "c") << QStringList() << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden) << QStringList() << 3; - QTest::newRow("dir+file+hid-dot .A") << (QStringList() << "a" << "b" << "c") << (QStringList() << ".A") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << QStringList() << 4; - QTest::newRow("dir+files+hid+dot A") << (QStringList() << "a" << "b" << "c") << (QStringList() << "AFolder") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << (QStringList() << "A*") << 2; - QTest::newRow("dir+files+hid+dot+cas1") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "Z") << 1; - QTest::newRow("dir+files+hid+dot+cas2") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "a") << 1; - QTest::newRow("dir+files+hid+dot+cas+alldir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive | QDir::AllDirs) << (QStringList() << "Z") << 1; -#endif QTest::newRow("case sensitive") << (QStringList() << "Antiguagdb" << "Antiguamtd" << "Antiguamtp" << "afghanistangdb" << "afghanistanmtd") diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST index b62f3e3344..07f3a41df3 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST @@ -1,4 +1,5 @@ [task256466_wrongStyle] opensuse-13.1 +opensuse-42.1 rhel-7.1 rhel-7.2 diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index d6b3ce07e8..d6c4841b22 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -395,11 +395,8 @@ void tst_QMessageBox::about() QVERIFY(closeHelper.done()); #endif -#if !defined(Q_OS_WINCE) const int keyToSend = Qt::Key_Enter; -#else - const keyToSend = Qt::Key_Escape; -#endif + closeHelper.start(keyToSend); QMessageBox::aboutQt(0, "Caption"); #ifdef Q_OS_MAC diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 2635a2ed82..016835f142 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -51,9 +51,6 @@ class tst_QWizard : public QObject { Q_OBJECT -public: - tst_QWizard(); - private slots: void cleanup(); void buttonText(); @@ -128,13 +125,6 @@ private slots: */ }; -tst_QWizard::tst_QWizard() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QWizard::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); @@ -962,9 +952,6 @@ void tst_QWizard::setOption_IndependentPages() void tst_QWizard::setOption_IgnoreSubTitles() { -#if defined(Q_OS_WINCE) - QSKIP("Skipped because of limited resources and potential crash. (Task: 166824)"); -#endif const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry(); const int kPixels = (availableGeometry.width() + 500) / 1000; const int frame = 50 * kPixels; @@ -1073,9 +1060,6 @@ void tst_QWizard::setOption_IgnoreSubTitles() void tst_QWizard::setOption_ExtendedWatermarkPixmap() { -#if defined(Q_OS_WINCE) - QSKIP("Skipped because of limited resources and potential crash. (Task: 166824)"); -#endif QPixmap watermarkPixmap(200, 400); watermarkPixmap.fill(Qt::black); @@ -2062,10 +2046,6 @@ void tst_QWizard::combinations_data() void tst_QWizard::combinations() { -#ifdef Q_OS_WINCE - QSKIP("Too much memory usage for testing on CE emulator"); -#endif - QFETCH(bool, ref); QFETCH(bool, testEquality); QFETCH(QList<Operation *>, operations); diff --git a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro index bf0f99598b..4fbe13cce7 100644 --- a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro +++ b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro @@ -5,10 +5,3 @@ QT += widgets widgets-private testlib QT += gui-private SOURCES += tst_qpixmapfilter.cpp - -wince { - addFiles.files = noise.png - addFiles.path = . - DEPLOYMENT += addFiles -} - diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp b/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp index 6b0c1ecf57..c3ebb838bb 100644 --- a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp +++ b/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp @@ -38,8 +38,6 @@ #include <QtCore/QHash> #include <QtCore/QDebug> -#include <qpa/qwindowsysteminterface.h> - class tst_QGestureRecognizer : public QObject { Q_OBJECT @@ -64,15 +62,13 @@ private: tst_QGestureRecognizer::tst_QGestureRecognizer() : m_fingerDistance(qRound(QGuiApplication::primaryScreen()->physicalDotsPerInch() / 2.0)) - , m_touchDevice(new QTouchDevice) + , m_touchDevice(QTest::createTouchDevice()) { qputenv("QT_PAN_TOUCHPOINTS", "2"); // Prevent device detection of pan touch point count. } void tst_QGestureRecognizer::initTestCase() { - m_touchDevice->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(m_touchDevice); } #ifndef QT_NO_GESTURES diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 90ea2cb58b..f5b2269297 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -38,7 +38,6 @@ class tst_QGraphicsGridLayout : public QObject Q_OBJECT private slots: - void initTestCase(); void qgraphicsgridlayout_data(); void qgraphicsgridlayout(); void addItem_data(); @@ -294,16 +293,6 @@ Q_DECLARE_METATYPE(ItemList); typedef QList<QSizeF> SizeList; - -// This will be called before the first test function is executed. -// It is only called once. -void tst_QGraphicsGridLayout::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QGraphicsGridLayout::qgraphicsgridlayout_data() { } diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro index 5bfa15db16..88526144fc 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -5,4 +5,4 @@ QT += core-private gui-private SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index fc192560b4..46d0b18990 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -57,9 +57,7 @@ Q_DECLARE_METATYPE(QPainterPath) -#include "../../../qtest-config.h" - -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) #include <windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ @@ -279,9 +277,6 @@ class tst_QGraphicsItem : public QObject { Q_OBJECT -public slots: - void init(); - private slots: void construction(); void constructionWithParent(); @@ -355,7 +350,7 @@ private slots: void filtersChildEvents(); void filtersChildEvents2(); void ensureVisible(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void cursor(); #endif //void textControlGetterSetter(); @@ -481,13 +476,6 @@ private: QList<QGraphicsItem *> paintedItems; }; -void tst_QGraphicsItem::init() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QGraphicsItem::construction() { for (int i = 0; i < 7; ++i) { @@ -4187,7 +4175,7 @@ void tst_QGraphicsItem::ensureVisible() QTest::qWait(25); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsItem::cursor() { QGraphicsScene scene; @@ -4535,7 +4523,7 @@ protected: case QGraphicsItem::ItemSceneHasChanged: break; case QGraphicsItem::ItemCursorChange: -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR oldValues << cursor(); #endif break; @@ -5098,10 +5086,6 @@ public: void tst_QGraphicsItem::paint() { -#ifdef Q_OS_MACX - if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7) - QSKIP("QTBUG-31454 - Unstable auto-test"); -#endif QGraphicsScene scene; PaintTester paintTester; @@ -6586,12 +6570,6 @@ public: void tst_QGraphicsItem::ensureUpdateOnTextItem() { -#ifdef Q_OS_MAC - if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7) { - QSKIP("This test is unstable on 10.7 in CI"); - } -#endif - QGraphicsScene scene; QGraphicsView view(&scene); view.show(); @@ -11039,9 +11017,7 @@ void tst_QGraphicsItem::touchEventPropagation() touchPoints << tp; sendMousePress(&scene, tp.scenePos()); - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); + QTouchDevice *device = QTest::createTouchDevice(); QTouchEvent touchBegin(QEvent::TouchBegin, device, Qt::NoModifier, Qt::TouchPointPressed, touchPoints); qApp->sendEvent(&scene, &touchBegin); diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 8253a44b21..a3aa90168a 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -33,8 +33,6 @@ #include <private/qgraphicsproxywidget_p.h> #include <private/qlayoutengine_p.h> // qSmartMin functions... -#include "../../../qtest-config.h" - static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton) { QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, button, 0); @@ -97,7 +95,7 @@ private slots: void focusNextPrevChild(); void focusOutEvent_data(); void focusOutEvent(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void hoverEnterLeaveEvent_data(); void hoverEnterLeaveEvent(); #endif @@ -140,7 +138,7 @@ private slots: void setFocus_complexTwoWidgets(); void popup_basic(); void popup_subwidget(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void changingCursor_basic(); #endif void tooltip_basic(); @@ -272,9 +270,6 @@ public: // It is only called once. void tst_QGraphicsProxyWidget::initTestCase() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif // Disable menu animations to prevent the alpha widget from getting in the way // in actionsContextMenu(). QApplication::setEffectEnabled(Qt::UI_AnimateMenu, false); @@ -414,7 +409,7 @@ void tst_QGraphicsProxyWidget::setWidget() } QWidget *widget = new QWidget; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR widget->setCursor(Qt::IBeamCursor); #endif widget->setPalette(QPalette(Qt::magenta)); @@ -451,7 +446,7 @@ void tst_QGraphicsProxyWidget::setWidget() QVERIFY(subWidget->testAttribute(Qt::WA_DontShowOnScreen)); QVERIFY(!subWidget->testAttribute(Qt::WA_QuitOnClose)); QCOMPARE(proxy->acceptHoverEvents(), true); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QVERIFY(proxy->hasCursor()); // These should match @@ -934,7 +929,7 @@ protected: } }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data() { QTest::addColumn<bool>("hasWidget"); @@ -1522,7 +1517,7 @@ void tst_QGraphicsProxyWidget::setWidget_simple() // Properties // QCOMPARE(proxy.focusPolicy(), lineEdit->focusPolicy()); // QCOMPARE(proxy.palette(), lineEdit->palette()); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(proxy.cursor().shape(), lineEdit->cursor().shape()); #endif QCOMPARE(proxy.layoutDirection(), lineEdit->layoutDirection()); @@ -1571,7 +1566,7 @@ void tst_QGraphicsProxyWidget::resize_simple_data() QTest::addColumn<QSizeF>("size"); QTest::newRow("200, 200") << QSizeF(200, 200); -#if !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE) +#if !defined(Q_PROCESSOR_ARM) QTest::newRow("1000, 1000") << QSizeF(1000, 1000); // Since 4.5, 10000x10000 runs out of memory. // QTest::newRow("10000, 10000") << QSizeF(10000, 10000); @@ -2539,7 +2534,7 @@ void tst_QGraphicsProxyWidget::popup_subwidget() QCOMPARE(popup->size(), child->size().toSize()); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsProxyWidget::changingCursor_basic() { // Confirm that mouse events are working properly by checking that @@ -3645,7 +3640,7 @@ public slots: void tst_QGraphicsProxyWidget::QTBUG_6986_sendMouseEventToAlienWidget() { -#if defined(Q_OS_MAC) || defined(Q_OS_WIN) || defined(QTEST_NO_CURSOR) +#if defined(Q_OS_DARWIN) || defined(Q_OS_WIN) || defined(QT_NO_CURSOR) QSKIP("Test case unstable on this platform"); #endif QGraphicsView view; @@ -3802,9 +3797,7 @@ void tst_QGraphicsProxyWidget::forwardTouchEvent() EventSpy eventSpy(widget); - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); + QTouchDevice *device = QTest::createTouchDevice(); QCOMPARE(eventSpy.counts[QEvent::TouchBegin], 0); QCOMPARE(eventSpy.counts[QEvent::TouchUpdate], 0); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro index 986ba019b4..351cecd92e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -4,18 +4,9 @@ QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicsscene.cpp RESOURCES += images.qrc -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 -!wince: DEFINES += SRCDIR=\\\"$$PWD\\\" +DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += QT_NO_CAST_TO_ASCII -wince* { - rootFiles.files = Ash_European.jpg graphicsScene_selection.data - rootFiles.path = . - renderFiles.files = testData\\render\\* - renderFiles.path = testData\\render - DEPLOYMENT += rootFiles renderFiles - DEFINES += SRCDIR=\\\".\\\" -} - RESOURCES += testdata.qrc diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index a346bb9d1f..d95f6e408e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -28,9 +28,6 @@ #include <QtTest/QtTest> -#if defined(Q_OS_WINCE) -#include <ceconfig.h> -#endif #include <QtGui> #include <QtWidgets> @@ -41,7 +38,7 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) #include <windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ @@ -170,7 +167,6 @@ class tst_QGraphicsScene : public QObject { Q_OBJECT public slots: - void initTestCase(); void cleanup(); private slots: @@ -271,15 +267,9 @@ private slots: void taskQT_3674_doNotCrash(); void taskQTBUG_15977_renderWithDeviceCoordinateCache(); void taskQTBUG_16401_focusItem(); + void taskQTBUG_42915_focusNextPrevChild(); }; -void tst_QGraphicsScene::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QGraphicsScene::cleanup() { // ensure not even skipped tests with custom input context leave it dangling @@ -1250,7 +1240,7 @@ void tst_QGraphicsScene::addText() void tst_QGraphicsScene::removeItem() { -#if (defined(Q_OS_WINCE) && !defined(GWES_ICONCURS)) || defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) QSKIP("No mouse cursor support"); #endif QGraphicsScene scene; @@ -1587,11 +1577,7 @@ void tst_QGraphicsScene::hoverEvents_siblings() QGraphicsView view(&scene); view.setRenderHint(QPainter::Antialiasing, true); -#if defined(Q_OS_WINCE) - view.setMinimumSize(230, 200); -#else view.setMinimumSize(400, 300); -#endif view.rotate(10); view.scale(1.7, 1.7); view.show(); @@ -1660,11 +1646,7 @@ void tst_QGraphicsScene::hoverEvents_parentChild() QGraphicsView view(&scene); view.setRenderHint(QPainter::Antialiasing, true); -#if defined(Q_OS_WINCE) - view.setMinimumSize(230, 200); -#else view.setMinimumSize(400, 300); -#endif view.rotate(10); view.scale(1.7, 1.7); view.show(); @@ -4834,5 +4816,29 @@ void tst_QGraphicsScene::taskQTBUG_16401_focusItem() QVERIFY(!scene.focusItem()); } +void tst_QGraphicsScene::taskQTBUG_42915_focusNextPrevChild() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + scene.setSceneRect(1, 1, 198, 198); + view.setFocus(); + + QGraphicsWidget *widget1 = new QGraphicsWidget(); + QGraphicsRectItem *rect1 = new QGraphicsRectItem(-50, -50, 100, 100, widget1); + rect1->setBrush(Qt::blue); + scene.addItem(widget1); + widget1->setPos(100, 100); + widget1->setFlags(QGraphicsItem::ItemIsPanel); + + QGraphicsWidget *widget2 = new QGraphicsWidget(widget1); + widget2->setFocusPolicy(Qt::NoFocus); + + view.show(); + QApplication::setActiveWindow(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); + + QTest::keyEvent(QTest::Click, &view, Qt::Key_Tab); +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 1df9a9434c..2ecc1120b9 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -57,7 +57,6 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#include "../../../qtest-config.h" #include "tst_qgraphicsview.h" Q_DECLARE_METATYPE(ExpectedValueDescription) @@ -146,7 +145,6 @@ public: : platformName(QGuiApplication::platformName().toLower()) { } private slots: - void initTestCase(); void cleanup(); void construction(); void renderHints(); @@ -202,7 +200,7 @@ private slots: #ifndef QT_NO_WHEELEVENT void wheelEvent(); #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void cursor(); void cursor2(); #endif @@ -266,7 +264,7 @@ private slots: void QTBUG_4151_clipAndIgnore_data(); void QTBUG_4151_clipAndIgnore(); void QTBUG_5859_exposedRect(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void QTBUG_7438_cursor(); #endif void hoverLeave(); @@ -279,13 +277,6 @@ private: QString platformName; }; -void tst_QGraphicsView::initTestCase() -{ -#ifdef Q_OS_WINCE_WM - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QGraphicsView::cleanup() { // ensure not even skipped tests with custom input context leave it dangling @@ -739,7 +730,7 @@ void tst_QGraphicsView::dragMode_scrollHand() for (int i = 0; i < 2; ++i) { // ScrollHandDrag -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR Qt::CursorShape cursorShape = view.viewport()->cursor().shape(); #endif int horizontalScrollBarValue = view.horizontalScrollBar()->value(); @@ -758,7 +749,7 @@ void tst_QGraphicsView::dragMode_scrollHand() QTRY_VERIFY(item->isSelected()); for (int k = 0; k < 4; ++k) { -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), Qt::ClosedHandCursor); #endif { @@ -801,7 +792,7 @@ void tst_QGraphicsView::dragMode_scrollHand() QTRY_VERIFY(item->isSelected()); QCOMPARE(view.horizontalScrollBar()->value(), horizontalScrollBarValue - 10); QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue - 10); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif @@ -861,7 +852,7 @@ void tst_QGraphicsView::dragMode_rubberBand() for (int i = 0; i < 2; ++i) { // RubberBandDrag -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR Qt::CursorShape cursorShape = view.viewport()->cursor().shape(); #endif int horizontalScrollBarValue = view.horizontalScrollBar()->value(); @@ -875,7 +866,7 @@ void tst_QGraphicsView::dragMode_rubberBand() QApplication::sendEvent(view.viewport(), &event); QVERIFY(event.isAccepted()); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif @@ -923,7 +914,7 @@ void tst_QGraphicsView::dragMode_rubberBand() } QCOMPARE(view.horizontalScrollBar()->value(), horizontalScrollBarValue); QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif @@ -1428,20 +1419,9 @@ void tst_QGraphicsView::fitInView() items[0]->setTransform(QTransform().rotate(30), true); items[1]->setTransform(QTransform().rotate(-30), true); -#if defined(Q_OS_WINCE) - //Is the standard scrollbar size - int scrollbarSize = qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) - 13; -#endif - QGraphicsView view(&scene); view.setSceneRect(-400, -400, 800, 800); - -#if defined(Q_OS_WINCE) - //We need to take in account the scrollbar size for the WindowsMobilStyle - view.setFixedSize(400 + scrollbarSize, 200 + scrollbarSize); -#else view.setFixedSize(400, 200); -#endif view.showNormal(); view.fitInView(scene.itemsBoundingRect(), Qt::IgnoreAspectRatio); @@ -1855,11 +1835,7 @@ void tst_QGraphicsView::mapToScene() QGraphicsView view(&topLevel); view.setScene(&scene); view.setSceneRect(-500, -500, 1000, 1000); -#if defined(Q_OS_WINCE) - QSize viewSize(200,200); -#else QSize viewSize(300,300); -#endif view.setFixedSize(viewSize); topLevel.show(); @@ -2266,7 +2242,7 @@ void tst_QGraphicsView::wheelEvent() } #endif // !QT_NO_WHEELEVENT -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsView::cursor() { QGraphicsScene scene; @@ -2290,7 +2266,7 @@ void tst_QGraphicsView::cursor() } #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsView::cursor2() { QGraphicsScene scene; @@ -3785,7 +3761,7 @@ void tst_QGraphicsView::mouseTracking() QGraphicsView view(&scene); QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR item->setCursor(Qt::CrossCursor); #endif scene.addItem(item); @@ -3795,7 +3771,7 @@ void tst_QGraphicsView::mouseTracking() // Adding an item to the scene before the scene is set on the view. QGraphicsScene scene(-10000, -10000, 20000, 20000); QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR item->setCursor(Qt::CrossCursor); #endif scene.addItem(item); @@ -3812,7 +3788,7 @@ void tst_QGraphicsView::mouseTracking() QGraphicsView view3(&scene); QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR item->setCursor(Qt::CrossCursor); #endif scene.addItem(item); @@ -4573,9 +4549,6 @@ void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() { -#if defined(Q_OS_WINCE) - QSKIP("Qt/CE does not implement mouse tracking at this point"); -#endif QGraphicsScene scene(-100, -100, 200, 200); scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue)); @@ -4767,7 +4740,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect() QCOMPARE(item.lastExposedRect, scene.lastBackgroundExposedRect); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsView::QTBUG_7438_cursor() { QGraphicsScene scene; diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index ca9f866e81..9e390e45a6 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -42,8 +42,6 @@ #include <qstylefactory.h> #include <qscreen.h> -#include "../../../qtest-config.h" - typedef QList<QGraphicsItem *> QGraphicsItemList; class EventSpy : public QObject @@ -1112,9 +1110,7 @@ void tst_QGraphicsWidget::initStyleOption() bool hasFocus = option.state & QStyle::State_HasFocus; QCOMPARE(hasFocus, focus); bool isUnderMouse = option.state & QStyle::State_MouseOver; -#ifndef Q_OS_WINCE QCOMPARE(isUnderMouse, underMouse); -#endif // if (layoutDirection != Qt::LeftToRight) //QEXPECT_FAIL("", "QApplicaiton::layoutDirection doesn't propagate to QGraphicsWidget", Continue); //QCOMPARE(option.direction, layoutDirection); @@ -2938,8 +2934,8 @@ protected: void tst_QGraphicsWidget::respectHFW() { -#if defined(Q_OS_WINCE) || defined(Q_OS_MAC) - QSKIP("This test is platform dependent, it fails on wince and mac. Please fix."); +#if defined(Q_OS_DARWIN) + QSKIP("This test is platform dependent, it fails on Apple platforms. Please fix."); #else QGraphicsScene scene; HFWWidget *window = new HFWWidget; @@ -3184,7 +3180,7 @@ void tst_QGraphicsWidget::itemChangeEvents() valueDuringEvents.insert(QEvent::ParentChange, QVariant::fromValue(parentItem())); break; } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR case QEvent::CursorChange: { valueDuringEvents.insert(QEvent::CursorChange, int(cursor().shape())); break; @@ -3235,7 +3231,7 @@ void tst_QGraphicsWidget::itemChangeEvents() QVERIFY(!item->isVisible()); QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Hide).toBool()); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR // CursorChange should be triggered after the cursor has changed item->setCursor(Qt::PointingHandCursor); QTRY_COMPARE(item->valueDuringEvents.value(QEvent::CursorChange).toInt(), int(item->cursor().shape())); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 89fb30557b..1050fa2561 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -197,7 +197,6 @@ public: void basic_tests(TestView *view); private slots: - void initTestCase(); void cleanup(); void getSetCheck(); void emptyModels_data(); @@ -356,13 +355,6 @@ void tst_QAbstractItemView::getSetCheck() QCOMPARE(16, obj1->autoScrollMargin()); } -void tst_QAbstractItemView::initTestCase() -{ -#ifdef Q_OS_WINCE_WM - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QAbstractItemView::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); @@ -1307,9 +1299,6 @@ void tst_QAbstractItemView::task250754_fontChange() void tst_QAbstractItemView::task200665_itemEntered() { -#ifdef Q_OS_WINCE_WM - QSKIP("On Windows Mobile the mouse tracking is unavailable at the moment"); -#endif //we test that view will emit entered //when the scrollbar move but not the mouse itself QStandardItemModel model(1000,1); diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index d717278be9..e6c4ab44f8 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -183,9 +183,6 @@ void tst_QColumnView::initTestCase() void tst_QColumnView::init() { qApp->setLayoutDirection(Qt::LeftToRight); -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif } void tst_QColumnView::rootIndex() diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index 5190598701..ea4e9d4620 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -13,7 +13,7 @@ wince* { DEPLOYMENT += addit tests sourceFile } -android|wince { +android { DEFINES += SRCDIR=\\\"./\\\" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index 06019d4555..30109952c7 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -575,7 +575,7 @@ void tst_QDirModel::filePath() model.setResolveSymlinks(false); QModelIndex index = model.index(SRCDIR "test.lnk"); QVERIFY(index.isValid()); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_ANDROID) +#if !defined(Q_OS_ANDROID) QString path = SRCDIR; #else QString path = QFileInfo(SRCDIR).absoluteFilePath(); diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 47ec93ce16..bc8b08997f 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -381,9 +381,6 @@ tst_QHeaderView::tst_QHeaderView() void tst_QHeaderView::initTestCase() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif m_tableview = new QTableView(); } @@ -554,11 +551,7 @@ void tst_QHeaderView::hidden() void tst_QHeaderView::stretch() { // Show before resize and setStretchLastSection -#if defined(Q_OS_WINCE) - QSize viewSize(200,300); -#else QSize viewSize(500, 500); -#endif view->resize(viewSize); view->setStretchLastSection(true); QCOMPARE(view->stretchLastSection(), true); @@ -618,12 +611,6 @@ void tst_QHeaderView::sectionSize() QFETCH(int, lastVisibleSectionSize); QFETCH(int, persistentSectionSize); -#ifdef Q_OS_WINCE - // We test on a device with doubled pixels. Therefore we need to specify - // different boundaries. - initialDefaultSize = qMax(view->minimumSectionSize(), 30); -#endif - // bounds check foreach (int val, boundsCheck) view->sectionSize(val); @@ -693,13 +680,7 @@ void tst_QHeaderView::visualIndexAt_data() QTest::addColumn<QList<int> >("visual"); QList<int> coordinateList; -#ifndef Q_OS_WINCE coordinateList << -1 << 0 << 31 << 91 << 99999; -#else - // We test on a device with doubled pixels. Therefore we need to specify - // different boundaries. - coordinateList << -1 << 0 << 33 << 97 << 99999; -#endif QTest::newRow("no hidden, no moved sections") << QList<int>() @@ -752,10 +733,6 @@ void tst_QHeaderView::visualIndexAt() void tst_QHeaderView::length() { -#if defined(Q_OS_WINCE) - QFont font(QLatin1String("Tahoma"), 7); - view->setFont(font); -#endif view->setStretchLastSection(true); topLevel->show(); QVERIFY(QTest::qWaitForWindowExposed(topLevel)); diff --git a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro index f7fb41e60c..9405c33a48 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro +++ b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro @@ -3,4 +3,4 @@ TARGET = tst_qitemdelegate QT += widgets testlib SOURCES += tst_qitemdelegate.cpp -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 34713bdff9..e67edfcccb 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -53,7 +53,7 @@ Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint) -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) #include <windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp index d3211eada8..1fd7b31e22 100644 --- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp +++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp @@ -32,42 +32,13 @@ #include "viewstotest.cpp" #include <stdlib.h> -#if defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) || defined(Q_OS_WIN) #include <time.h> #endif -#if defined(Q_OS_WIN) -#include <time.h> -#if defined(Q_OS_WINCE) -#include <aygshell.h> -#endif -#define random rand -#define srandom srand - -#if defined(Q_OS_WINCE) -#ifndef SPI_GETPLATFORMTYPE -#define SPI_GETPLATFORMTYPE 257 -#endif - -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} - -bool qt_wince_is_pocket_pc() { - return qt_wince_is_platform(QString::fromLatin1("PocketPC")); -} -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} -bool qt_wince_is_mobile() { - return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()); -} -#endif +#if defined(Q_OS_WIN) +# define random rand +# define srandom srand #endif /*! @@ -305,10 +276,6 @@ void tst_QItemView::nonDestructiveBasicTest_data() */ void tst_QItemView::nonDestructiveBasicTest() { -#ifdef Q_OS_WINCE - QTest::qWait(400); -#endif - QFETCH(QString, viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); @@ -476,11 +443,7 @@ void tst_QItemView::spider() view->setModel(treeModel); view->show(); QVERIFY(QTest::qWaitForWindowActive(view)); -#if defined(Q_OS_WINCE) - srandom(0); -#else srandom(time(0)); -#endif touch(view->viewport(), Qt::NoModifier, Qt::Key_Left); touch(view->viewport(), Qt::ShiftModifier, Qt::Key_Enter); touch(view->viewport(), Qt::ControlModifier, Qt::Key_Backspace); diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro index 509303b62e..44e25ded66 100644 --- a/tests/auto/widgets/itemviews/qlistview/qlistview.pro +++ b/tests/auto/widgets/itemviews/qlistview/qlistview.pro @@ -2,5 +2,5 @@ CONFIG += testcase TARGET = tst_qlistview QT += widgets gui-private widgets-private core-private testlib SOURCES += tst_qlistview.cpp -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 linux*: CONFIG += insignificant_test # Crashes diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 98cc9b29ed..0f1c5723d5 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -46,13 +46,13 @@ #include <QtWidgets/QStyleFactory> #include <QtWidgets/QVBoxLayout> -#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) # include <windows.h> # include <QtGui/QGuiApplication> #include <qpa/qplatformnativeinterface.h> #endif // Q_OS_WIN -#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) static inline HWND getHWNDForWidget(const QWidget *widget) { QWindow *window = widget->windowHandle(); @@ -84,7 +84,6 @@ class tst_QListView : public QObject Q_OBJECT private slots: - void initTestCase(); void cleanup(); void getSetCheck(); void noDelegate(); @@ -112,7 +111,7 @@ private slots: void scrollBarAsNeeded(); void moveItems(); void wordWrap(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void setCurrentIndexAfterAppendRowCrash(); #endif void emptyItemSize(); @@ -293,13 +292,6 @@ public: } }; -void tst_QListView::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QListView::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); @@ -984,25 +976,6 @@ void tst_QListView::selection_data() << QRect(300, 0, 1, 300) // selection rectangle << IntList(); // expected items -#if defined(Q_OS_WINCE) - // depending on whether the display is double-pixeld, we need - // to click at a different position - bool doubledSize = false; - int dpi = GetDeviceCaps(GetDC(0), LOGPIXELSX); - if ((dpi < 1000) && (dpi > 0)) { - doubledSize = true; - } - QTest::newRow("select inside contents, (on viewport)") - << 35 // itemCount - << int(QListView::ListMode) - << int(QListView::TopToBottom) - << true // wrapping - << 0 // spacing - << QSize() // gridSize - << IntList() // hiddenRows - << QRect(doubledSize?350:175,doubledSize?550:275, 1, 1)// selection rectangle - << IntList(); // expected items -#else QTest::newRow("select inside contents, (on viewport)") << 35 // itemCount << int(QListView::ListMode) @@ -1013,7 +986,6 @@ void tst_QListView::selection_data() << IntList() // hiddenRows << QRect(175, 275, 1, 1) // selection rectangle << IntList(); // expected items -#endif QTest::newRow("select a tall rect in LeftToRight flow, wrap items") << 70 // itemCount @@ -1138,17 +1110,7 @@ void tst_QListView::selection() v.setRowHidden(hiddenRows.at(j), true); } -#if defined(Q_OS_WINCE) - // If the device is double-pixeled then the scrollbars become - // 10 pixels wider than normal (Windows Style: 16, Windows Mobile Style: 26). - // So we have to make the window slightly bigger to have the same count of - // items in each row of the list view like in the other styles. - static const int dpi = ::GetDeviceCaps(GetDC(0), LOGPIXELSX); - if ((dpi < 1000) && (dpi > 0)) - v.resize(535,535); -#else v.resize(525,525); -#endif topLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); @@ -1450,7 +1412,7 @@ void tst_QListView::wordWrap() QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog { Q_OBJECT @@ -1501,7 +1463,7 @@ void tst_QListView::setCurrentIndexAfterAppendRowCrash() SetCurrentIndexAfterAppendRowCrashDialog w; w.exec(); } -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT void tst_QListView::emptyItemSize() { diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 7258044804..cf8ee310d3 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -61,8 +61,6 @@ class tst_QTableView : public QObject Q_OBJECT private slots: - void initTestCase(); - void getSetCheck(); void noDelegate(); @@ -520,13 +518,6 @@ public: QSize hint; }; -void tst_QTableView::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QTableView::noDelegate() { QtTestTableModel model(3, 3); @@ -3996,10 +3987,6 @@ void tst_QTableView::mouseWheel_data() void tst_QTableView::mouseWheel() { -#ifdef Q_OS_WINCE - QSKIP("Since different Windows CE versions sport different taskbars, we skip this test"); -#endif - QFETCH(int, scrollMode); QFETCH(int, delta); QFETCH(int, horizontalPositon); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 938c8a47ac..81ce1deca4 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -118,8 +118,6 @@ public slots: void selectionOrderTest(); private slots: - void initTestCase(); - void getSetCheck(); // one test per QTreeView property @@ -390,13 +388,6 @@ public: mutable QMap<QModelIndex,QModelIndex> parentHash; }; -void tst_QTreeView::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - // Testing get/set functions void tst_QTreeView::getSetCheck() { diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index 205067d89c..7796627bd9 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -42,15 +42,12 @@ class tst_QAction : public QObject public: tst_QAction(); - virtual ~tst_QAction(); - void updateState(QActionEvent *e); -public slots: - void initTestCase(); - void cleanupTestCase(); private slots: + void init(); + void cleanup(); void getSetCheck(); void setText_data(); void setText(); @@ -68,11 +65,26 @@ private slots: private: int m_lastEventType; - int m_keyboardScheme; + const int m_keyboardScheme; QAction *m_lastAction; - QWidget *m_tstWidget; }; +tst_QAction::tst_QAction() + : m_keyboardScheme(QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt()) +{ +} + +void tst_QAction::init() +{ + m_lastEventType = 0; + m_lastAction = nullptr; +} + +void tst_QAction::cleanup() +{ + QVERIFY(QApplication::topLevelWidgets().isEmpty()); +} + // Testing get/set functions void tst_QAction::getSetCheck() { @@ -104,46 +116,16 @@ class MyWidget : public QWidget { Q_OBJECT public: - MyWidget(tst_QAction *tst, QWidget *parent = 0) : QWidget(parent) { this->tst = tst; } + explicit MyWidget(tst_QAction *tst, QWidget *parent = nullptr) : QWidget(parent), m_test(tst) + { setWindowTitle(QTest::currentTestFunction()); } protected: - virtual void actionEvent(QActionEvent *e) { tst->updateState(e); } + void actionEvent(QActionEvent *e) override { m_test->updateState(e); } private: - tst_QAction *tst; + tst_QAction *m_test; }; -tst_QAction::tst_QAction() : m_keyboardScheme(QPlatformTheme::WindowsKeyboardScheme) -{ - if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) - m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt(); -} - -tst_QAction::~tst_QAction() -{ - -} - -void tst_QAction::initTestCase() -{ - m_lastEventType = 0; - m_lastAction = 0; - - MyWidget *mw = new MyWidget(this); - m_tstWidget = mw; - mw->show(); - qApp->setActiveWindow(mw); -} - -void tst_QAction::cleanupTestCase() -{ - QWidget *testWidget = m_tstWidget; - if (testWidget) { - testWidget->hide(); - delete testWidget; - } -} - void tst_QAction::setText_data() { QTest::addColumn<QString>("text"); @@ -208,7 +190,10 @@ void tst_QAction::actionEvent() a.setText("action text"); // add action - m_tstWidget->addAction(&a); + MyWidget testWidget(this); + testWidget.show(); + QApplication::setActiveWindow(&testWidget); + testWidget.addAction(&a); qApp->processEvents(); QCOMPARE(m_lastEventType, (int)QEvent::ActionAdded); @@ -222,7 +207,7 @@ void tst_QAction::actionEvent() QCOMPARE(m_lastAction, &a); // remove action - m_tstWidget->removeAction(&a); + testWidget.removeAction(&a); qApp->processEvents(); QCOMPARE(m_lastEventType, (int)QEvent::ActionRemoved); @@ -262,22 +247,24 @@ void tst_QAction::alternateShortcuts() { //test the alternate shortcuts (by adding more than 1 shortcut) - QWidget *wid = m_tstWidget; + MyWidget testWidget(this); + testWidget.show(); + QApplication::setActiveWindow(&testWidget); { - QAction act(wid); - wid->addAction(&act); + QAction act(&testWidget); + testWidget.addAction(&act); QList<QKeySequence> shlist = QList<QKeySequence>() << QKeySequence("CTRL+P") << QKeySequence("CTRL+A"); act.setShortcuts(shlist); QSignalSpy spy(&act, SIGNAL(triggered())); act.setAutoRepeat(true); - QTest::keyClick(wid, Qt::Key_A, Qt::ControlModifier); + QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier); QCOMPARE(spy.count(), 1); //act should have been triggered act.setAutoRepeat(false); - QTest::keyClick(wid, Qt::Key_A, Qt::ControlModifier); + QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier); QCOMPARE(spy.count(), 2); //act should have been triggered a 2nd time //end of the scope of the action, it will be destroyed and removed from wid @@ -286,11 +273,15 @@ void tst_QAction::alternateShortcuts() //this tests a crash (if the action did not unregister its alternate shortcuts) - QTest::keyClick(wid, Qt::Key_A, Qt::ControlModifier); + QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier); } void tst_QAction::enabledVisibleInteraction() { + MyWidget testWidget(this); + testWidget.show(); + QApplication::setActiveWindow(&testWidget); + QAction act(0); // check defaults QVERIFY(act.isEnabled()); @@ -305,20 +296,20 @@ void tst_QAction::enabledVisibleInteraction() QVERIFY(act.isVisible()); // check if shortcut is disabled if not visible - m_tstWidget->addAction(&act); + testWidget.addAction(&act); act.setShortcut(QKeySequence("Ctrl+T")); QSignalSpy spy(&act, SIGNAL(triggered())); act.setEnabled(true); act.setVisible(false); - QTest::keyClick(m_tstWidget, Qt::Key_T, Qt::ControlModifier); + QTest::keyClick(&testWidget, Qt::Key_T, Qt::ControlModifier); QCOMPARE(spy.count(), 0); //act is not visible, so don't trigger act.setVisible(false); act.setEnabled(true); - QTest::keyClick(m_tstWidget, Qt::Key_T, Qt::ControlModifier); + QTest::keyClick(&testWidget, Qt::Key_T, Qt::ControlModifier); QCOMPARE(spy.count(), 0); //act is not visible, so don't trigger act.setVisible(true); act.setEnabled(true); - QTest::keyClick(m_tstWidget, Qt::Key_T, Qt::ControlModifier); + QTest::keyClick(&testWidget, Qt::Key_T, Qt::ControlModifier); QCOMPARE(spy.count(), 1); //act is visible and enabled, so trigger } @@ -378,38 +369,42 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup() void tst_QAction::repeat() { - QWidget *wid = m_tstWidget; - QAction act(wid); - wid->addAction(&act); + MyWidget testWidget(this); + testWidget.show(); + QApplication::setActiveWindow(&testWidget); + QVERIFY(QTest::qWaitForWindowActive(&testWidget)); + + QAction act(&testWidget); + testWidget.addAction(&act); act.setShortcut(QKeySequence(Qt::Key_F)); QSignalSpy spy(&act, SIGNAL(triggered())); act.setAutoRepeat(true); - QTest::keyPress(wid, Qt::Key_F); - QTest::keyRelease(wid, Qt::Key_F); + QTest::keyPress(&testWidget, Qt::Key_F); + QTest::keyRelease(&testWidget, Qt::Key_F); QCOMPARE(spy.count(), 1); spy.clear(); - QTest::keyPress(wid, Qt::Key_F); + QTest::keyPress(&testWidget, Qt::Key_F); // repeat event - QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); - QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); - QTest::keyRelease(wid, Qt::Key_F); + QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::keyRelease(&testWidget, Qt::Key_F); QCOMPARE(spy.count(), 3); spy.clear(); act.setAutoRepeat(false); - QTest::keyPress(wid, Qt::Key_F); - QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); - QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); - QTest::keyRelease(wid, Qt::Key_F); + QTest::keyPress(&testWidget, Qt::Key_F); + QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::keyRelease(&testWidget, Qt::Key_F); QCOMPARE(spy.count(), 1); spy.clear(); act.setAutoRepeat(true); - QTest::keyPress(wid, Qt::Key_F); - QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); - QTest::keyRelease(wid, Qt::Key_F); + QTest::keyPress(&testWidget, Qt::Key_F); + QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::keyRelease(&testWidget, Qt::Key_F); QCOMPARE(spy.count(), 2); } diff --git a/tests/auto/widgets/kernel/qapplication/test/test.pro b/tests/auto/widgets/kernel/qapplication/test/test.pro index 908aa846c0..92409e4bfe 100644 --- a/tests/auto/widgets/kernel/qapplication/test/test.pro +++ b/tests/auto/widgets/kernel/qapplication/test/test.pro @@ -11,7 +11,7 @@ TESTDATA = ../test/test.pro ../tmp/README !winrt { SUBPROGRAMS = desktopsettingsaware modal - win32:!wince: SUBPROGRAMS += wincmdline + win32:SUBPROGRAMS += wincmdline for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}" } diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index b7e8cded7a..eda51e31a9 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -52,15 +52,9 @@ #include <QtWidgets/private/qapplication_p.h> #include <QtWidgets/QStyle> -#ifdef Q_OS_WINCE -#include <windows.h> -#endif - #include <qpa/qwindowsysteminterface.h> #include <private/qhighdpiscaling_p.h> -#include "../../../qtest-config.h" - QT_BEGIN_NAMESPACE static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt) { @@ -235,10 +229,6 @@ static char *argv0; tst_QApplication::tst_QApplication() : quitApplicationTriggered(false) { -#ifdef Q_OS_WINCE - // Clean up environment previously to launching test - qputenv("QT_PLUGIN_PATH", QByteArray()); -#endif } void tst_QApplication::cleanup() @@ -897,19 +887,8 @@ bool isPathListIncluded(const QStringList &l, const QStringList &r) #define QT_TST_QAPP_DEBUG void tst_QApplication::libraryPaths() { -#ifndef Q_OS_WINCE const QString testDir = QFileInfo(QFINDTESTDATA("test/test.pro")).absolutePath(); QVERIFY(!testDir.isEmpty()); -#else // !Q_OS_WINCE - // On Windows CE we need QApplication object to have valid - // current Path. Therefore we need to identify it ourselves - // here for the test. - QFileInfo filePath; - wchar_t module_name[MAX_PATH]; - GetModuleFileName(0, module_name, MAX_PATH); - filePath = QString::fromWCharArray(module_name); - const QString testDir = filePath.path() + "/test"; -#endif // Q_OS_WINCE { QApplication::setLibraryPaths(QStringList() << testDir); QCOMPARE(QApplication::libraryPaths(), (QStringList() << testDir)); @@ -1000,11 +979,7 @@ void tst_QApplication::libraryPaths() QString appDirPath = app.applicationDirPath(); app.addLibraryPath(appDirPath); -#ifdef Q_OS_WINCE - app.addLibraryPath(appDirPath + "/../.."); -#else app.addLibraryPath(appDirPath + "/.."); -#endif #ifdef QT_TST_QAPP_DEBUG qDebug() << "appDirPath" << appDirPath; qDebug() << "After adding appDirPath && appDirPath + /..:" << app.libraryPaths(); @@ -1044,15 +1019,9 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() QByteArray nonExistentPath = "/nonexistent"; QByteArray pluginPath = validPath + ':' + nonExistentPath; #elif defined(Q_OS_WIN) -# ifdef Q_OS_WINCE - QByteArray validPath = "/Temp"; - QByteArray nonExistentPath = "/nonexistent"; - QByteArray pluginPath = validPath + ';' + nonExistentPath; -# else QByteArray validPath = "C:\\windows"; QByteArray nonExistentPath = "Z:\\nonexistent"; QByteArray pluginPath = validPath + ';' + nonExistentPath; -# endif #endif { @@ -1069,9 +1038,7 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() << QLibraryInfo::location(QLibraryInfo::PluginsPath) << QDir(app.applicationDirPath()).canonicalPath() << QDir(QDir::fromNativeSeparators(QString::fromLatin1(validPath))).canonicalPath(); -# ifdef Q_OS_WINCE - expected = QSet<QString>::fromList(expected).toList(); -# endif + QVERIFY2(isPathListIncluded(app.libraryPaths(), expected), qPrintable("actual:\n - " + app.libraryPaths().join("\n - ") + "\nexpected:\n - " + expected.join("\n - "))); @@ -1091,9 +1058,6 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() QStringList() << QLibraryInfo::location(QLibraryInfo::PluginsPath) << app.applicationDirPath(); -# ifdef Q_OS_WINCE - expected = QSet<QString>::fromList(expected).toList(); -# endif QVERIFY(isPathListIncluded(app.libraryPaths(), expected)); qputenv("QT_PLUGIN_PATH", QByteArray()); @@ -1479,10 +1443,6 @@ void tst_QApplication::desktopSettingsAware() } QVERIFY2(!path.isEmpty(), "Cannot locate desktopsettingsaware helper application"); path += "desktopsettingsaware"; -#ifdef Q_OS_WINCE - int argc = 0; - QApplication tmpApp(argc, 0); -#endif QProcess testProcess; testProcess.start(path); QVERIFY2(testProcess.waitForStarted(), @@ -1974,9 +1934,7 @@ void tst_QApplication::touchEventPropagation() release.setState(Qt::TouchPointReleased); releasedTouchPoints << release; - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); + QTouchDevice *device = QTest::createTouchDevice(); { // touch event behavior on a window @@ -2331,7 +2289,7 @@ Q_GLOBAL_STATIC(QPixmap, tst_qapp_pixmap); Q_GLOBAL_STATIC(QFont, tst_qapp_font); Q_GLOBAL_STATIC(QRegion, tst_qapp_region); Q_GLOBAL_STATIC(QFontDatabase, tst_qapp_fontDatabase); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR Q_GLOBAL_STATIC(QCursor, tst_qapp_cursor); #endif @@ -2356,7 +2314,7 @@ void tst_QApplication::globalStaticObjectDestruction() QVERIFY(tst_qapp_font()); QVERIFY(tst_qapp_region()); QVERIFY(tst_qapp_fontDatabase()); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QVERIFY(tst_qapp_cursor()); #endif } diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index a19f4aea56..b7ca5d21c7 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -84,6 +84,12 @@ private slots: void insertRow_QString_QLayout(); void insertRow_QWidget(); void insertRow_QLayout(); + void removeRow(); + void removeRow_QWidget(); + void removeRow_QLayout(); + void takeRow(); + void takeRow_QWidget(); + void takeRow_QLayout(); void setWidget(); void setLayout(); @@ -687,6 +693,237 @@ void tst_QFormLayout::insertRow_QLayout() // ### come back to this later } +void tst_QFormLayout::removeRow() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QWidget> w1 = new QWidget; + QPointer<QWidget> w2 = new QWidget; + + layout->addRow("test1", w1); + layout->addRow(w2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + layout->removeRow(1); + + QVERIFY(!w1); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + layout->removeRow(0); + + QVERIFY(!w2); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); +} + +void tst_QFormLayout::removeRow_QWidget() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QWidget> w1 = new QWidget; + QPointer<QWidget> w2 = new QWidget; + + layout->addRow("test1", w1); + layout->addRow(w2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + layout->removeRow(w1); + + QVERIFY(!w1); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + layout->removeRow(w2); + + QVERIFY(!w2); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QWidget *w3 = new QWidget; + layout->removeRow(w3); + delete w3; +} + +void tst_QFormLayout::removeRow_QLayout() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QHBoxLayout> l1 = new QHBoxLayout; + QPointer<QWidget> w1 = new QWidget; + l1->addWidget(w1); + QPointer<QHBoxLayout> l2 = new QHBoxLayout; + QPointer<QWidget> w2 = new QWidget; + l2->addWidget(w2); + + layout->addRow("test1", l1); + layout->addRow(l2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + layout->removeRow(l1); + + QVERIFY(!l1); + QVERIFY(!w1); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + layout->removeRow(l2); + + QVERIFY(!l2); + QVERIFY(!w2); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QHBoxLayout *l3 = new QHBoxLayout; + layout->removeRow(l3); + delete l3; +} + +void tst_QFormLayout::takeRow() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QWidget> w1 = new QWidget; + QPointer<QWidget> w2 = new QWidget; + + layout->addRow("test1", w1); + layout->addRow(w2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + QFormLayout::TakeRowResult result = layout->takeRow(1); + + QVERIFY(w2); + QVERIFY(result.fieldItem); + QVERIFY(result.labelItem); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + result = layout->takeRow(0); + + QVERIFY(w1); + QVERIFY(result.fieldItem); + QVERIFY(!result.labelItem); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + result = layout->takeRow(0); + + QVERIFY(!result.fieldItem); + QVERIFY(!result.labelItem); +} + +void tst_QFormLayout::takeRow_QWidget() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QWidget> w1 = new QWidget; + QPointer<QWidget> w2 = new QWidget; + + layout->addRow("test1", w1); + layout->addRow(w2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + QFormLayout::TakeRowResult result = layout->takeRow(w1); + + QVERIFY(w1); + QVERIFY(result.fieldItem); + QVERIFY(result.labelItem); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + result = layout->takeRow(w2); + + QVERIFY(w2); + QVERIFY(result.fieldItem); + QVERIFY(!result.labelItem); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QWidget *w3 = new QWidget; + result = layout->takeRow(w3); + delete w3; + + QVERIFY(!result.fieldItem); + QVERIFY(!result.labelItem); +} + +void tst_QFormLayout::takeRow_QLayout() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QHBoxLayout> l1 = new QHBoxLayout; + QPointer<QWidget> w1 = new QWidget; + l1->addWidget(w1); + QPointer<QHBoxLayout> l2 = new QHBoxLayout; + QPointer<QWidget> w2 = new QWidget; + l2->addWidget(w2); + + layout->addRow("test1", l1); + layout->addRow(l2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + QFormLayout::TakeRowResult result = layout->takeRow(l1); + + QVERIFY(l1); + QVERIFY(w1); + QVERIFY(result.fieldItem); + QVERIFY(result.labelItem); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + result = layout->takeRow(l2); + + QVERIFY(l2); + QVERIFY(w2); + QVERIFY(result.fieldItem); + QVERIFY(!result.labelItem); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QHBoxLayout *l3 = new QHBoxLayout; + result = layout->takeRow(l3); + delete l3; + + QVERIFY(!result.fieldItem); + QVERIFY(!result.labelItem); +} + void tst_QFormLayout::setWidget() { QFormLayout layout; diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index 07dcfca28f..3c4c1a1d41 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -56,7 +56,6 @@ class tst_QGridLayout : public QObject Q_OBJECT private slots: - void initTestCase(); void cleanup(); void getItemPosition(); void itemAtPosition(); @@ -81,17 +80,11 @@ private slots: void taskQTBUG_27420_takeAtShouldUnparentLayout(); void taskQTBUG_40609_addingWidgetToItsOwnLayout(); void taskQTBUG_40609_addingLayoutToItself(); + void taskQTBUG_52357_spacingWhenItemIsHidden(); void replaceWidget(); void dontCrashWhenExtendsToEnd(); }; -void tst_QGridLayout::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - static inline int visibleTopLevelWidgetCount() { int result= 0; @@ -603,19 +596,6 @@ void tst_QGridLayout::spacingsAndMargins_data() << QPoint( 20, child_offset_y) << QPoint( 20, child_offset_y + 100 + 6) ); -#if defined (Q_OS_WINCE) //There is not enough screenspace to run the test in original size on Windows CE. We use smaller widgets. - child_offset_y = 11 + 9 + 50 + 6 + 50 + 6 + 50 + 6; - QTest::newRow("1x3 grid") << 1 << 3 << QSize(50, 50) - << (PointList() // toplevel - << QPoint( 11, 11) - << QPoint( 11, 11 + 50 + 6) - << QPoint( 11, 11 + 50 + 6 + 50 + 6) - // children - << QPoint( 20, child_offset_y) - << QPoint( 20, child_offset_y + 50 + 6) - << QPoint( 20, child_offset_y + 50 + 6 + 50 + 6) - ); -#else child_offset_y = 11 + 9 + 100 + 6 + 100 + 6 + 100 + 6; QTest::newRow("1x3 grid") << 1 << 3 << QSize(100, 100) << (PointList() // toplevel @@ -627,7 +607,6 @@ void tst_QGridLayout::spacingsAndMargins_data() << QPoint( 20, child_offset_y + 100 + 6) << QPoint( 20, child_offset_y + 100 + 6 + 100 + 6) ); -#endif child_offset_y = 11 + 9 + 100 + 6 + 100 + 6; QTest::newRow("2x2 grid") << 2 << 2 << QSize(100, 100) @@ -1672,6 +1651,26 @@ void tst_QGridLayout::taskQTBUG_40609_addingLayoutToItself(){ QCOMPARE(layout.count(), 0); } +void tst_QGridLayout::taskQTBUG_52357_spacingWhenItemIsHidden() +{ + QWidget widget; + setFrameless(&widget); + QGridLayout layout(&widget); + layout.setMargin(0); + layout.setSpacing(5); + QPushButton button1; + layout.addWidget(&button1, 0, 0); + QPushButton button2; + layout.addWidget(&button2, 0, 1); + QPushButton button3; + layout.addWidget(&button3, 0, 2); + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + int tempWidth = button1.width() + button2.width() + button3.width() + 2 * layout.spacing(); + button2.hide(); + QTRY_COMPARE_WITH_TIMEOUT(tempWidth, button1.width() + button3.width() + layout.spacing(), 1000); +} + void tst_QGridLayout::replaceWidget() { QWidget wdg; diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index 2213767950..d460785158 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -4,13 +4,7 @@ TARGET = tst_qlayout QT += widgets widgets-private testlib SOURCES += tst_qlayout.cpp -wince* { - addFiles.files = baseline - addFiles.path = . - DEPLOYMENT += addFiles -} else { - TESTDATA += baseline/* -} +TESTDATA += baseline/* android { RESOURCES += \ diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 98a4caf49e..3346fb131c 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -53,6 +53,7 @@ osx osx [maskedUpdate] osx +opensuse-42.1 [hideWhenFocusWidgetIsChild] osx-10.10 [hideOpaqueChildWhileHidden] diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro index a3fd622896..ba4e51a416 100644 --- a/tests/auto/widgets/kernel/qwidget/qwidget.pro +++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro @@ -20,4 +20,4 @@ x11 { LIBS += $$QMAKE_LIBS_X11 } -win32:!wince:!winrt: LIBS += -luser32 -lgdi32 +win32:!winrt: LIBS += -luser32 -lgdi32 diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 98b630b49d..e19e9e5bf1 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -67,15 +67,13 @@ #include <QtGui/qwindow.h> #include <qtimer.h> -#include "../../../qtest-config.h" - #if defined(Q_OS_OSX) #include "tst_qwidget_mac_helpers.h" // Abstract the ObjC stuff out so not everyone must run an ObjC++ compile. #endif #include <QtTest/QTest> -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include <QtCore/qt_windows.h> # include <QtGui/private/qguiapplication_p.h> #include <qpa/qplatformnativeinterface.h> @@ -91,49 +89,12 @@ static HWND winHandleOf(const QWidget *w) return 0; } -# ifdef Q_OS_WINCE -# define Q_CHECK_PAINTEVENTS -# ifdef Q_OS_WINCE_WM -# include <qguifunctions_wince.h> -// taken from qguifunctions_wce.cpp -# define SPI_GETPLATFORMTYPE 257 -static bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} -static inline bool qt_wince_is_smartphone() { return qt_wince_is_platform(QString::fromLatin1("Smartphone")); } -# endif // Q_OS_WINCE_WM -# elif !defined(Q_OS_WINRT) // Q_OS_WINCE -# define Q_CHECK_PAINTEVENTS \ +# define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ QSKIP("desktop is not visible, this test would fail"); -# else // !Q_OS_WINCE && !Q_OS_WINRT -# define Q_CHECK_PAINTEVENTS -# endif // Q_OS_WINRT -#else // Q_OS_WIN + +#else // Q_OS_WIN && !Q_OS_WINRT # define Q_CHECK_PAINTEVENTS -#endif // else Q_OS_WIN - - -#if defined(Q_OS_WINCE_WM) -#include <qguifunctions_wince.h> -// taken from qguifunctions_wce.cpp -#define SPI_GETPLATFORMTYPE 257 -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} #endif #ifdef Q_OS_OSX @@ -163,7 +124,7 @@ static inline void centerOnScreen(QWidget *w) w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) static inline void setWindowsAnimationsEnabled(bool enabled) { ANIMATIONINFO animation = { sizeof(ANIMATIONINFO), enabled }; @@ -176,10 +137,10 @@ static inline bool windowsAnimationsEnabled() SystemParametersInfo(SPI_GETANIMATION, 0, &animation, 0); return animation.iMinAnimate; } -#else // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#else // Q_OS_WIN && !Q_OS_WINRT inline void setWindowsAnimationsEnabled(bool) {} static inline bool windowsAnimationsEnabled() { return false; } -#endif // !Q_OS_WIN || Q_OS_WINCE || Q_OS_WINRT +#endif // !Q_OS_WIN || Q_OS_WINRT template <class T> static QByteArray msgComparisonFailed(T v1, const char *op, T v2) @@ -212,8 +173,6 @@ public: public slots: void initTestCase(); - void cleanupTestCase(); - void init(); void cleanup(); private slots: void getSetCheck(); @@ -251,9 +210,7 @@ private slots: void hideWhenFocusWidgetIsChild(); void normalGeometry(); void setGeometry(); -#ifndef Q_OS_WINCE void windowOpacity(); -#endif void raise(); void lower(); void stackUnder(); @@ -314,7 +271,7 @@ private slots: void subtractOpaqueSiblings(); -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) void setGeometry_win(); #endif @@ -322,7 +279,7 @@ private slots: void deleteStyle(); void multipleToplevelFocusCheck(); void setFocus(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void setCursor(); #endif void setToolTip(); @@ -339,9 +296,7 @@ private slots: void render_task188133(); void render_task211796(); void render_task217815(); -#ifndef Q_OS_WINCE void render_windowOpacity(); -#endif void render_systemClip(); void render_systemClip2_data(); void render_systemClip2(); @@ -357,9 +312,7 @@ private slots: void repaintWhenChildDeleted(); void hideOpaqueChildWhileHidden(); -#if !defined(Q_OS_WINCE) void updateWhileMinimized(); -#endif void alienWidgets(); void adjustSize(); void adjustSize_data(); @@ -394,7 +347,7 @@ private slots: void setClearAndResizeMask(); void maskedUpdate(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void syntheticEnterLeave(); void taskQTBUG_4055_sendSyntheticEnterLeave(); void underMouse(); @@ -406,9 +359,7 @@ private slots: void toplevelLineEditFocus(); void focusWidget_task254563(); -#ifndef Q_OS_WINCE_WM void rectOutsideCoordinatesLimit_task144779(); -#endif void setGraphicsEffect(); #ifdef QT_BUILD_INTERNAL @@ -457,13 +408,13 @@ private slots: private: bool ensureScreenSize(int width, int height); - QWidget *testWidget; const QString m_platform; QSize m_testWidgetSize; QPoint m_availableTopLeft; QPoint m_safeCursorPos; const bool m_windowsAnimationsEnabled; + QTouchDevice *m_touchScreen; }; bool tst_QWidget::ensureScreenSize(int width, int height) @@ -611,7 +562,7 @@ void tst_QWidget::getSetCheck() QCOMPARE(true, obj1.autoFillBackground()); var1.reset(); -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) obj1.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); const HWND handle = reinterpret_cast<HWND>(obj1.winId()); // explicitly create window handle QVERIFY(GetWindowLong(handle, GWL_STYLE) & WS_POPUP); @@ -622,6 +573,7 @@ tst_QWidget::tst_QWidget() : m_platform(QGuiApplication::platformName().toLower()) , m_safeCursorPos(0, 0) , m_windowsAnimationsEnabled(windowsAnimationsEnabled()) + , m_touchScreen(QTest::createTouchDevice()) { if (m_windowsAnimationsEnabled) // Disable animations which can interfere with screen grabbing in moveChild(), showAndMoveChild() setWindowsAnimationsEnabled(false); @@ -634,8 +586,6 @@ tst_QWidget::tst_QWidget() palette.setColor(QPalette::ToolTipBase, QColor(12, 13, 14)); palette.setColor(QPalette::Text, QColor(21, 22, 23)); qApp->setPalette(palette, "QPropagationTestWidget"); - - testWidget = 0; } tst_QWidget::~tst_QWidget() @@ -656,9 +606,6 @@ private: void tst_QWidget::initTestCase() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif // Size of reference widget, 200 for < 2000, scale up for larger screens // to avoid Windows warnings about minimum size for decorated windows. int width = 200; @@ -674,122 +621,23 @@ void tst_QWidget::initTestCase() if (screenWidth > 2000) width = 100 * ((screenWidth + 500) / 1000); m_testWidgetSize = QSize(width, width); - // Create the test class - testWidget = new BezierViewer; - testWidget->setWindowTitle(QStringLiteral("BezierViewer")); - testWidget->move(m_availableTopLeft + QPoint(screenWidth / 3, 50)); - testWidget->resize(m_testWidgetSize); - testWidget->show(); - QVERIFY(QTest::qWaitForWindowExposed(testWidget)); -} - -void tst_QWidget::cleanupTestCase() -{ - delete testWidget; - testWidget = 0; -} - -void tst_QWidget::init() -{ -// TODO: Add initialization code here. -// This will be executed immediately before each test is run. - testWidget->setFont(QFont()); - testWidget->setPalette(QPalette()); } void tst_QWidget::cleanup() { - // Only 'testwidget', do not leak any other widgets. - QCOMPARE(QApplication::topLevelWidgets().size(), 1); -} - -// Helper class... - -BezierViewer::BezierViewer( QWidget* parent) - : QWidget(parent) -{ - setObjectName(QLatin1String("TestWidget")); - setWindowTitle(objectName()); - QPalette pal; - pal.setColor(backgroundRole(), Qt::white); - setPalette(pal); -} - - -void BezierViewer::setPoints( const QPolygonF& a ) -{ - points = a; -} - -#include "private/qbezier_p.h" -void BezierViewer::paintEvent( QPaintEvent* ) -{ - if ( points.size() != 4 ) { -#if defined(QT_CHECK_RANGE) - qWarning( "QPolygon::bezier: The array must have 4 control points" ); -#endif - return; - } - - /* Calculate Bezier curve */ - QPolygonF bezier = QBezier::fromPoints(points.at(0),points.at(1),points.at(2),points.at(3)).toPolygon(); - - QPainter painter( this ); - - /* Calculate scale to fit in window */ - QRectF br = bezier.boundingRect() | points.boundingRect(); - QRectF pr = rect(); - int scl = qMax( qMin(pr.width()/br.width(), pr.height()/br.height()), qreal(1.) ); - int border = scl-1; - - /* Scale Bezier curve vertices */ - for ( QPolygonF::Iterator it = bezier.begin(); it != bezier.end(); ++it ) { - it->setX( (it->x()-br.x()) * scl + border ); - it->setY( (it->y()-br.y()) * scl + border ); - } - - /* Draw grid */ - painter.setPen( Qt::lightGray ); - int i; - for ( i = border; i <= pr.width(); i += scl ) { - painter.drawLine( i, 0, i, pr.height() ); - } - for ( int j = border; j <= pr.height(); j += scl ) { - painter.drawLine( 0, j, pr.width(), j ); - } - - /* Write number of vertices */ - painter.setPen( Qt::red ); - painter.setFont( QFont("Helvetica", 14, QFont::DemiBold, true ) ); - QString caption; - caption.setNum( bezier.size() ); - caption += QString::fromLatin1( " vertices" ); - painter.drawText( 10, pr.height()-10, caption ); - - /* Draw Bezier curve */ - painter.setPen( Qt::black ); - painter.drawPolyline( bezier ); - - /* Scale and draw control points */ - painter.setPen( Qt::darkGreen ); - for ( QPolygonF::Iterator p1 = points.begin(); p1 != points.end(); ++p1 ) { - int x = (p1->x()-br.x()) * scl + border; - int y = (p1->y()-br.y()) * scl + border; - painter.drawLine( x-4, y-4, x+4, y+4 ); - painter.drawLine( x+4, y-4, x-4, y+4 ); - } - - /* Draw vertices */ - painter.setPen( Qt::red ); - painter.setBrush( Qt::red ); - for ( QPolygonF::Iterator p2 = bezier.begin(); p2 != bezier.end(); ++p2 ) - painter.drawEllipse( p2->x()-1, p2->y()-1, 3, 3 ); + QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void tst_QWidget::fontPropagation() { + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->resize(m_testWidgetSize); + testWidget->setWindowTitle(__FUNCTION__); + centerOnScreen(testWidget.data()); + testWidget->show(); + QVERIFY(QTest::qWaitForWindowExposed(testWidget.data())); QFont font = testWidget->font(); - QWidget* childWidget = new QWidget( testWidget ); + QWidget* childWidget = new QWidget( testWidget.data() ); childWidget->show(); QCOMPARE( font, childWidget->font() ); @@ -820,7 +668,7 @@ void tst_QWidget::fontPropagation() font.setPointSize(font.pointSize() + 2); testWidget->setFont(font); - QWidget *one = new QWidget(testWidget); + QWidget *one = new QWidget(testWidget.data()); QWidget *two = new QWidget(one); QWidget *three = new QWidget(two); QWidget *four = new QWidget(two); @@ -976,8 +824,15 @@ void tst_QWidget::fontPropagation2() void tst_QWidget::palettePropagation() { + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->resize(m_testWidgetSize); + testWidget->setWindowTitle(__FUNCTION__); + centerOnScreen(testWidget.data()); + testWidget->show(); + QVERIFY(QTest::qWaitForWindowExposed(testWidget.data())); + QPalette palette = testWidget->palette(); - QWidget* childWidget = new QWidget( testWidget ); + QWidget* childWidget = new QWidget( testWidget.data() ); childWidget->show(); QCOMPARE( palette, childWidget->palette() ); @@ -1110,7 +965,13 @@ void tst_QWidget::palettePropagation2() void tst_QWidget::enabledPropagation() { - QWidget* childWidget = new QWidget( testWidget ); + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->resize(m_testWidgetSize); + testWidget->setWindowTitle(__FUNCTION__); + centerOnScreen(testWidget.data()); + testWidget->show(); + QVERIFY(QTest::qWaitForWindowExposed(testWidget.data())); + QWidget* childWidget = new QWidget( testWidget.data() ); childWidget->show(); QVERIFY( testWidget->isEnabled() ); QVERIFY( childWidget->isEnabled() ); @@ -1193,7 +1054,13 @@ void tst_QWidget::properTabHandlingWhenDisabled_QTBUG27417() #ifndef QT_NO_DRAGANDDROP void tst_QWidget::acceptDropsPropagation() { - QWidget *childWidget = new QWidget(testWidget); + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->resize(m_testWidgetSize); + testWidget->setWindowTitle(__FUNCTION__); + centerOnScreen(testWidget.data()); + testWidget->show(); + QVERIFY(QTest::qWaitForWindowExposed(testWidget.data())); + QWidget *childWidget = new QWidget(testWidget.data()); childWidget->show(); QVERIFY(!testWidget->acceptDrops()); QVERIFY(!childWidget->acceptDrops()); @@ -1240,32 +1107,38 @@ void tst_QWidget::acceptDropsPropagation() void tst_QWidget::isEnabledTo() { - QWidget* childWidget = new QWidget( testWidget ); + QWidget testWidget; + testWidget.resize(m_testWidgetSize); + testWidget.setWindowTitle(__FUNCTION__); + centerOnScreen(&testWidget); + testWidget.show(); + QWidget* childWidget = new QWidget( &testWidget ); QWidget* grandChildWidget = new QWidget( childWidget ); - QVERIFY( childWidget->isEnabledTo( testWidget ) ); - QVERIFY( grandChildWidget->isEnabledTo( testWidget ) ); + QVERIFY( childWidget->isEnabledTo( &testWidget ) ); + QVERIFY( grandChildWidget->isEnabledTo( &testWidget ) ); childWidget->setEnabled( false ); - QVERIFY( !childWidget->isEnabledTo( testWidget ) ); + QVERIFY( !childWidget->isEnabledTo( &testWidget ) ); QVERIFY( grandChildWidget->isEnabledTo( childWidget ) ); - QVERIFY( !grandChildWidget->isEnabledTo( testWidget ) ); + QVERIFY( !grandChildWidget->isEnabledTo( &testWidget ) ); - QScopedPointer<QMainWindow> childDialog(new QMainWindow(testWidget)); - testWidget->setEnabled(false); + QScopedPointer<QMainWindow> childDialog(new QMainWindow(&testWidget)); + testWidget.setEnabled(false); QVERIFY(!childDialog->isEnabled()); QVERIFY(childDialog->isEnabledTo(0)); - testWidget->setEnabled(true); } void tst_QWidget::visible() { // Ensure that the testWidget is hidden for this test at the // start - - testWidget->hide(); + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->resize(m_testWidgetSize); + testWidget->setWindowTitle(__FUNCTION__); + centerOnScreen(testWidget.data()); QVERIFY( !testWidget->isVisible() ); - QWidget* childWidget = new QWidget( testWidget ); + QWidget* childWidget = new QWidget( testWidget.data() ); QVERIFY( !childWidget->isVisible() ); testWidget->show(); @@ -1331,11 +1204,16 @@ void tst_QWidget::setLocale() void tst_QWidget::visible_setWindowOpacity() { - testWidget->hide(); + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->resize(m_testWidgetSize); + testWidget->setWindowTitle(__FUNCTION__); + centerOnScreen(testWidget.data()); + testWidget->winId(); + QVERIFY( !testWidget->isVisible() ); testWidget->setWindowOpacity(0.5); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) - QVERIFY(!::IsWindowVisible(winHandleOf(testWidget))); + QVERIFY(!::IsWindowVisible(winHandleOf(testWidget.data()))); #endif testWidget->setWindowOpacity(1.0); } @@ -1344,35 +1222,40 @@ void tst_QWidget::isVisibleTo() { // Ensure that the testWidget is hidden for this test at the // start + QWidget testWidget; + testWidget.resize(m_testWidgetSize); + testWidget.setWindowTitle(__FUNCTION__); + centerOnScreen(&testWidget); - testWidget->hide(); - QWidget* childWidget = new QWidget( testWidget ); - QVERIFY( childWidget->isVisibleTo( testWidget ) ); + QWidget* childWidget = new QWidget( &testWidget ); + QVERIFY( childWidget->isVisibleTo( &testWidget ) ); childWidget->hide(); - QVERIFY( !childWidget->isVisibleTo( testWidget ) ); + QVERIFY( !childWidget->isVisibleTo( &testWidget ) ); QWidget* grandChildWidget = new QWidget( childWidget ); - QVERIFY( !grandChildWidget->isVisibleTo( testWidget ) ); + QVERIFY( !grandChildWidget->isVisibleTo( &testWidget ) ); QVERIFY( grandChildWidget->isVisibleTo( childWidget ) ); - testWidget->show(); + testWidget.show(); childWidget->show(); - QVERIFY( childWidget->isVisibleTo( testWidget ) ); + QVERIFY( childWidget->isVisibleTo( &testWidget ) ); grandChildWidget->hide(); QVERIFY( !grandChildWidget->isVisibleTo( childWidget ) ); - QVERIFY( !grandChildWidget->isVisibleTo( testWidget ) ); - + QVERIFY( !grandChildWidget->isVisibleTo( &testWidget ) ); } void tst_QWidget::isHidden() { // Ensure that the testWidget is hidden for this test at the // start + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->resize(m_testWidgetSize); + testWidget->setWindowTitle(__FUNCTION__); + centerOnScreen(testWidget.data()); - testWidget->hide(); QVERIFY( testWidget->isHidden() ); - QWidget* childWidget = new QWidget( testWidget ); + QWidget* childWidget = new QWidget( testWidget.data() ); QVERIFY( !childWidget->isHidden() ); testWidget->show(); @@ -1405,8 +1288,15 @@ void tst_QWidget::isHidden() void tst_QWidget::fonts() { + QWidget testWidget; + testWidget.resize(m_testWidgetSize); + testWidget.setWindowTitle(__FUNCTION__); + centerOnScreen(&testWidget); + testWidget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&testWidget)); + // Tests setFont(), ownFont() and unsetFont() - QWidget* cleanTestWidget = new QWidget( testWidget ); + QWidget* cleanTestWidget = new QWidget( &testWidget ); QFont originalFont = cleanTestWidget->font(); QVERIFY( !cleanTestWidget->testAttribute(Qt::WA_SetFont) ); @@ -1415,7 +1305,7 @@ void tst_QWidget::fonts() QFont newFont( "times", 18 ); cleanTestWidget->setFont( newFont ); - newFont = newFont.resolve( testWidget->font() ); + newFont = newFont.resolve( testWidget.font() ); QVERIFY( cleanTestWidget->testAttribute(Qt::WA_SetFont) ); QVERIFY2( cleanTestWidget->font() == newFont, @@ -1512,7 +1402,7 @@ void tst_QWidget::mapFromAndTo() subWindow2->setGeometry(75, 75, 100, 100); subSubWindow->setGeometry(10, 10, 10, 10); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) +#if !defined(Q_OS_QNX) //update visibility if (windowMinimized) { if (!windowHidden) { @@ -1692,7 +1582,6 @@ void tst_QWidget::focusChainOnReparent() void tst_QWidget::focusChainOnHide() { - testWidget->hide(); // We do not want to get disturbed by other widgets // focus should move to the next widget in the focus chain when we hide it. QScopedPointer<QWidget> parent(new QWidget()); parent->setObjectName(QLatin1String("focusChainOnHide")); @@ -1716,8 +1605,6 @@ void tst_QWidget::focusChainOnHide() QTRY_COMPARE(parent->hasFocus(), true); QCOMPARE(parent.data(), qApp->focusWidget()); - - testWidget->show(); //don't disturb later tests } class Container : public QWidget @@ -1825,15 +1712,8 @@ void tst_QWidget::activation() { Q_CHECK_PAINTEVENTS -#if defined(Q_OS_WINCE) - int waitTime = 1000; -#else int waitTime = 100; -#endif -#ifdef Q_OS_WINCE - qApp->processEvents(); -#endif QWidget widget1; widget1.setObjectName("activation-Widget1"); widget1.setWindowTitle(widget1.objectName()); @@ -1885,10 +1765,6 @@ void tst_QWidget::windowState() size = QGuiApplication::primaryScreen()->size(); } else { pos = QPoint(10, 10); -#ifdef Q_OS_WINCE_WM - if (qt_wince_is_smartphone()) { //small screen - size = QSize(100,100); -#endif } QWidget widget1; @@ -2420,11 +2296,7 @@ void tst_QWidget::reparent() childTLW.show(); QVERIFY(QTest::qWaitForWindowExposed(&parent)); -#ifdef Q_OS_WINCE - parent.move(50, 50); -#else parent.move(parentPosition); -#endif QPoint childPos = parent.mapToGlobal(child.pos()); QPoint tlwPos = childTLW.pos(); @@ -2453,6 +2325,12 @@ void tst_QWidget::icon() QPixmap p(20,20); p.fill(Qt::red); + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->resize(m_testWidgetSize); + testWidget->setWindowTitle(__FUNCTION__); + centerOnScreen(testWidget.data()); + testWidget->show(); + QVERIFY(QTest::qWaitForWindowExposed(testWidget.data())); testWidget->setWindowIcon(p); QVERIFY(!testWidget->windowIcon().isNull()); @@ -2468,22 +2346,27 @@ void tst_QWidget::hideWhenFocusWidgetIsChild() { if (m_platform == QStringLiteral("wayland")) QSKIP("Wayland: This fails. Figure out why."); - testWidget->activateWindow(); - QScopedPointer<QWidget> parentWidget(new QWidget(testWidget)); + + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->setWindowTitle(__FUNCTION__); + testWidget->resize(m_testWidgetSize); + centerOnScreen(testWidget.data()); + QWidget *parentWidget(new QWidget(testWidget.data())); parentWidget->setObjectName("parentWidget"); parentWidget->setGeometry(0, 0, 100, 100); - QLineEdit *edit = new QLineEdit(parentWidget.data()); + QLineEdit *edit = new QLineEdit(parentWidget); edit->setObjectName("edit1"); - QLineEdit *edit3 = new QLineEdit(parentWidget.data()); + QLineEdit *edit3 = new QLineEdit(parentWidget); edit3->setObjectName("edit3"); edit3->move(0,50); - parentWidget->show(); - QLineEdit *edit2 = new QLineEdit(testWidget); + QLineEdit *edit2 = new QLineEdit(testWidget.data()); edit2->setObjectName("edit2"); - edit2->show(); edit2->move(110, 100); edit->setFocus(); - qApp->processEvents(); + testWidget->show(); + testWidget->activateWindow(); + QVERIFY(QTest::qWaitForWindowActive(testWidget.data())); + QString actualFocusWidget, expectedFocusWidget; if (!qApp->focusWidget() && m_platform == QStringLiteral("xcb")) QSKIP("X11: Your window manager is too broken for this test"); @@ -2639,8 +2522,6 @@ void tst_QWidget::setGeometry() QCOMPARE(tlw.geometry(), tr); } -// Windows CE does not support windowOpacity. -#ifndef Q_OS_WINCE void tst_QWidget::windowOpacity() { QWidget widget; @@ -2671,7 +2552,6 @@ void tst_QWidget::windowOpacity() child.setWindowOpacity(-1.0); QCOMPARE(child.windowOpacity(), 1.0); } -#endif class UpdateWidget : public QWidget { @@ -2990,9 +2870,6 @@ void tst_QWidget::stackUnder() foreach (UpdateWidget *child, allChildren) { int expectedZOrderChangeEvents = child == child1 ? 1 : 0; if (child == child3) { -#ifdef Q_OS_WINCE - qApp->processEvents(); -#endif #ifndef Q_OS_OSX QEXPECT_FAIL(0, "See QTBUG-493", Continue); #endif @@ -3384,9 +3261,6 @@ void tst_QWidget::widgetAt() w2->setMask(rgn); qApp->processEvents(); QTest::qWait(10); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191 -#endif QTRY_VERIFY((wr = QApplication::widgetAt(testPos))); QTRY_COMPARE(wr->objectName(), w1->objectName()); @@ -3402,9 +3276,6 @@ void tst_QWidget::widgetAt() w2->setMask(bitmap); qApp->processEvents(); QTest::qWait(10); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191 -#endif QTRY_COMPARE(QApplication::widgetAt(testPos), w1.data()); QTRY_VERIFY(QApplication::widgetAt(testPos + QPoint(1, 1)) == w2.data()); } @@ -3572,8 +3443,6 @@ bool verifyWidgetMask(QWidget *widget, QRect mask) void tst_QWidget::setMask() { - testWidget->hide(); // get this out of the way. - { MaskedPainter w; w.resize(200, 200); @@ -3729,7 +3598,7 @@ void tst_QWidget::optimizedResize_topLevel() topLevel.partial = false; topLevel.paintedRegion = QRegion(); -#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN32) topLevel.resize(topLevel.size() + QSize(10, 10)); #else // Static contents does not work when programmatically resizing @@ -3800,7 +3669,6 @@ void tst_QWidget::setMinimumSize() // Setting a minimum size larger than the desktop does not work on WinCE, // so skip this part of the test. -#ifndef Q_OS_WINCE QSize nonDefaultSize = defaultSize + QSize(5,5); w.setMinimumSize(nonDefaultSize); w.showNormal(); @@ -3809,7 +3677,6 @@ void tst_QWidget::setMinimumSize() msgComparisonFailed(w.height(), ">=", nonDefaultSize.height())); QVERIFY2(w.width() >= nonDefaultSize.width(), msgComparisonFailed(w.width(), ">=", nonDefaultSize.width())); -#endif } void tst_QWidget::setMaximumSize() @@ -4749,7 +4616,7 @@ void tst_QWidget::setWindowGeometry() } } -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) void tst_QWidget::setGeometry_win() { QWidget widget; @@ -4770,7 +4637,7 @@ void tst_QWidget::setGeometry_win() QVERIFY2(rt.top <= m_availableTopLeft.y(), msgComparisonFailed(int(rt.top), "<=", m_availableTopLeft.y())); } -#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINRT) // Since X11 WindowManager operation are all async, and we have no way to know if the window // manager has finished playing with the window geometry, this test can't be reliable on X11. @@ -5095,12 +4962,8 @@ void tst_QWidget::moveChild() parent.setStyle(QStyleFactory::create(QLatin1String("Windows"))); ColorWidget child(&parent, Qt::Widget, Qt::blue); -#ifndef Q_OS_WINCE parent.setGeometry(QRect(QPoint(QApplication::desktop()->availableGeometry(&parent).topLeft()) + QPoint(50, 50), QSize(200, 200))); -#else - parent.setGeometry(60, 60, 150, 150); -#endif child.setGeometry(25, 25, 50, 50); #ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting QCursor::setPos(parent.geometry().topRight() + QPoint(50 , 50)); @@ -5325,11 +5188,18 @@ public: void tst_QWidget::setFocus() { + QScopedPointer<QWidget> testWidget(new QWidget); + testWidget->resize(m_testWidgetSize); + testWidget->setWindowTitle(__FUNCTION__); + centerOnScreen(testWidget.data()); + testWidget->show(); + QVERIFY(QTest::qWaitForWindowExposed(testWidget.data())); + const QPoint windowPos = testWidget->geometry().topRight() + QPoint(50, 0); { // move focus to another window testWidget->activateWindow(); - QApplication::setActiveWindow(testWidget); + QApplication::setActiveWindow(testWidget.data()); if (testWidget->focusWidget()) testWidget->focusWidget()->clearFocus(); else @@ -5375,7 +5245,7 @@ void tst_QWidget::setFocus() // note: window may be active, but we don't want it to be testWidget->activateWindow(); - QApplication::setActiveWindow(testWidget); + QApplication::setActiveWindow(testWidget.data()); if (testWidget->focusWidget()) testWidget->focusWidget()->clearFocus(); else @@ -5544,7 +5414,7 @@ private: int m_count; }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QWidget::setCursor() { { @@ -5687,8 +5557,6 @@ void tst_QWidget::setToolTip() QCOMPARE(widget.toolTip(), QString()); QCOMPARE(spy.count(), 2); - // Mouse over doesn't work on Windows mobile, so skip the rest of the test for that platform. -#ifndef Q_OS_WINCE_WM for (int pass = 0; pass < 2; ++pass) { QCursor::setPos(m_safeCursorPos); QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup)); @@ -5716,7 +5584,6 @@ void tst_QWidget::setToolTip() QTest::qWait(2200); // delay is 2000 QTest::mouseMove(popupWindow); } -#endif } void tst_QWidget::testWindowIconChangeEventPropagation() @@ -6795,7 +6662,6 @@ void tst_QWidget::render_task217815() } // Window Opacity is not supported on Windows CE. -#ifndef Q_OS_WINCE void tst_QWidget::render_windowOpacity() { const qreal opacity = 0.5; @@ -6868,7 +6734,6 @@ void tst_QWidget::render_windowOpacity() QCOMPARE(result, expected); } } -#endif void tst_QWidget::render_systemClip() { @@ -7326,14 +7191,10 @@ void tst_QWidget::repaintWhenChildDeleted() } #endif ColorWidget w(0, Qt::FramelessWindowHint, Qt::red); -#if !defined(Q_OS_WINCE) QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft(); startPoint.rx() += 50; startPoint.ry() += 50; w.setGeometry(QRect(startPoint, QSize(100, 100))); -#else - w.setGeometry(60, 60, 110, 110); -#endif w.show(); QVERIFY(QTest::qWaitForWindowExposed(&w)); QTest::qWait(10); @@ -7357,14 +7218,10 @@ void tst_QWidget::repaintWhenChildDeleted() void tst_QWidget::hideOpaqueChildWhileHidden() { ColorWidget w(0, Qt::FramelessWindowHint, Qt::red); -#if !defined(Q_OS_WINCE) QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft(); startPoint.rx() += 50; startPoint.ry() += 50; w.setGeometry(QRect(startPoint, QSize(100, 100))); -#else - w.setGeometry(60, 60, 110, 110); -#endif ColorWidget child(&w, Qt::Widget, Qt::blue); child.setGeometry(10, 10, 80, 80); @@ -7393,7 +7250,6 @@ void tst_QWidget::hideOpaqueChildWhileHidden() } // This test doesn't make sense without support for showMinimized(). -#if !defined(Q_OS_WINCE) void tst_QWidget::updateWhileMinimized() { if (m_platform == QStringLiteral("wayland")) @@ -7431,7 +7287,6 @@ void tst_QWidget::updateWhileMinimized() QTRY_COMPARE(widget.numPaintEvents, 1); QCOMPARE(widget.paintedRegion, QRegion(0, 0, 50, 50)); } -#endif class PaintOnScreenWidget: public QWidget { @@ -7798,13 +7653,6 @@ void tst_QWidget::adjustSize() QVERIFY2(child->size().height() < sizeHint.height(), msgComparisonFailed(child->size().height(), "<", sizeHint.height())); } else { -#if defined (Q_OS_WINCE) - if (!haveParent) { - const QRect& desktopRect = qApp->desktop()->availableGeometry(); - expectedSize.setWidth(qMin(expectedSize.width(), desktopRect.width())); - expectedSize.setHeight(qMin(expectedSize.height(), desktopRect.height())); - } -#endif QCOMPARE(child->size(), expectedSize); } if (!haveParent) @@ -8874,7 +8722,7 @@ void tst_QWidget::maskedUpdate() QTRY_COMPARE(grandChild.paintedRegion, QRegion(grandChild.rect())); // Full update. } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QWidget::syntheticEnterLeave() { if (m_platform == QStringLiteral("wayland")) @@ -8980,7 +8828,7 @@ void tst_QWidget::syntheticEnterLeave() } #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() { if (m_platform == QStringLiteral("wayland")) @@ -9128,8 +8976,6 @@ void tst_QWidget::updateOnDestroyedSignal() void tst_QWidget::toplevelLineEditFocus() { - testWidget->hide(); - QLineEdit w; w.setMinimumWidth(m_testWidgetSize.width()); w.show(); @@ -9195,10 +9041,9 @@ QWidgetBackingStore* backingStore(QWidget &widget) } // Tables of 5000 elements do not make sense on Windows Mobile. -#ifndef Q_OS_WINCE_WM void tst_QWidget::rectOutsideCoordinatesLimit_task144779() { -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::BlankCursor); //keep the cursor out of screen grabs #endif QWidget main(0,Qt::FramelessWindowHint); //don't get confused by the size of the window frame @@ -9233,11 +9078,10 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779() QTRY_COMPARE(mainPixmap.toImage().convertToFormat(QImage::Format_RGB32), correct.toImage().convertToFormat(QImage::Format_RGB32)); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif } -#endif void tst_QWidget::setGraphicsEffect() { @@ -9850,25 +9694,21 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() { // Simple case, we ignore the touch events, we get mouse events instead - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); - TouchMouseWidget widget; widget.show(); QVERIFY(QTest::qWaitForWindowExposed(widget.windowHandle())); QCOMPARE(widget.m_touchEventCount, 0); QCOMPARE(widget.m_mouseEventCount, 0); - QTest::touchEvent(&widget, device).press(0, QPoint(10, 10), &widget); + QTest::touchEvent(&widget, m_touchScreen).press(0, QPoint(10, 10), &widget); QCOMPARE(widget.m_touchEventCount, 0); QCOMPARE(widget.m_mouseEventCount, 1); QCOMPARE(widget.m_lastMouseEventPos, QPointF(10, 10)); - QTest::touchEvent(&widget, device).move(0, QPoint(15, 15), &widget); + QTest::touchEvent(&widget, m_touchScreen).move(0, QPoint(15, 15), &widget); QCOMPARE(widget.m_touchEventCount, 0); QCOMPARE(widget.m_mouseEventCount, 2); QCOMPARE(widget.m_lastMouseEventPos, QPointF(15, 15)); - QTest::touchEvent(&widget, device).release(0, QPoint(20, 20), &widget); + QTest::touchEvent(&widget, m_touchScreen).release(0, QPoint(20, 20), &widget); QCOMPARE(widget.m_touchEventCount, 0); QCOMPARE(widget.m_mouseEventCount, 4); // we receive extra mouse move event QCOMPARE(widget.m_lastMouseEventPos, QPointF(20, 20)); @@ -9876,10 +9716,6 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() { // We accept the touch events, no mouse event is generated - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); - TouchMouseWidget widget; widget.setAcceptTouch(true); widget.show(); @@ -9887,13 +9723,13 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() QCOMPARE(widget.m_touchEventCount, 0); QCOMPARE(widget.m_mouseEventCount, 0); - QTest::touchEvent(&widget, device).press(0, QPoint(10, 10), &widget); + QTest::touchEvent(&widget, m_touchScreen).press(0, QPoint(10, 10), &widget); QCOMPARE(widget.m_touchEventCount, 1); QCOMPARE(widget.m_mouseEventCount, 0); - QTest::touchEvent(&widget, device).move(0, QPoint(15, 15), &widget); + QTest::touchEvent(&widget, m_touchScreen).move(0, QPoint(15, 15), &widget); QCOMPARE(widget.m_touchEventCount, 2); QCOMPARE(widget.m_mouseEventCount, 0); - QTest::touchEvent(&widget, device).release(0, QPoint(20, 20), &widget); + QTest::touchEvent(&widget, m_touchScreen).release(0, QPoint(20, 20), &widget); QCOMPARE(widget.m_touchEventCount, 3); QCOMPARE(widget.m_mouseEventCount, 0); } @@ -9901,10 +9737,6 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() { // Parent accepts touch events, child ignore both mouse and touch // We should see propagation of the TouchBegin - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); - TouchMouseWidget parent; parent.setAcceptTouch(true); TouchMouseWidget child(&parent); @@ -9917,7 +9749,7 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_mouseEventCount, 0); - QTest::touchEvent(parent.window(), device).press(0, QPoint(10, 10), &child); + QTest::touchEvent(parent.window(), m_touchScreen).press(0, QPoint(10, 10), &child); QCOMPARE(parent.m_touchEventCount, 1); QCOMPARE(parent.m_mouseEventCount, 0); QCOMPARE(child.m_touchEventCount, 0); @@ -9927,10 +9759,6 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() { // Parent accepts mouse events, child ignore both mouse and touch // We should see propagation of the TouchBegin into a MouseButtonPress - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); - TouchMouseWidget parent; TouchMouseWidget child(&parent); child.move(5, 5); @@ -9942,7 +9770,7 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_mouseEventCount, 0); - QTest::touchEvent(parent.window(), device).press(0, QPoint(10, 10), &child); + QTest::touchEvent(parent.window(), m_touchScreen).press(0, QPoint(10, 10), &child); QCOMPARE(parent.m_touchEventCount, 0); QCOMPARE(parent.m_mouseEventCount, 1); QCOMPARE(parent.m_lastMouseEventPos, QPointF(15, 15)); @@ -9954,10 +9782,6 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() void tst_QWidget::touchUpdateOnNewTouch() { - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); - TouchMouseWidget widget; widget.setAcceptTouch(true); QVBoxLayout *layout = new QVBoxLayout; @@ -9970,23 +9794,23 @@ void tst_QWidget::touchUpdateOnNewTouch() QCOMPARE(widget.m_touchBeginCount, 0); QCOMPARE(widget.m_touchUpdateCount, 0); QCOMPARE(widget.m_touchEndCount, 0); - QTest::touchEvent(window, device).press(0, QPoint(20, 20), window); + QTest::touchEvent(window, m_touchScreen).press(0, QPoint(20, 20), window); QCOMPARE(widget.m_touchBeginCount, 1); QCOMPARE(widget.m_touchUpdateCount, 0); QCOMPARE(widget.m_touchEndCount, 0); - QTest::touchEvent(window, device).move(0, QPoint(25, 25), window); + QTest::touchEvent(window, m_touchScreen).move(0, QPoint(25, 25), window); QCOMPARE(widget.m_touchBeginCount, 1); QCOMPARE(widget.m_touchUpdateCount, 1); QCOMPARE(widget.m_touchEndCount, 0); - QTest::touchEvent(window, device).stationary(0).press(1, QPoint(40, 40), window); + QTest::touchEvent(window, m_touchScreen).stationary(0).press(1, QPoint(40, 40), window); QCOMPARE(widget.m_touchBeginCount, 1); QCOMPARE(widget.m_touchUpdateCount, 2); QCOMPARE(widget.m_touchEndCount, 0); - QTest::touchEvent(window, device).stationary(1).release(0, QPoint(25, 25), window); + QTest::touchEvent(window, m_touchScreen).stationary(1).release(0, QPoint(25, 25), window); QCOMPARE(widget.m_touchBeginCount, 1); QCOMPARE(widget.m_touchUpdateCount, 3); QCOMPARE(widget.m_touchEndCount, 0); - QTest::touchEvent(window, device).release(1, QPoint(40, 40), window); + QTest::touchEvent(window, m_touchScreen).release(1, QPoint(40, 40), window); QCOMPARE(widget.m_touchBeginCount, 1); QCOMPARE(widget.m_touchUpdateCount, 3); QCOMPARE(widget.m_touchEndCount, 1); @@ -9994,10 +9818,6 @@ void tst_QWidget::touchUpdateOnNewTouch() void tst_QWidget::touchEventsForGesturePendingWidgets() { - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); - TouchMouseWidget parent; TouchMouseWidget child(&parent); parent.grabGesture(Qt::TapAndHoldGesture); @@ -10010,14 +9830,14 @@ void tst_QWidget::touchEventsForGesturePendingWidgets() QCOMPARE(child.m_gestureEventCount, 0); QCOMPARE(parent.m_touchEventCount, 0); QCOMPARE(parent.m_gestureEventCount, 0); - QTest::touchEvent(window, device).press(0, QPoint(20, 20), window); + QTest::touchEvent(window, m_touchScreen).press(0, QPoint(20, 20), window); QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_gestureEventCount, 0); QCOMPARE(parent.m_touchBeginCount, 1); // QTapAndHoldGestureRecognizer::create() sets Qt::WA_AcceptTouchEvents QCOMPARE(parent.m_touchUpdateCount, 0); QCOMPARE(parent.m_touchEndCount, 0); QCOMPARE(parent.m_gestureEventCount, 0); - QTest::touchEvent(window, device).move(0, QPoint(25, 25), window); + QTest::touchEvent(window, m_touchScreen).move(0, QPoint(25, 25), window); QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_gestureEventCount, 0); QCOMPARE(parent.m_touchBeginCount, 1); @@ -10025,7 +9845,7 @@ void tst_QWidget::touchEventsForGesturePendingWidgets() QCOMPARE(parent.m_touchEndCount, 0); QCOMPARE(parent.m_gestureEventCount, 0); QTest::qWait(1000); - QTest::touchEvent(window, device).release(0, QPoint(25, 25), window); + QTest::touchEvent(window, m_touchScreen).release(0, QPoint(25, 25), window); QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_gestureEventCount, 0); QCOMPARE(parent.m_touchBeginCount, 1); @@ -10142,7 +9962,7 @@ void tst_QWidget::destroyedSignal() } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QWidget::underMouse() { // Move the mouse cursor to a safe location @@ -10429,7 +10249,7 @@ void tst_QWidget::taskQTBUG_27643_enterEvents() // Must only register only single enter on modal dialog's button after all said and done QCOMPARE(dialog.enters, 1); } -#endif // QTEST_NO_CURSOR +#endif // QT_NO_CURSOR class KeyboardWidget : public QWidget { diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 35b1596003..a59dd8c80e 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -331,8 +331,9 @@ void tst_QWidget_window::tst_showWithoutActivating() QSKIP("Cocoa: This fails. Figure out why."); else if (platformName != QStringLiteral("xcb") && platformName != QStringLiteral("windows") - && platformName != QStringLiteral("ios")) - QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios platforms."); + && platformName != QStringLiteral("ios") + && platformName != QStringLiteral("tvos")) + QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios/tvos platforms."); QWidget w1; w1.setAttribute(Qt::WA_ShowWithoutActivating); diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 50445b9a45..a1e5a70a08 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -3,12 +3,6 @@ TARGET = tst_qstyle QT += widgets testlib SOURCES += tst_qstyle.cpp -wince* { - addPixmap.files = task_25863.png - addPixmap.path = . - DEPLOYMENT += addPixmap -} - android { RESOURCES += \ testdata.qrc diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index 5c213fea04..5925b764dd 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -56,20 +56,6 @@ #include <qlineedit.h> #include <qmdiarea.h> #include <qscrollarea.h> - -#ifdef Q_OS_WINCE_WM -#include <windows.h> - -static bool qt_wince_is_smartphone() { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (QString::fromLatin1("Smartphone").utf16()), tszPlatform)) - return true; - return false; -} -#endif - #include <qwidget.h> // Make a widget frameless to prevent size constraints of title bars @@ -90,7 +76,7 @@ public: private: bool testAllFunctions(QStyle *); - bool testScrollBarSubControls(QStyle *); + bool testScrollBarSubControls(); void testPainting(QStyle *style, const QString &platform); private slots: void drawItemPixmap(); @@ -109,12 +95,6 @@ private slots: #ifdef Q_OS_MAC void testMacStyle(); #endif -#ifdef Q_OS_WINCE - void testWindowsCEStyle(); -#endif -#ifdef Q_OS_WINCE_WM - void testWindowsMobileStyle(); -#endif void testStyleFactory(); void testProxyStyle(); void pixelMetric(); @@ -315,19 +295,11 @@ bool tst_QStyle::testAllFunctions(QStyle *style) style->itemPixmapRect(QRect(0, 0, 100, 100), Qt::AlignHCenter, QPixmap(200, 200)); style->itemTextRect(QFontMetrics(qApp->font()), QRect(0, 0, 100, 100), Qt::AlignHCenter, true, QString("Test")); - return testScrollBarSubControls(style); + return testScrollBarSubControls(); } -bool tst_QStyle::testScrollBarSubControls(QStyle* style) +bool tst_QStyle::testScrollBarSubControls() { - // WinCE SmartPhone doesn't have scrollbar subcontrols, so skip the rest of the test. -#ifdef Q_OS_WINCE_WM - if (style->inherits("QWindowsMobileStyle") && qt_wince_is_smartphone()) - return true; -#else - Q_UNUSED(style); -#endif - QScrollBar scrollBar; setFrameless(&scrollBar); scrollBar.show(); @@ -522,26 +494,6 @@ void tst_QStyle::testMacStyle() } #endif -#ifdef Q_OS_WINCE -// WindowsCEStyle style -void tst_QStyle::testWindowsCEStyle() -{ - QStyle *cstyle = QStyleFactory::create("WindowsCE"); - QVERIFY(testAllFunctions(cstyle)); - delete cstyle; -} -#endif - -#ifdef Q_OS_WINCE_WM -// WindowsMobileStyle style -void tst_QStyle::testWindowsMobileStyle() -{ - QStyle *cstyle = QStyleFactory::create("WindowsMobile"); - QVERIFY(testAllFunctions(cstyle)); - delete cstyle; -} -#endif - // Helper class... MyWidget::MyWidget( QWidget* parent, const char* name ) diff --git a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST index cf78fb47c2..61966e684f 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST +++ b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST @@ -1,2 +1,4 @@ [hoverColors] ubuntu-14.04 +opensuse-13.1 +opensuse-42.1 diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index a107260d23..8d84addedb 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -34,8 +34,6 @@ #include <private/qstylesheetstyle_p.h> -#include "../../../qtest-config.h" - static inline void centerOnScreen(QWidget *w) { const QPoint offset = QPoint(w->width() / 2, w->height() / 2); @@ -76,7 +74,7 @@ private slots: void onWidgetDestroyed(); void fontPrecedence(); void focusColors(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void hoverColors(); #endif void background(); @@ -887,7 +885,7 @@ void tst_QStyleSheetStyle::focusColors() } } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QStyleSheetStyle::hoverColors() { #ifdef Q_OS_OSX diff --git a/tests/auto/widgets/styles/styles.pro b/tests/auto/widgets/styles/styles.pro index 0de9dfcdab..952a659eaa 100644 --- a/tests/auto/widgets/styles/styles.pro +++ b/tests/auto/widgets/styles/styles.pro @@ -12,5 +12,5 @@ SUBDIRS=\ !mac:SUBDIRS -= \ qmacstyle \ -ios|android|qnx|wince: SUBDIRS -= \ +uikit|android|qnx: SUBDIRS -= \ qstylesheetstyle \ diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index ff71a6d56b..0098c5d884 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -600,10 +600,7 @@ void tst_QCompleter::directoryModel_data() if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; -#if defined(Q_OS_WINCE) - QTest::newRow("()") << "" << "" << "/" << "/"; - QTest::newRow("()") << "\\Program" << "" << "Program Files" << "\\Program Files"; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) QTest::newRow("()") << "C" << "" << "C:" << "C:"; QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files"; #elif defined (Q_OS_MAC) @@ -649,10 +646,7 @@ void tst_QCompleter::fileSystemModel_data() if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; -#if defined(Q_OS_WINCE) - QTest::newRow("()") << "" << "" << "/" << "/"; - QTest::newRow("()") << "\\Program" << "" << "Program Files" << "\\Program Files"; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) QTest::newRow("()") << "C" << "" << "C:" << "C:"; QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files"; #elif defined (Q_OS_MAC) diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp index 2c398e1b2f..67bae43c9d 100644 --- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp +++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp @@ -125,6 +125,9 @@ private slots: void scrollTo(); void scroll(); void overshoot(); + +private: + QTouchDevice *m_touchScreen = QTest::createTouchDevice(); }; /*! \internal @@ -150,11 +153,8 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint touchPoint.setPos(touchStart); touchPoint.setScenePos(touchStart); touchPoint.setScreenPos(touchStart); - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); QTouchEvent touchEvent1(QEvent::TouchBegin, - device, + m_touchScreen, Qt::NoModifier, Qt::TouchPointPressed, (QList<QTouchEvent::TouchPoint>() << touchPoint)); @@ -168,7 +168,7 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint touchPoint.setScenePos(touchUpdate); touchPoint.setScreenPos(touchUpdate); QTouchEvent touchEvent2(QEvent::TouchUpdate, - device, + m_touchScreen, Qt::NoModifier, Qt::TouchPointMoved, (QList<QTouchEvent::TouchPoint>() << touchPoint)); @@ -192,7 +192,7 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint touchPoint.setScenePos(touchEnd); touchPoint.setScreenPos(touchEnd); QTouchEvent touchEvent5(QEvent::TouchEnd, - device, + m_touchScreen, Qt::NoModifier, Qt::TouchPointReleased, (QList<QTouchEvent::TouchPoint>() << touchPoint)); @@ -223,11 +223,8 @@ void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from, touchPoint.setPos(touchStart); touchPoint.setScenePos(touchStart); touchPoint.setScreenPos(touchStart); - QTouchDevice *device = new QTouchDevice; - device->setType(QTouchDevice::TouchScreen); - QWindowSystemInterface::registerTouchDevice(device); QTouchEvent touchEvent1(QEvent::TouchBegin, - device, + m_touchScreen, Qt::NoModifier, Qt::TouchPointPressed, (QList<QTouchEvent::TouchPoint>() << touchPoint)); @@ -239,7 +236,7 @@ void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from, touchPoint.setScenePos(touchUpdate); touchPoint.setScreenPos(touchUpdate); QTouchEvent touchEvent2(QEvent::TouchUpdate, - device, + m_touchScreen, Qt::NoModifier, Qt::TouchPointMoved, (QList<QTouchEvent::TouchPoint>() << touchPoint)); @@ -252,7 +249,7 @@ void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from, touchPoint.setScenePos(touchEnd); touchPoint.setScreenPos(touchEnd); QTouchEvent touchEvent5(QEvent::TouchEnd, - device, + m_touchScreen, Qt::NoModifier, Qt::TouchPointReleased, (QList<QTouchEvent::TouchPoint>() << touchPoint)); diff --git a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp index a932cf5984..616898c4c5 100644 --- a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp +++ b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp @@ -107,9 +107,6 @@ void tst_QSystemTrayIcon::getSetCheck() void tst_QSystemTrayIcon::supportsMessages() { // ### fixme: Check platforms. -#if defined(Q_OS_WINCE) - QCOMPARE(QSystemTrayIcon::supportsMessages(), false); -#else const QString platform = QGuiApplication::platformName(); if (platform.compare(QStringLiteral("xcb"), Qt::CaseInsensitive) && platform.compare(QStringLiteral("windows"), Qt::CaseInsensitive) @@ -117,7 +114,6 @@ void tst_QSystemTrayIcon::supportsMessages() QEXPECT_FAIL("", "QTBUG-20978 QSystemTrayIcon is unimplemented for this platform", Abort); } QCOMPARE(QSystemTrayIcon::supportsMessages(), true); -#endif } void tst_QSystemTrayIcon::lastWindowClosed() diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 50024460fc..816fe1faba 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -78,9 +78,6 @@ class tst_QComboBox : public QObject public: tst_QComboBox() {} -public slots: - void init(); - private slots: void getSetCheck(); void ensureReturnIsIgnored(); @@ -396,13 +393,6 @@ private: }; -void tst_QComboBox::init() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QComboBox::setEditable() { TestWidget topLevel; @@ -2753,7 +2743,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse() QCOMPARE(combo.currentText(), QLatin1String("0")); // When calling cursor function, Windows CE responds with: This function is not supported on this system. -#if !defined Q_OS_WINCE && !defined Q_OS_QNX +#if !defined Q_OS_QNX // Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA: centerCursor(combo.view()); QTest::qWait(200); diff --git a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro index 411185ae2a..c4bc1cab21 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro +++ b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_qdatetimeedit QT += widgets testlib core-private widgets-private SOURCES += tst_qdatetimeedit.cpp - -wincewm50smart-msvc2005: DEFINES += WINCE_NO_MODIFIER_KEYS diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 831d7257ba..28c2e92f78 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -84,30 +84,6 @@ Q_DECLARE_METATYPE(Qt::Key); Q_DECLARE_METATYPE(Qt::KeyboardModifiers); Q_DECLARE_METATYPE(Qt::KeyboardModifier); -#if defined(Q_OS_WINCE) -#ifndef SPI_GETPLATFORMTYPE -#define SPI_GETPLATFORMTYPE 257 -#endif - -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} -bool qt_wince_is_pocket_pc() { - return qt_wince_is_platform(QString::fromLatin1("PocketPC")); -} -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} -bool qt_wince_is_mobile() { - return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()); -} -#endif - class EditorDateEdit : public QDateTimeEdit { Q_OBJECT @@ -331,7 +307,7 @@ void tst_QDateTimeEdit::cleanupTestCase() void tst_QDateTimeEdit::init() { QLocale::setDefault(QLocale(QLocale::C)); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); #endif testWidget->setDisplayFormat("dd/MM/yyyy"); // Nice default to have @@ -3107,7 +3083,7 @@ void tst_QDateTimeEdit::nextPrevSection_data() // 1. mac doesn't do these, // 2. some WinCE devices do not have modifiers -#if !defined(Q_OS_MAC) && !defined(WINCE_NO_MODIFIER_KEYS) +#if !defined(Q_OS_DARWIN) QTest::newRow("ctrl-right") << Qt::Key_Right << (Qt::KeyboardModifiers)Qt::ControlModifier << QString("56"); QTest::newRow("ctrl-left") << Qt::Key_Left << (Qt::KeyboardModifiers)Qt::ControlModifier << QString("12"); #endif diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 598b518810..a4614d0a9d 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -70,8 +70,6 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#include "../../../qtest-config.h" - QT_BEGIN_NAMESPACE class QPainter; QT_END_NAMESPACE @@ -252,7 +250,7 @@ private slots: void noTextEditedOnClear(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void cursor(); #endif @@ -3484,7 +3482,7 @@ void tst_QLineEdit::textMargin() QTRY_COMPARE(testWidget.cursorPosition(), cursorPosition); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QLineEdit::cursor() { QLineEdit *testWidget = ensureTestWidget(); diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 5bd26c632c..30e4f63aa1 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -45,7 +45,9 @@ #include <private/qmainwindowlayout_p.h> #include <private/qdockarealayout_p.h> -#include "../../../qtest-config.h" +#ifndef QT_NO_TABBAR +#include <qtabbar.h> +#endif static uchar restoreData41[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x0, 0x8d, 0x0, 0x0, 0x0, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0xd4, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x0, 0x8d, 0x0, 0x0, 0x0, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0xd4, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x1, 0x89, 0x0, 0x0, 0x0, 0xe, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x0, 0x63, 0x0, 0x0, 0x0, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0xc8, 0x0, 0x0, 0x0, 0x5e, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x1, 0x2a, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x1, 0x89, 0x0, 0x0, 0x0, 0xe, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x0, 0x63, 0x0, 0x0, 0x0, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0xc8, 0x0, 0x0, 0x0, 0x5e, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x1, 0x2a, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0xc1, 0x0, 0x0, 0x1, 0x19}; static uchar restoreData42[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24, 0x0, 0x0, 0x2, 0x2b, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0xb6, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x87, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x1, 0xcd, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x98, 0x0, 0x0, 0x2, 0x2b, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0xb6, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x87, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x1, 0xcd, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x4, 0x4e, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x1, 0x16, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x2, 0x28, 0x0, 0x0, 0x1, 0x14, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x3, 0x40, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x4, 0x4e, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x1, 0x16, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x2, 0x28, 0x0, 0x0, 0x1, 0x14, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x3, 0x40, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3, 0x8a, 0x0, 0x0, 0x2, 0x2b, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8}; @@ -131,7 +133,7 @@ private slots: void contentsMargins_data(); void contentsMargins(); void isSeparator(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void setCursor(); #endif void addToolbarAfterShow(); @@ -146,6 +148,9 @@ private slots: void QTBUG21378_animationFinished(); void resizeDocks(); void resizeDocks_data(); +#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR) + void QTBUG52175_tabifiedDockWidgetActivated(); +#endif }; @@ -595,9 +600,6 @@ void tst_QMainWindow::menuBar() mw.setMenuBar(mb1); QVERIFY(mw.menuBar() != 0); QCOMPARE(mw.menuBar(), (QMenuBar *)mb1); -#ifdef Q_OS_WINCE_WM - QSKIP("With native menubar integration the menubar is not a child"); -#endif QCOMPARE(mb1->parentWidget(), (QWidget *)&mw); mw.setMenuBar(0); @@ -1728,7 +1730,7 @@ class MainWindow : public QMainWindow { using QMainWindow::event; }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QMainWindow::setCursor() { MainWindow mw; @@ -2038,5 +2040,52 @@ void tst_QMainWindow::resizeDocks() } } +#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR) +void tst_QMainWindow::QTBUG52175_tabifiedDockWidgetActivated() +{ + QMainWindow w; + + QDockWidget *dwFirst = new QDockWidget(&w); + dwFirst->setWidget(new QWidget(dwFirst)); + w.addDockWidget(Qt::LeftDockWidgetArea, dwFirst); + + QDockWidget *dwSecond = new QDockWidget(&w); + dwSecond->setWidget(new QWidget(dwSecond)); + w.addDockWidget(Qt::LeftDockWidgetArea, dwSecond); + + w.tabifyDockWidget(dwFirst, dwSecond); + w.show(); + QVERIFY(QTest::qWaitForWindowActive(&w)); + + QTabBar *tabBar = w.findChild<QTabBar *>(); + QVERIFY(tabBar); + + QDockWidget *activated = nullptr; + connect(&w, &QMainWindow::tabifiedDockWidgetActivated, [&activated](QDockWidget *dockWidget) + { + activated = dockWidget; + }); + + w.hide(); + QCoreApplication::processEvents(); + QCOMPARE(activated, nullptr); + + w.show(); + QCoreApplication::processEvents(); + QCOMPARE(activated, nullptr); + + tabBar->setCurrentIndex(1); + QCoreApplication::processEvents(); + QCOMPARE(activated, nullptr); + + tabBar->setCurrentIndex(0); + QTRY_COMPARE(activated, dwFirst); + activated = nullptr; + + tabBar->setCurrentIndex(1); + QTRY_COMPARE(activated, dwSecond); +} +#endif + QTEST_MAIN(tst_QMainWindow) #include "tst_qmainwindow.moc" diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 809fa56a61..2b8f3032bf 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -228,7 +228,6 @@ class tst_QMdiArea : public QObject public: tst_QMdiArea(); public slots: - void initTestCase(); void cleanup(); protected slots: @@ -293,13 +292,6 @@ tst_QMdiArea::tst_QMdiArea() qRegisterMetaType<QMdiSubWindow *>(); } -void tst_QMdiArea::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QMdiArea::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); @@ -509,9 +501,6 @@ void tst_QMdiArea::subWindowActivated2() if (!macHasAccessToWindowsServer()) QEXPECT_FAIL("", "showMinimized doesn't really minimize if you don't have access to the server", Abort); #endif -#ifdef Q_OS_WINCE - QSKIP("Not fixed yet. See Task 197453"); -#endif #ifdef Q_OS_MAC QSKIP("QTBUG-25298: This test is unstable on Mac."); #endif @@ -649,7 +638,7 @@ void tst_QMdiArea::changeWindowTitle() #else widget->setWindowState(Qt::WindowMaximized); #endif -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif @@ -658,7 +647,7 @@ void tst_QMdiArea::changeWindowTitle() mw->show(); QVERIFY(QTest::qWaitForWindowExposed(mw)); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif @@ -676,7 +665,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif qApp->processEvents(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); widget->setWindowTitle( wc2 ); QCOMPARE( mw->windowTitle(), windowTitle(mwc, wc2) ); @@ -694,7 +683,7 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif #ifdef USE_SHOW @@ -703,7 +692,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowNoState); #endif qApp->processEvents(); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) QCOMPARE(mw->windowTitle(), mwc); #else QCOMPARE( mw->windowTitle(), mwc2 ); @@ -715,7 +704,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif qApp->processEvents(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif @@ -764,7 +753,7 @@ void tst_QMdiArea::changeModified() QCOMPARE( mw->isWindowModified(), false); QCOMPARE( widget->isWindowModified(), true); widget->setWindowState(Qt::WindowMaximized); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->isWindowModified(), true); #endif QCOMPARE( widget->isWindowModified(), true); @@ -774,7 +763,7 @@ void tst_QMdiArea::changeModified() QCOMPARE( widget->isWindowModified(), true); widget->setWindowState(Qt::WindowMaximized); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->isWindowModified(), true); #endif QCOMPARE( widget->isWindowModified(), true); @@ -784,7 +773,7 @@ void tst_QMdiArea::changeModified() QCOMPARE( widget->isWindowModified(), false); widget->setWindowModified(true); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->isWindowModified(), true); #endif QCOMPARE( widget->isWindowModified(), true); @@ -1598,9 +1587,7 @@ void tst_QMdiArea::tileSubWindows() qApp->processEvents(); } workspace.setActiveSubWindow(0); -#ifndef Q_OS_WINCE //See Task 197453 ToDo QCOMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); -#endif QMdiSubWindow *window = windows.at(0); @@ -1724,9 +1711,6 @@ void tst_QMdiArea::tileSubWindows() frameWidth = workspace.style()->pixelMetric(QStyle::PM_DefaultFrameWidth); const int spacing = 2 * frameWidth + 2; const QSize expectedViewportSize(3 * minSize.width() + spacing, 3 * minSize.height() + spacing); -#ifdef Q_OS_WINCE - QSKIP("Not fixed yet! See task 197453"); -#endif QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize); // Restore original scrollbar behavior for test below @@ -2005,7 +1989,7 @@ void tst_QMdiArea::delayedPlacement() void tst_QMdiArea::iconGeometryInMenuBar() { -#if !defined (Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QMainWindow mainWindow; QMenuBar *menuBar = mainWindow.menuBar(); menuBar->setNativeMenuBar(false); @@ -2063,11 +2047,7 @@ void tst_QMdiArea::resizeTimer() mdiArea.show(); QVERIFY(QTest::qWaitForWindowActive(&mdiArea)); -#ifndef Q_OS_WINCE int time = 250; -#else - int time = 1000; -#endif EventSpy timerEventSpy(subWindow, QEvent::Timer); QCOMPARE(timerEventSpy.count(), 0); diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index fe5c3a14a0..086c1049ab 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -48,8 +48,6 @@ #include <QScreen> #include <QSizeGrip> -#include "../../../qtest-config.h" - QT_BEGIN_NAMESPACE #if !defined(Q_DEAD_CODE_FROM_QT4_WIN) extern bool qt_tab_all_widgets(); @@ -161,7 +159,7 @@ private slots: void showShaded(); void showNormal_data(); void showNormal(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void setOpaqueResizeAndMove_data(); void setOpaqueResizeAndMove(); #endif @@ -184,7 +182,7 @@ private slots: void explicitlyHiddenWidget(); void resizeTimer(); void fixedMinMaxSize(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) void replaceMenuBarWhileMaximized(); void closeOnDoubleClick_data(); void closeOnDoubleClick(); @@ -361,7 +359,7 @@ void tst_QMdiSubWindow::mainWindowSupport() qApp->setActiveWindow(&mainWindow); // QMainWindow's window title is empty -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) { QCOMPARE(mainWindow.windowTitle(), QString()); QMdiSubWindow *window = workspace->addSubWindow(new QPushButton(QLatin1String("Test"))); @@ -413,7 +411,7 @@ void tst_QMdiSubWindow::mainWindowSupport() window->showMaximized(); qApp->processEvents(); QVERIFY(window->isMaximized()); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QVERIFY(window->maximizedButtonsWidget()); QCOMPARE(window->maximizedButtonsWidget(), mainWindow.menuBar()->cornerWidget(Qt::TopRightCorner)); QVERIFY(window->maximizedSystemMenuIconWidget()); @@ -436,13 +434,13 @@ void tst_QMdiSubWindow::mainWindowSupport() QVERIFY(!nestedWindow->maximizedButtonsWidget()); QVERIFY(!nestedWindow->maximizedSystemMenuIconWidget()); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) +#if !defined(Q_OS_DARWIN) && !defined(Q_OS_QNX) QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]") .arg(originalWindowTitle, window->widget()->windowTitle())); #endif } -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) return; #endif @@ -576,10 +574,6 @@ void tst_QMdiSubWindow::showShaded() window->showNormal(); QTest::qWait(250); -#ifdef Q_OS_WINCE - QSKIP("Until we have a QEvent::WindowFlagsChange event, this will skip"); -#endif - const QSize minimumSizeHint = window->minimumSizeHint(); QVERIFY(minimumSizeHint.height() < 300); const int maxHeightDiff = 300 - minimumSizeHint.height(); @@ -670,7 +664,7 @@ private: int _count; }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QMdiSubWindow::setOpaqueResizeAndMove_data() { QTest::addColumn<bool>("opaqueMode"); @@ -1011,7 +1005,7 @@ void tst_QMdiSubWindow::setSystemMenu() systemMenu->hide(); QVERIFY(!qApp->activePopupWidget()); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) // System menu in menu bar. subWindow->showMaximized(); QVERIFY(subWindow->isMaximized()); @@ -1044,7 +1038,7 @@ void tst_QMdiSubWindow::setSystemMenu() systemMenu->hide(); QVERIFY(!qApp->activePopupWidget()); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) // System menu in menu bar in reverse mode. subWindow->showMaximized(); QVERIFY(subWindow->isMaximized()); @@ -1475,7 +1469,7 @@ void tst_QMdiSubWindow::hideAndShow() QVERIFY(!menuBar->cornerWidget(Qt::TopRightCorner)); QMdiSubWindow *subWindow = mdiArea->addSubWindow(new QTextEdit); subWindow->showMaximized(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner)); QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget()); #endif @@ -1490,7 +1484,7 @@ void tst_QMdiSubWindow::hideAndShow() // Show QMdiArea. tabWidget->setCurrentIndex(0); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner)); QVERIFY(subWindow->maximizedButtonsWidget()); QVERIFY(subWindow->maximizedSystemMenuIconWidget()); @@ -1512,7 +1506,7 @@ void tst_QMdiSubWindow::hideAndShow() QVERIFY(subWindow); QCOMPARE(mdiArea->activeSubWindow(), subWindow); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner)); #if defined Q_OS_QNX QEXPECT_FAIL("", "QTBUG-38231", Abort); @@ -1540,7 +1534,7 @@ void tst_QMdiSubWindow::hideAndShow() QVERIFY(!menuBar->cornerWidget(Qt::TopRightCorner)); subWindow->show(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(subWindow->maximizedButtonsWidget()); QVERIFY(subWindow->maximizedSystemMenuIconWidget()); QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget()); @@ -1554,7 +1548,7 @@ void tst_QMdiSubWindow::hideAndShow() // Show QMainWindow. mainWindow.show(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(subWindow->maximizedButtonsWidget()); QVERIFY(subWindow->maximizedSystemMenuIconWidget()); QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget()); @@ -1724,7 +1718,7 @@ void tst_QMdiSubWindow::fixedMinMaxSize() QCOMPARE(subWindow->size(), minimumSize); } -#if !defined( Q_OS_MAC) && !defined( Q_OS_WINCE) +#if !defined( Q_OS_DARWIN) void tst_QMdiSubWindow::replaceMenuBarWhileMaximized() { @@ -1911,7 +1905,7 @@ void tst_QMdiSubWindow::mdiArea() void tst_QMdiSubWindow::task_182852() { -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QMdiArea *workspace = new QMdiArea; QMainWindow mainWindow; diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 741d6839db..cb7643d1ac 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -81,9 +81,7 @@ private slots: void overrideMenuAction(); void statusTip(); void widgetActionFocus(); -#ifndef Q_OS_WINCE void mouseActivation(); -#endif void tearOff(); void submenuTearOffDontClose(); void layoutDirection(); @@ -96,9 +94,7 @@ private slots: void task250673_activeMultiColumnSubMenuPosition(); void task256918_setFont(); void menuSizeHint(); -#ifndef Q_OS_WINCE void task258920_mouseBorder(); -#endif void setFixedWidth(); void deleteActionInTriggered(); void pushButtonPopulateOnAboutToShow(); @@ -293,8 +289,6 @@ void tst_QMenu::addActionsConnect() #endif // !QT_NO_SHORTCUT } -// We have a separate mouseActivation test for Windows mobile -#ifndef Q_OS_WINCE void tst_QMenu::mouseActivation() { QWidget topLevel; @@ -334,7 +328,6 @@ void tst_QMenu::mouseActivation() QVERIFY(submenu.isVisible()); #endif } -#endif void tst_QMenu::keyboardNavigation_data() { @@ -465,7 +458,7 @@ void tst_QMenu::overrideMenuAction() // On Mac and Windows CE, we need to create native key events to test menu // action activation, so skip this part of the test. -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QAction *aQuit = new QAction("Quit", &w); aQuit->setShortcut(QKeySequence("Ctrl+X")); m->addAction(aQuit); @@ -762,10 +755,8 @@ void tst_QMenu::activeSubMenuPosition() QVERIFY(sub->pos() != QPoint(0,0)); // well, it's enough to check the pos is not (0,0) but it's more safe // to check that submenu is to the right of the main menu too. -#ifndef Q_OS_WINCE_WM QVERIFY(sub->pos().x() > main->pos().x()); QCOMPARE(sub->activeAction(), subAction); -#endif } // QTBUG-49588, QTBUG-48396: activeSubMenuPositionExec() is the same as @@ -817,10 +808,8 @@ private: void tst_QMenu::activeSubMenuPositionExec() { -#ifndef Q_OS_WINCE SubMenuPositionExecMenu menu; menu.exec(QGuiApplication::primaryScreen()->availableGeometry().center()); -#endif // !Q_OS_WINCE } void tst_QMenu::task242454_sizeHint() @@ -954,7 +943,6 @@ public: }; // Mouse move related signals for Windows Mobile unavailable -#ifndef Q_OS_WINCE void tst_QMenu::task258920_mouseBorder() { Menu258920 menu; @@ -983,7 +971,6 @@ void tst_QMenu::task258920_mouseBorder() QTRY_COMPARE(static_cast<QAction*>(0), menu.activeAction()); QTRY_VERIFY(menu.painted); } -#endif void tst_QMenu::setFixedWidth() { diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 4b4bec9920..58725346d0 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -90,7 +90,7 @@ private slots: void count(); void insertItem_QString_QObject(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void accel(); void activatedCount(); void allowActiveAndDisabled(); @@ -113,7 +113,7 @@ private slots: void check_altPress(); void check_altClosePress(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void check_shortcutPress(); void check_menuPosition(); #endif @@ -164,8 +164,6 @@ void tst_QMenuBar::getSetCheck() #include <qcursor.h> -const int RESET = 0; - /*! Test plan: insertItem (all flavors and combinations) @@ -311,7 +309,7 @@ inline TestMenu tst_QMenuBar::initWindowWithComplexMenuBar(QMainWindow &w) } // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::accel() { // create a popup menu with menu items set the accelerators later... @@ -329,7 +327,7 @@ void tst_QMenuBar::accel() #endif // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::activatedCount() { // create a popup menu with menu items set the accelerators later... @@ -520,7 +518,7 @@ void tst_QMenuBar::insertItem_QString_QObject() } // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_accelKeys() { QMainWindow w; @@ -593,7 +591,7 @@ void tst_QMenuBar::check_accelKeys() #endif // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys1() { QMainWindow w; @@ -627,7 +625,7 @@ void tst_QMenuBar::check_cursorKeys1() #endif // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys2() { QMainWindow w; @@ -660,7 +658,7 @@ void tst_QMenuBar::check_cursorKeys2() If a popupmenu is active you can use Left to move to the menu to the left of it. */ // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys3() { QMainWindow w; @@ -775,7 +773,7 @@ void tst_QMenuBar::check_endKey() */ // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_escKey() { QMainWindow w; @@ -920,7 +918,7 @@ void tst_QMenuBar::check_escKey() // QCOMPARE(m_complexActionTriggerCount['h'], (uint)itemH_count); // } -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::allowActiveAndDisabled() { QMenuBar menuBar; @@ -1010,7 +1008,7 @@ void tst_QMenuBar::check_altClosePress() } // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_shortcutPress() { QMainWindow w; @@ -1053,7 +1051,7 @@ private: }; // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_menuPosition() { QMainWindow w; @@ -1122,7 +1120,7 @@ void tst_QMenuBar::check_menuPosition() menu.close(); } -# ifndef QTEST_NO_CURSOR +# ifndef QT_NO_CURSOR // QTBUG-28031: Click at bottom-right corner. { w.move(400, 200); @@ -1136,7 +1134,7 @@ void tst_QMenuBar::check_menuPosition() QCOMPARE(menu.geometry().right() - 1, globalPos.x()); menu.close(); } -# endif // QTEST_NO_CURSOR +# endif // QT_NO_CURSOR } #endif @@ -1209,7 +1207,7 @@ void tst_QMenuBar::task256322_highlight() QTRY_VERIFY(!menu2.isVisible()); QVERIFY(!menu.isVisible()); #ifdef Q_OS_MAC - if ((QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) && (win.menuBar()->activeAction() != nothing)) + if (win.menuBar()->activeAction() != nothing) QEXPECT_FAIL("", "QTBUG-30565: Unstable test", Continue); #endif QTRY_COMPARE(win.menuBar()->activeAction(), nothing); @@ -1392,7 +1390,7 @@ void tst_QMenuBar::cornerWidgets() QFETCH(Qt::Corner, corner); -#if defined(Q_OS_OSX) || defined(Q_OS_WINCE) +#if defined(Q_OS_OSX) QSKIP("Test interferes with native menu bars on this platform"); #endif diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index b58d236a91..31bbcf9c7f 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -48,8 +48,6 @@ #include "qplaintextedit.h" #include "../../../shared/platformclipboard.h" -#include "../../../qtest-config.h" - //Used in copyAvailable typedef QPair<Qt::Key, Qt::KeyboardModifier> keyPairType; typedef QList<keyPairType> pairListType; @@ -64,7 +62,6 @@ public: tst_QPlainTextEdit(); public slots: - void initTestCase(); void init(); void cleanup(); private slots: @@ -104,7 +101,7 @@ private slots: void shiftDownInLineLastShouldSelectToEnd(); void undoRedoShouldRepositionTextEditCursor(); void lineWrapModes(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void mouseCursorShape(); #endif void implicitClear(); @@ -208,16 +205,8 @@ void tst_QPlainTextEdit::getSetCheck() QCOMPARE(0, obj1.tabStopWidth()); obj1.setTabStopWidth(INT_MIN); QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value -#if defined(Q_OS_WINCE) - // due to rounding error in qRound when qreal==float - // we cannot use INT_MAX for this check - obj1.setTabStopWidth(SHRT_MAX*2); - QCOMPARE(SHRT_MAX*2, obj1.tabStopWidth()); -#else obj1.setTabStopWidth(INT_MAX); QCOMPARE(INT_MAX, obj1.tabStopWidth()); -#endif - } class QtTestDocumentLayout : public QAbstractTextDocumentLayout @@ -251,13 +240,6 @@ public: tst_QPlainTextEdit::tst_QPlainTextEdit() {} -void tst_QPlainTextEdit::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QPlainTextEdit::init() { ed = new QPlainTextEdit(0); @@ -896,7 +878,7 @@ void tst_QPlainTextEdit::lineWrapModes() delete window; } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QPlainTextEdit::mouseCursorShape() { // always show an IBeamCursor, see change 170146 diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index 302d290c72..7bbbc46b5a 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -526,12 +526,6 @@ void tst_QPushButton::sizeHint_data() #if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) QTest::newRow("windowsvista") << QString::fromLatin1("windowsvista"); #endif -#if defined(Q_OS_WINCE) && !defined(QT_NO_STYLE_WINDOWSCE) - QTest::newRow("windowsce") << QString::fromLatin1("windowsce"); -#endif -#if defined(Q_OS_WINCE_WM) && !defined(QT_NO_STYLE_WINDOWSCE) - QTest::newRow("windowsmobile") << QString::fromLatin1("windowsmobile"); -#endif } void tst_QPushButton::sizeHint() diff --git a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro index 92c2f6cb7e..6523209c32 100644 --- a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro +++ b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro @@ -8,4 +8,4 @@ INCLUDEPATH += ../ HEADERS += SOURCES += tst_qtabwidget.cpp -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp index f8125bf749..2a2331c3bf 100644 --- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp @@ -35,7 +35,7 @@ #include <qlabel.h> #include <QtWidgets/qboxlayout.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include <qt_windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ @@ -553,9 +553,7 @@ void tst_QTabWidget::paintEventCount() // Mac, Windows and Windows CE get multiple repaints on the first show, so use those as a starting point. static const int MaxInitialPaintCount = -#if defined(Q_OS_WINCE) - 4; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) 2; #elif defined(Q_OS_MAC) 5; diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 69f0ff0f7e..cecec48113 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -55,8 +55,6 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#include "../../../qtest-config.h" - //Used in copyAvailable typedef QPair<Qt::Key, Qt::KeyboardModifier> keyPairType; typedef QList<keyPairType> pairListType; @@ -125,7 +123,7 @@ private slots: void shiftDownInLineLastShouldSelectToEnd(); void undoRedoShouldRepositionTextEditCursor(); void lineWrapModes(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void mouseCursorShape(); #endif void implicitClear(); @@ -276,15 +274,8 @@ void tst_QTextEdit::getSetCheck() QCOMPARE(0, obj1.tabStopWidth()); obj1.setTabStopWidth(INT_MIN); QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value -#if defined(Q_OS_WINCE) - // due to rounding error in qRound when qreal==float - // we cannot use INT_MAX for this check - obj1.setTabStopWidth(SHRT_MAX*2); - QCOMPARE(SHRT_MAX*2, obj1.tabStopWidth()); -#else obj1.setTabStopWidth(INT_MAX); QCOMPARE(INT_MAX, obj1.tabStopWidth()); -#endif // bool QTextEdit::acceptRichText() // void QTextEdit::setAcceptRichText(bool) @@ -378,10 +369,6 @@ void tst_QTextEdit::cleanupTestCase() void tst_QTextEdit::init() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif - ed = new QTextEdit(0); rootFrameMargin = ed->document()->documentMargin(); } @@ -1230,7 +1217,7 @@ void tst_QTextEdit::lineWrapModes() QCOMPARE(ed->document()->pageSize().width(), qreal(1000)); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QTextEdit::mouseCursorShape() { // always show an IBeamCursor, see change 170146 |