diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2012-03-08 12:01:25 +0100 |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2012-03-08 12:02:41 +0100 |
commit | 79f2480c868523a7d8ffc9fb15055e8eab3237ba (patch) | |
tree | 8336143e8c09810dc97324970fed61af27e26a97 /tests/auto/gui | |
parent | 7e4f32993498db0e06346e32458a1ec7d0c7b3ec (diff) | |
parent | 12f221410fbe41d0b2efda4cd3289dfcf9044aa8 (diff) |
Merge remote-tracking branch 'origin/api_changes' into containters
Conflicts:
src/corelib/kernel/qmetaobject.cpp
src/corelib/kernel/qvariant.cpp
src/tools/moc/moc.h
Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
Diffstat (limited to 'tests/auto/gui')
9 files changed, 54 insertions, 260 deletions
diff --git a/tests/auto/gui/image/image.pro b/tests/auto/gui/image/image.pro index fe089f5e75..fa8f8df29d 100644 --- a/tests/auto/gui/image/image.pro +++ b/tests/auto/gui/image/image.pro @@ -9,7 +9,6 @@ SUBDIRS=\ qimageiohandler \ qimagewriter \ qmovie \ - qvolatileimage \ qicon \ qpicture \ diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 96171740e2..6f6662a80f 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -772,7 +772,7 @@ void tst_QImageReader::animatedGif() } } -// http://bugreports.qt.nokia.com/browse/QTBUG-6696 +// http://bugreports.qt-project.org/browse/QTBUG-6696 // Check the count of images in various call orders... void tst_QImageReader::gifImageCount() { @@ -1368,7 +1368,7 @@ void tst_QImageReader::readFromResources() SKIP_IF_UNSUPPORTED(format); for (int i = 0; i < 2; ++i) { - QString file = i ? (":/images/" + fileName) : (prefix + fileName); + QString file = i ? QString(QStringLiteral(":/images/") + fileName) : QString(prefix + fileName); { // suppress warnings if we expect them if (!message.isEmpty()) { diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro index 91d93a781d..15098770c6 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.pro +++ b/tests/auto/gui/image/qpixmap/qpixmap.pro @@ -10,5 +10,3 @@ SOURCES += tst_qpixmap.cpp RESOURCES += qpixmap.qrc TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/* - -win32:CONFIG += insignificant_test # QTBUG-24183 diff --git a/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro b/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro deleted file mode 100644 index 3d982d7951..0000000000 --- a/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG += testcase -TARGET = tst_qvolatileimage - -QT += gui-private widgets testlib - -SOURCES += tst_qvolatileimage.cpp diff --git a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp b/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp deleted file mode 100644 index f203cfec0f..0000000000 --- a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QtTest/QtTest> -#include <QtGui/qpainter.h> -#include <QtGui/qpaintengine.h> -#include <QtGui/private/qvolatileimage_p.h> - -class tst_QVolatileImage : public QObject -{ - Q_OBJECT - -public: - tst_QVolatileImage() { } - -private slots: - void create(); - void ensureFormat(); - void dataAccess(); - void sharing(); - void fill(); - void copy(); -}; - -void tst_QVolatileImage::create() -{ - QVolatileImage nullImg; - QVERIFY(nullImg.isNull()); - - QVolatileImage img(100, 200, QImage::Format_ARGB32); - QVERIFY(!img.isNull()); - QCOMPARE(img.width(), 100); - QCOMPARE(img.height(), 200); - QCOMPARE(img.format(), QImage::Format_ARGB32); - QCOMPARE(img.byteCount(), img.bytesPerLine() * img.height()); - QCOMPARE(img.hasAlphaChannel(), true); - QCOMPARE(img.depth(), 32); - - QImage source(12, 23, QImage::Format_ARGB32_Premultiplied); - img = QVolatileImage(source); - QVERIFY(!img.isNull()); - QCOMPARE(img.width(), 12); - QCOMPARE(img.height(), 23); - QCOMPARE(img.format(), source.format()); - QCOMPARE(img.byteCount(), img.bytesPerLine() * img.height()); - QVERIFY(img.imageRef() == source); - QVERIFY(img.toImage() == source); - QCOMPARE(img.hasAlphaChannel(), true); - QCOMPARE(img.hasAlphaChannel(), img.imageRef().hasAlphaChannel()); - QCOMPARE(img.hasAlphaChannel(), img.toImage().hasAlphaChannel()); - QCOMPARE(img.depth(), 32); -} - -void tst_QVolatileImage::ensureFormat() -{ - QImage source(12, 23, QImage::Format_ARGB32_Premultiplied); - QVolatileImage img(source); - QVERIFY(!img.isNull()); - QVERIFY(img.imageRef() == source); - QVERIFY(img.toImage() == source); - - QVERIFY(img.ensureFormat(QImage::Format_ARGB32_Premultiplied)); // no-op - QVERIFY(img.imageRef() == source); - QVERIFY(img.toImage() == source); - QVERIFY(img.format() == QImage::Format_ARGB32_Premultiplied); - - QVERIFY(img.ensureFormat(QImage::Format_RGB32)); // new data under-the-hood - QVERIFY(img.imageRef() != source); - QVERIFY(img.toImage() != source); - QVERIFY(img.format() == QImage::Format_RGB32); -} - -void tst_QVolatileImage::dataAccess() -{ - QImage source(12, 23, QImage::Format_ARGB32_Premultiplied); - QVolatileImage img(source); - QVERIFY(!img.isNull()); - img.beginDataAccess(); - QVERIFY(img.constBits()); - QVERIFY(img.imageRef().constBits()); - QVERIFY(img.bits()); - QVERIFY(img.imageRef().bits()); - img.endDataAccess(); - - img = QVolatileImage(12, 23, QImage::Format_ARGB32); - img.beginDataAccess(); - QVERIFY(img.constBits() && img.bits()); - img.endDataAccess(); -} - -void tst_QVolatileImage::sharing() -{ - QVolatileImage img1(100, 100, QImage::Format_ARGB32); - QVolatileImage img2 = img1; - img1.beginDataAccess(); - img2.beginDataAccess(); - QVERIFY(img1.constBits() == img2.constBits()); - img2.endDataAccess(); - img1.endDataAccess(); - img1.imageRef(); // non-const call, should detach - img1.beginDataAccess(); - img2.beginDataAccess(); - QVERIFY(img1.constBits() != img2.constBits()); - img2.endDataAccess(); - img1.endDataAccess(); - - // toImage() should return a copy of the internal QImage. - // imageRef() is a reference to the internal QImage. - QVERIFY(img1.imageRef().constBits() != img1.toImage().constBits()); -} - -bool fuzzyCompareImages(const QImage &image1, const QImage &image2, int tolerance) -{ - if (image1.bytesPerLine() != image2.bytesPerLine() - || image1.width() != image2.width() - || image1.height() != image2.height()) { - return false; - } - for (int i = 0; i < image1.height(); i++) { - const uchar *line1 = image1.scanLine(i); - const uchar *line2 = image2.scanLine(i); - int bytes = image1.bytesPerLine(); - for (int j = 0; j < bytes; j++) { - int delta = line1[j] - line2[j]; - if (qAbs(delta) > tolerance) - return false; - } - } - return true; -} - -void tst_QVolatileImage::fill() -{ - QVolatileImage img(100, 100, QImage::Format_ARGB32_Premultiplied); - QColor col = QColor(10, 20, 30); - img.fill(col.rgba()); - QVERIFY(img.imageRef().pixel(1, 1) == col.rgba()); - QVERIFY(img.toImage().pixel(1, 1) == col.rgba()); -} - -void tst_QVolatileImage::copy() -{ - QVolatileImage img(100, 100, QImage::Format_RGB32); - img.beginDataAccess(); - img.imageRef().fill(QColor(Qt::green).rgba()); - QPainter p(&img.imageRef()); - p.drawRect(10, 10, 50, 50); - p.end(); - img.endDataAccess(); - - QVolatileImage img2(100, 100, QImage::Format_RGB32); - img2.copyFrom(&img, QRect()); - QImage imgA = img.toImage(); - QImage imgB = img2.toImage(); - QCOMPARE(imgA.size(), imgB.size()); - QVERIFY(fuzzyCompareImages(imgA, imgB, 0)); - - img2 = QVolatileImage(20, 20, QImage::Format_RGB32); - img2.copyFrom(&img, QRect(5, 5, 20, 20)); - imgA = img.toImage().copy(5, 5, 20, 20); - imgB = img2.toImage(); - QCOMPARE(imgA.size(), imgB.size()); - QVERIFY(fuzzyCompareImages(imgA, imgB, 0)); -} - -QTEST_MAIN(tst_QVolatileImage) -#include "tst_qvolatileimage.moc" diff --git a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp index 97c749e5ba..61efb6e3f3 100644 --- a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp @@ -151,14 +151,9 @@ protected: Result ambigResult; }; -QT_BEGIN_NAMESPACE -template<> struct QMetaTypeId<tst_QShortcut::Widget> : public QMetaTypeId<int> -{ static inline int qt_metatype_id() { return QMetaType::Int; } }; -template<> struct QMetaTypeId<tst_QShortcut::Result> : public QMetaTypeId<int> -{ static inline int qt_metatype_id() { return QMetaType::Int; } }; -template<> struct QMetaTypeId<tst_QShortcut::Action> : public QMetaTypeId<int> -{ static inline int qt_metatype_id() { return QMetaType::Int; } }; -QT_END_NAMESPACE +Q_DECLARE_METATYPE(tst_QShortcut::Widget); +Q_DECLARE_METATYPE(tst_QShortcut::Result); +Q_DECLARE_METATYPE(tst_QShortcut::Action); class TestEdit : public QTextEdit { @@ -221,9 +216,7 @@ void tst_QShortcut::initTestCase() mainW->setFixedSize( 100, 100 ); mainW->setCentralWidget( edit ); mainW->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mainW); -#endif + QTest::qWaitForWindowShown(mainW); mainW->activateWindow(); QTest::qWait(100); connect( mainW->statusBar(), SIGNAL(messageChanged(const QString&)), @@ -251,8 +244,8 @@ Qt::KeyboardModifiers tst_QShortcut::toButtons( int key ) void tst_QShortcut::defElements() { - QTest::addColumn<int>("action"); - QTest::addColumn<int>("testWidget"); + QTest::addColumn<tst_QShortcut::Action>("action"); + QTest::addColumn<tst_QShortcut::Widget>("testWidget"); QTest::addColumn<QString>("txt"); QTest::addColumn<int>("k1"); QTest::addColumn<int>("c1"); @@ -262,7 +255,7 @@ void tst_QShortcut::defElements() QTest::addColumn<int>("c3"); QTest::addColumn<int>("k4"); QTest::addColumn<int>("c4"); - QTest::addColumn<int>("result"); + QTest::addColumn<tst_QShortcut::Result>("result"); } void tst_QShortcut::number() @@ -287,7 +280,7 @@ void tst_QShortcut::number_data() defElements(); // Clear all - QTest::newRow("N00 - clear") << ClearAll <<0<<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<<0; + QTest::newRow("N00 - clear") << ClearAll << NoWidget <<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<<NoResult; //=========================================== // [Shift + key] on non-shift shortcuts testing @@ -307,7 +300,7 @@ void tst_QShortcut::number_data() //commented out because the behaviour changed, those tests should be updated //QTest::newRow("N001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; QTest::newRow("N001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N001 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_M on Shift + Qt::Key_M @@ -321,7 +314,7 @@ void tst_QShortcut::number_data() QTest::newRow("N002 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("N002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; QTest::newRow("N002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N002 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_F1 on Qt::Key_F1 @@ -331,7 +324,7 @@ void tst_QShortcut::number_data() //commented out because the behaviour changed, those tests should be updated //QTest::newRow("N003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("N003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N003 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_F1 on Shift + Qt::Key_F1 Qt::Key_F1 on Shift + Qt::Key_F1 @@ -340,7 +333,7 @@ void tst_QShortcut::number_data() QTest::newRow("N004 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("N004:Shift+F1 - [Shift+F1]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("N004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N004 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_Tab on Qt::Key_Tab @@ -355,7 +348,7 @@ void tst_QShortcut::number_data() // (Shift+)BackTab != Tab, but Shift+BackTab == Shift+Tab QTest::newRow("N005a:Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("N005a:Shift+Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("N005a - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N005a - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_Tab on Shift + Qt::Key_Tab @@ -368,7 +361,7 @@ void tst_QShortcut::number_data() QTest::newRow("N005b:Shift+Tab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("N005b:BackTab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("N005b:Shift+BackTab - [Shift+Tab]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N005b - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N005b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_Tab on Qt::Key_Backtab @@ -384,7 +377,7 @@ void tst_QShortcut::number_data() QTest::newRow("N006a:BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //commented out because the behaviour changed, those tests should be updated //QTest::newRow("N006a:Shift+BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N006a - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N006a - clear") << ClearAll << NoWidget<< QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_Tab on Shift + Qt::Key_Backtab @@ -397,7 +390,7 @@ void tst_QShortcut::number_data() QTest::newRow("N006b:Shift+Tab - [Shift+BackTab]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("N006b:BackTab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("N006b:Shift+BackTab - [Shift+BackTab]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL - QTest::newRow("N006b - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N006b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all //=========================================== // [Shift + key] and [key] on shortcuts with @@ -412,7 +405,7 @@ void tst_QShortcut::number_data() QTest::newRow("N007 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("N007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("N007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("N007 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_M @@ -434,7 +427,7 @@ void tst_QShortcut::number_data() */ QTest::newRow("N05 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("N:Qt::Key_M on slot") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous; - QTest::newRow("N05 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N05 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Specialkeys Qt::Key_aring @@ -450,7 +443,7 @@ void tst_QShortcut::number_data() QTest::newRow("N:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("N:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; QTest::newRow("N:Qt::UNICODE_ACCEL + Qt::Key_K") << TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N09 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Multiple Sequences Qt::Key_M @@ -464,7 +457,7 @@ void tst_QShortcut::number_data() QTest::newRow("N:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("N:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered; QTest::newRow("N:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("N13 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("N13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all } // ------------------------------------------------------------------ @@ -474,7 +467,7 @@ void tst_QShortcut::text_data() { defElements(); // Clear all - QTest::newRow("T00 - clear") << ClearAll <<0<<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<<0; + QTest::newRow("T00 - clear") << ClearAll << NoWidget <<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<< NoResult; //=========================================== // [Shift + key] on non-shift shortcuts testing @@ -494,7 +487,7 @@ void tst_QShortcut::text_data() //commented out because the behaviour changed, those tests should be updated //QTest::newRow("T001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; QTest::newRow("T001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T001 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("T001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_M on Shift + Qt::Key_M @@ -510,7 +503,7 @@ void tst_QShortcut::text_data() QTest::newRow("T002 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift++") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("T002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; QTest::newRow("T002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T002 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("T002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Plus @@ -522,7 +515,7 @@ void tst_QShortcut::text_data() //QTest::newRow("T002b:Shift+Ctrl++ [Ctrl++]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("T002b:Ctrl++ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("T002b:+ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T002b - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("T002b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_F1 on Qt::Key_F1 @@ -532,7 +525,7 @@ void tst_QShortcut::text_data() //commented out because the behaviour changed, those tests should be updated //QTest::newRow("T003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("T003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T003 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("T003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Shift + Qt::Key_F1 on Shift + Qt::Key_F1 @@ -541,7 +534,7 @@ void tst_QShortcut::text_data() QTest::newRow("T004 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("T004:Shift+F1 - [Shift+F1]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("T004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; - QTest::newRow("T004 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("T004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all //=========================================== // [Shift + key] and [key] on shortcuts with @@ -556,7 +549,7 @@ void tst_QShortcut::text_data() QTest::newRow("T007 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("T007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("T007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; - QTest::newRow("T007 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("T007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Sequences Qt::Key_M @@ -579,7 +572,7 @@ void tst_QShortcut::text_data() */ QTest::newRow("T05 - slot2") << SetupAccel << TriggerSlot2 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; QTest::newRow("T:Qt::Key_M on TriggerSlot2") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous; - QTest::newRow("T06 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("T06 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Single Specialkeys Qt::Key_aring @@ -595,7 +588,7 @@ void tst_QShortcut::text_data() QTest::newRow("T:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("T:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered; QTest::newRow("T:Qt::UNICODE_ACCEL + Qt::Key_K") << TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T09 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("T09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all /* Testing Multiple Sequences Qt::Key_M @@ -608,7 +601,7 @@ void tst_QShortcut::text_data() QTest::newRow("T:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; QTest::newRow("T:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered; QTest::newRow("T:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered; - QTest::newRow("T13 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all + QTest::newRow("T13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all } // ------------------------------------------------------------------ @@ -1239,8 +1232,8 @@ void tst_QShortcut::sendKeyEvents(QWidget *w, int k1, QChar c1, int k2, QChar c2 void tst_QShortcut::testElement() { currentResult = NoResult; - QFETCH(int, action); - QFETCH(int, testWidget); + QFETCH(tst_QShortcut::Action, action); + QFETCH(tst_QShortcut::Widget, testWidget); QFETCH(QString, txt); QFETCH(int, k1); QFETCH(int, c1); @@ -1250,15 +1243,15 @@ void tst_QShortcut::testElement() QFETCH(int, c3); QFETCH(int, k4); QFETCH(int, c4); - QFETCH(int, result); + QFETCH(tst_QShortcut::Result, result); if (action == ClearAll) { clearAllShortcuts(); } else if (action == SetupAccel) { setupShortcut(testWidget, txt, k1, k2, k3, k4); } else { - sendKeyEvents(k1, c1, k2, c2, k3, c3, k4, c4); - QCOMPARE(int(currentResult), result); + sendKeyEvents(k1, c1, k2, c2, k3, c3, k4, c4); + QCOMPARE(currentResult, result); } } diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 90c96b4030..f4556f7e32 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -64,6 +64,8 @@ private slots: void touchCancelWithTouchToMouse(); void orientation(); void close(); + void activateAndClose(); + void initTestCase() { touchDevice = new QTouchDevice; @@ -632,5 +634,16 @@ void tst_QWindow::close() QVERIFY(b.close()); } +void tst_QWindow::activateAndClose() +{ + for (int i = 0; i < 10; ++i) { + QWindow window; + window.show(); + QTest::qWaitForWindowShown(&window); + window.requestActivateWindow(); + QTRY_COMPARE(qGuiApp->focusWindow(), &window); + } +} + #include <tst_qwindow.moc> QTEST_MAIN(tst_QWindow); diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 50ae22c530..7ca4fc981b 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -2938,7 +2938,7 @@ void tst_QTextDocumentFragment::backgroundImage() doc.setHtml("<p style=\"background-image: url(testPixmap)\">Hello</p>"); QBrush bg = doc.begin().blockFormat().background(); QVERIFY(bg.style() == Qt::TexturePattern); - QVERIFY(bg.texture().serialNumber() == doc.testPixmap.serialNumber()); + QCOMPARE(bg.texture().cacheKey(), doc.testPixmap.cacheKey()); } void tst_QTextDocumentFragment::dontMergePreAndNonPre() diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp index 7c9a83eaa4..a88e93c93e 100644 --- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp @@ -1283,6 +1283,9 @@ void tst_QTextScriptEngine::thaiIsolatedSaraAm() void tst_QTextScriptEngine::thaiWithZWJ() { +#ifdef Q_OS_WIN + QSKIP("This test currently fails on Windows - QTBUG-24565"); +#endif QString s(QString::fromUtf8("รร.ร.“ร…ร”ร\xA0ร本ร") + QChar(0x0363)/*superscript 'a', for testing Inherited class*/); QTextLayout layout(s); layout.beginLayout(); |