diff options
Diffstat (limited to 'tests/auto/gui')
136 files changed, 764 insertions, 758 deletions
diff --git a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro index 0ad195f629..fc25d7567a 100644 --- a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro @@ -4,16 +4,12 @@ SOURCES+= tst_qicoimageformat.cpp QT += testlib wince*: { - DEFINES += SRCDIR=\\\".\\\" - addFiles.files = icons - addFiles.path = . CONFIG(debug, debug|release):{ addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll } else { addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll } addPlugins.path = imageformats - DEPLOYMENT += addFiles addPlugins -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" + DEPLOYMENT += addPlugins } +TESTDATA += icons/* diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp index 40cd9b848a..25c6c81b2a 100644 --- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -80,8 +80,6 @@ private: tst_QIcoImageFormat::tst_QIcoImageFormat() { - m_IconPath = QLatin1String(SRCDIR) + "/icons"; - qDebug() << m_IconPath; } tst_QIcoImageFormat::~tst_QIcoImageFormat() @@ -101,7 +99,9 @@ void tst_QIcoImageFormat::cleanup() void tst_QIcoImageFormat::initTestCase() { - + m_IconPath = QFINDTESTDATA("icons"); + if (m_IconPath.isEmpty()) + QFAIL("Cannot find icons directory containing testdata!"); } void tst_QIcoImageFormat::cleanupTestCase() diff --git a/tests/auto/gui/image/qicon/qicon.pro b/tests/auto/gui/image/qicon/qicon.pro index 34fc5b7716..c44c080ced 100644 --- a/tests/auto/gui/image/qicon/qicon.pro +++ b/tests/auto/gui/image/qicon/qicon.pro @@ -7,15 +7,6 @@ RESOURCES = tst_qicon.qrc wince* { QT += xml svg - addFiles.files += $$_PRO_FILE_PWD_/*.png - addFiles.files += $$_PRO_FILE_PWD_/*.svg - addFiles.files += $$_PRO_FILE_PWD_/*.svgz - addFiles.files += $$_PRO_FILE_PWD_/tst_qicon.cpp - addFiles.path = . - DEPLOYMENT += addFiles - DEPLOYMENT_PLUGIN += qsvg - DEFINES += SRCDIR=\\\".\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" } +TESTDATA += icons/* *.png *.svg *.svgz diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 55b0c81529..7d455f1010 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -54,9 +54,6 @@ public: tst_QIcon(); private slots: - void init(); - void cleanup(); - void actualSize_data(); // test with 1 pixmap void actualSize(); void actualSize2_data(); // test with 2 pixmaps with different aspect ratio @@ -77,13 +74,10 @@ private slots: void task184901_badCache(); void task223279_inconsistentAddFile(); - void task239461_custom_iconengine_crash(); private: bool haveImageFormat(QByteArray const&); - QString oldCurrentDir; - const static QIcon staticIcon; }; @@ -91,22 +85,6 @@ private: // But we do not officially support this. See QTBUG-8666 const QIcon tst_QIcon::staticIcon = QIcon::fromTheme("edit-find"); -void tst_QIcon::init() -{ - QString srcdir(QLatin1String(SRCDIR)); - if (!srcdir.isEmpty()) { - oldCurrentDir = QDir::current().absolutePath(); - QDir::setCurrent(srcdir); - } -} - -void tst_QIcon::cleanup() -{ - if (!oldCurrentDir.isEmpty()) { - QDir::setCurrent(oldCurrentDir); - } -} - bool tst_QIcon::haveImageFormat(QByteArray const& desiredFormat) { return QImageReader::supportedImageFormats().contains(desiredFormat); @@ -136,7 +114,7 @@ void tst_QIcon::actualSize_data() QTest::newRow("resource9") << ":/rect.png" << QSize( 15, 50) << QSize( 15, 30); QTest::newRow("resource10") << ":/rect.png" << QSize( 25, 50) << QSize( 20, 40); - const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); + const QString prefix = QFileInfo(QFINDTESTDATA("icons")).absolutePath() + "/"; QTest::newRow("external0") << prefix + "image.png" << QSize(128, 128) << QSize(128, 128); QTest::newRow("external1") << prefix + "image.png" << QSize( 64, 64) << QSize( 64, 64); QTest::newRow("external2") << prefix + "image.png" << QSize( 32, 64) << QSize( 32, 32); @@ -191,7 +169,7 @@ void tst_QIcon::actualSize2_data() void tst_QIcon::actualSize2() { QIcon icon; - const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); + const QString prefix = QFileInfo(QFINDTESTDATA("icons")).absolutePath() + "/"; icon.addPixmap(QPixmap(prefix + "image.png")); icon.addPixmap(QPixmap(prefix + "rect.png")); @@ -209,7 +187,7 @@ void tst_QIcon::svgActualSize() QSKIP("SVG support is not available"); } - const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); + const QString prefix = QFileInfo(QFINDTESTDATA("icons")).absolutePath() + "/"; QIcon icon(prefix + "rect.svg"); QCOMPARE(icon.actualSize(QSize(16, 16)), QSize(16, 2)); QCOMPARE(icon.pixmap(QSize(16, 16)).size(), QSize(16, 2)); @@ -252,7 +230,7 @@ void tst_QIcon::isNull() { QVERIFY(!iconNoFileSuffix.isNull()); QVERIFY(!iconNoFileSuffix.actualSize(QSize(32, 32)).isValid()); - const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); + const QString prefix = QFileInfo(QFINDTESTDATA("icons")).absolutePath() + "/"; // test string constructor with existing file but unsupported format QIcon iconUnsupportedFormat = QIcon(prefix + "tst_qicon.cpp"); QVERIFY(!iconUnsupportedFormat.isNull()); @@ -406,7 +384,7 @@ void tst_QIcon::detach() img.fill(0xffff0000); QIcon icon1(QPixmap::fromImage(img)); QIcon icon2 = icon1; - icon2.addFile("image.png", QSize(64, 64)); + icon2.addFile(QFINDTESTDATA("image.png"), QSize(64, 64)); QImage img1 = icon1.pixmap(64, 64).toImage(); QImage img2 = icon2.pixmap(64, 64).toImage(); @@ -648,7 +626,7 @@ static inline bool operator<(const QSize &lhs, const QSize &rhs) void tst_QIcon::task184901_badCache() { - QPixmap pm("image.png"); + QPixmap pm(QFINDTESTDATA("image.png")); QIcon icon(pm); //the disabled icon must have an effect (grayed) @@ -743,32 +721,5 @@ void tst_QIcon::task223279_inconsistentAddFile() } -// During detach, v2 engines are cloned, while v1 engines are only -// passed on, so v1 engines need to be referenced counted. This test -// verifies that the engine is destroyed once and only once. - -class IconEngine : public QIconEngine -{ -public: - ~IconEngine() { destructorCalled++; } - virtual void paint(QPainter *, const QRect &, QIcon::Mode, QIcon::State) { } - static int destructorCalled; -}; -int IconEngine::destructorCalled = 0; - -void tst_QIcon::task239461_custom_iconengine_crash() -{ - QIconEngine *engine = new IconEngine(); - { - QIcon icon(engine); - QIcon icon2 = icon; - - QPixmap pixmap(32, 32); - icon.addPixmap(pixmap); - } - QCOMPARE(IconEngine::destructorCalled, 1); -} - - QTEST_MAIN(tst_QIcon) #include "tst_qicon.moc" diff --git a/tests/auto/gui/image/qimage/images/image.tif b/tests/auto/gui/image/qimage/images/image.tif Binary files differdeleted file mode 100644 index ee0637cf25..0000000000 --- a/tests/auto/gui/image/qimage/images/image.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index afa279f340..d9252f036f 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -4,11 +4,4 @@ SOURCES += tst_qimage.cpp QT += core-private gui-private testlib -wince*: { - addImages.files = images/* - addImages.path = images - DEPLOYMENT += addImages - DEFINES += SRCDIR=\\\".\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" -} +TESTDATA += images/* diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 479acea3fd..cda887d8e1 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -144,6 +144,8 @@ private slots: void deepCopyWhenPaintingActive(); void scaled_QTBUG19157(); + + void cleanupFunctions(); }; tst_QImage::tst_QImage() @@ -261,7 +263,10 @@ void tst_QImage::formatHandlersInput_data() { QTest::addColumn<QString>("testFormat"); QTest::addColumn<QString>("testFile"); - const QString prefix = QLatin1String(SRCDIR) + "/images/"; + + const QString prefix = QFINDTESTDATA("images/"); + if (prefix.isEmpty()) + QFAIL("can not find images directory!"); // add a new line here when a file is added QTest::newRow("ICO") << "ICO" << prefix + "image.ico"; @@ -274,9 +279,6 @@ void tst_QImage::formatHandlersInput_data() QTest::newRow("PPM") << "PPM" << prefix + "image.ppm"; QTest::newRow("XBM") << "XBM" << prefix + "image.xbm"; QTest::newRow("XPM") << "XPM" << prefix + "image.xpm"; -#if defined QTEST_HAVE_TIFF - QTest::newRow("TIFF") << "TIFF" << prefix + "image.tif"; -#endif } void tst_QImage::formatHandlersInput() @@ -1997,5 +1999,40 @@ void tst_QImage::scaled_QTBUG19157() QVERIFY(!foo.isNull()); } +static void cleanupFunction(void* info) +{ + bool *called = static_cast<bool*>(info); + *called = true; +} + +void tst_QImage::cleanupFunctions() +{ + QImage bufferImage(64, 64, QImage::Format_ARGB32); + bufferImage.fill(0); + + bool called; + + { + called = false; + { + QImage image(bufferImage.bits(), bufferImage.width(), bufferImage.height(), bufferImage.format(), cleanupFunction, &called); + } + QVERIFY(called); + } + + { + called = false; + QImage *copy = 0; + { + QImage image(bufferImage.bits(), bufferImage.width(), bufferImage.height(), bufferImage.format(), cleanupFunction, &called); + copy = new QImage(image); + } + QVERIFY(!called); + delete copy; + QVERIFY(called); + } + +} + QTEST_MAIN(tst_QImage) #include "tst_qimage.moc" diff --git a/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp b/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp index acf4e4f4ea..b17ca9c622 100644 --- a/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp +++ b/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/image/qimagereader/images/ball.mng b/tests/auto/gui/image/qimagereader/images/ball.mng Binary files differdeleted file mode 100644 index 81544780fd..0000000000 --- a/tests/auto/gui/image/qimagereader/images/ball.mng +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/corrupt-data.tif b/tests/auto/gui/image/qimagereader/images/corrupt-data.tif Binary files differdeleted file mode 100644 index d63c688b27..0000000000 --- a/tests/auto/gui/image/qimagereader/images/corrupt-data.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/corrupt.mng b/tests/auto/gui/image/qimagereader/images/corrupt.mng Binary files differdeleted file mode 100644 index 17fd43a5ca..0000000000 --- a/tests/auto/gui/image/qimagereader/images/corrupt.mng +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/fire.mng b/tests/auto/gui/image/qimagereader/images/fire.mng Binary files differdeleted file mode 100644 index c6695c8369..0000000000 --- a/tests/auto/gui/image/qimagereader/images/fire.mng +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/grayscale-ref.tif b/tests/auto/gui/image/qimagereader/images/grayscale-ref.tif Binary files differdeleted file mode 100644 index 960531ea86..0000000000 --- a/tests/auto/gui/image/qimagereader/images/grayscale-ref.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/grayscale.tif b/tests/auto/gui/image/qimagereader/images/grayscale.tif Binary files differdeleted file mode 100644 index 5f4e11429d..0000000000 --- a/tests/auto/gui/image/qimagereader/images/grayscale.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/image_100dpi.tif b/tests/auto/gui/image/qimagereader/images/image_100dpi.tif Binary files differdeleted file mode 100644 index fcf3cd89aa..0000000000 --- a/tests/auto/gui/image/qimagereader/images/image_100dpi.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif Binary files differdeleted file mode 100644 index 78868b0d48..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_lzw_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_lzw_littleendian.tif Binary files differdeleted file mode 100644 index 107eab74e7..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_lzw_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif Binary files differdeleted file mode 100644 index c314bae4c0..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif Binary files differdeleted file mode 100644 index 4f820f6649..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_packbits_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_packbits_littleendian.tif Binary files differdeleted file mode 100644 index ddeec38fbc..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_packbits_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif Binary files differdeleted file mode 100644 index 50a3024246..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff Binary files differdeleted file mode 100644 index 3fcb8a9aca..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff Binary files differdeleted file mode 100644 index 6f3e9d5297..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff Binary files differdeleted file mode 100644 index aab9cf2596..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff Binary files differdeleted file mode 100644 index aad96ffc6c..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff Binary files differdeleted file mode 100644 index 05d23dcb86..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff Binary files differdeleted file mode 100644 index 9ffe7fcaa4..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff Binary files differdeleted file mode 100644 index eeeb01937e..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff Binary files differdeleted file mode 100644 index 87cf2fd774..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_1.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_1.tiff Binary files differdeleted file mode 100644 index 3b589b2232..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_1.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_2.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_2.tiff Binary files differdeleted file mode 100644 index 9a662239db..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_2.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_3.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_3.tiff Binary files differdeleted file mode 100644 index eed242388c..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_3.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_4.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_4.tiff Binary files differdeleted file mode 100644 index 055480e0ca..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_4.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_5.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_5.tiff Binary files differdeleted file mode 100644 index b4d0974ec8..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_5.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_6.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_6.tiff Binary files differdeleted file mode 100644 index 3b1e02af56..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_6.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_7.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_7.tiff Binary files differdeleted file mode 100644 index b752c745c3..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_7.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_8.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_8.tiff Binary files differdeleted file mode 100644 index e228d05659..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_8.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_indexed.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_indexed.tiff Binary files differdeleted file mode 100644 index 7507e526a5..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_indexed.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_mono.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_mono.tiff Binary files differdeleted file mode 100644 index 8ff9db80f5..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_mono.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_rgb.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_rgb.tiff Binary files differdeleted file mode 100644 index 321ea3ebf5..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_rgb.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff Binary files differdeleted file mode 100644 index 2756a82fbb..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff Binary files differdeleted file mode 100644 index ae9af0999d..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff Binary files differdeleted file mode 100644 index a2f432526b..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff Binary files differdeleted file mode 100644 index f35bfc4c9c..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff Binary files differdeleted file mode 100644 index 70e5478065..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff Binary files differdeleted file mode 100644 index b2635fe14f..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff Binary files differdeleted file mode 100644 index 1fb0cd9df6..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff Binary files differdeleted file mode 100644 index 666b1b4c55..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/qimagereader.qrc b/tests/auto/gui/image/qimagereader/qimagereader.qrc index 2c70652389..3ff41d393b 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.qrc +++ b/tests/auto/gui/image/qimagereader/qimagereader.qrc @@ -6,7 +6,6 @@ <file>images/YCbCr_cmyk.png</file> <file>images/YCbCr_rgb.jpg</file> <file>images/away.png</file> - <file>images/ball.mng</file> <file>images/bat1.gif</file> <file>images/bat2.gif</file> <file>images/beavis.jpg</file> @@ -18,19 +17,16 @@ <file>images/corrupt.bmp</file> <file>images/corrupt.gif</file> <file>images/corrupt.jpg</file> - <file>images/corrupt.mng</file> <file>images/corrupt.png</file> <file>images/corrupt.xbm</file> <file>images/crash-signed-char.bmp</file> <file>images/earth.gif</file> - <file>images/fire.mng</file> <file>images/font.bmp</file> <file>images/gnus.xbm</file> <file>images/image.pbm</file> <file>images/image.pgm</file> <file>images/image.png</file> <file>images/image.ppm</file> - <file>images/image_100dpi.tif</file> <file>images/kollada.png</file> <file>images/marble.xpm</file> <file>images/namedcolors.xpm</file> diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 7504ab3466..8a18bee83f 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -121,12 +121,6 @@ private slots: void readFromResources_data(); void readFromResources(); - void dotsPerMeter_data(); - void dotsPerMeter(); - - void physicalDpi_data(); - void physicalDpi(); - void sizeBeforeRead_data(); void sizeBeforeRead(); @@ -148,15 +142,6 @@ private slots: void supportsOption_data(); void supportsOption(); - void tiffCompression_data(); - void tiffCompression(); - void tiffEndianness(); - - void tiffOrientation_data(); - void tiffOrientation(); - - void tiffGrayscale(); - void autoDetectImageFormat(); void fileNameProbing(); @@ -256,9 +241,6 @@ void tst_QImageReader::readImage_data() QTest::newRow("GIF: earth") << QString("earth.gif") << true << QByteArray("gif"); QTest::newRow("GIF: trolltech") << QString("trolltech.gif") << true << QByteArray("gif"); - QTest::newRow("MNG: ball") << QString("ball.mng") << true << QByteArray("mng"); - QTest::newRow("MNG: fire") << QString("fire.mng") << true << QByteArray("mng"); - QTest::newRow("SVG: rect") << QString("rect.svg") << true << QByteArray("svg"); QTest::newRow("SVGZ: rect") << QString("rect.svgz") << true << QByteArray("svgz"); } @@ -374,9 +356,6 @@ void tst_QImageReader::setScaledSize_data() QTest::newRow("GIF: earth") << "earth" << QSize(200, 200) << QByteArray("gif"); QTest::newRow("GIF: trolltech") << "trolltech" << QSize(200, 200) << QByteArray("gif"); - QTest::newRow("MNG: ball") << "ball" << QSize(200, 200) << QByteArray("mng"); - QTest::newRow("MNG: fire") << "fire" << QSize(200, 200) << QByteArray("mng"); - QTest::newRow("SVG: rect") << "rect" << QSize(200, 200) << QByteArray("svg"); QTest::newRow("SVGZ: rect") << "rect" << QSize(200, 200) << QByteArray("svgz"); } @@ -441,9 +420,6 @@ void tst_QImageReader::setClipRect_data() QTest::newRow("GIF: earth") << "earth" << QRect(0, 0, 50, 50) << QByteArray("gif"); QTest::newRow("GIF: trolltech") << "trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif"); - QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("SVG: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svg"); QTest::newRow("SVGZ: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svgz"); } @@ -489,9 +465,6 @@ void tst_QImageReader::setScaledClipRect_data() QTest::newRow("GIF: earth") << "earth" << QRect(0, 0, 50, 50) << QByteArray("gif"); QTest::newRow("GIF: trolltech") << "trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif"); - QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("SVG: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svg"); QTest::newRow("SVGZ: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svgz"); } @@ -545,8 +518,6 @@ void tst_QImageReader::imageFormat_data() QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp") << QImage::Format_RGB32; QTest::newRow("png") << QString("kollada.png") << QByteArray("png") << QImage::Format_ARGB32; QTest::newRow("png-2") << QString("YCbCr_cmyk.png") << QByteArray("png") << QImage::Format_RGB32; - QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng") << QImage::Format_Invalid; - QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng") << QImage::Format_Invalid; QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg") << QImage::Format_ARGB32_Premultiplied; QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz") << QImage::Format_ARGB32_Premultiplied; } @@ -625,9 +596,6 @@ void tst_QImageReader::setBackgroundColor_data() QTest::newRow("GIF: earth") << QString("earth.gif") << QColor(Qt::cyan); QTest::newRow("GIF: trolltech") << QString("trolltech.gif") << QColor(Qt::magenta); - QTest::newRow("MNG: ball") << QString("ball.mng") << QColor(Qt::yellow); - QTest::newRow("MNG: fire") << QString("fire.mng") << QColor(Qt::gray); - QTest::newRow("SVG: rect") << QString("rect.svg") << QColor(Qt::darkGreen); QTest::newRow("SVGZ: rect") << QString("rect.svgz") << QColor(Qt::darkGreen); } @@ -664,9 +632,6 @@ void tst_QImageReader::supportsAnimation_data() QTest::newRow("GIF: earth") << QString("earth.gif") << true; QTest::newRow("GIF: trolltech") << QString("trolltech.gif") << true; - QTest::newRow("MNG: ball") << QString("ball.mng") << true; - QTest::newRow("MNG: fire") << QString("fire.mng") << true; - QTest::newRow("SVG: rect") << QString("rect.svg") << false; QTest::newRow("SVGZ: rect") << QString("rect.svgz") << false; } @@ -693,10 +658,6 @@ void tst_QImageReader::sizeBeforeRead() QImageReader reader(prefix + fileName); QVERIFY(reader.canRead()); - if (format == "mng") { - QCOMPARE(reader.size(), QSize()); - return; - } QSize size = reader.size(); QVERIFY(reader.canRead()); @@ -1043,9 +1004,6 @@ void tst_QImageReader::readFromDevice_data() QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp"); QTest::newRow("png") << QString("kollada.png") << QByteArray("png"); - QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng"); - QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng"); - QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg"); QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz"); #if defined QTEST_HAVE_TGA @@ -1165,7 +1123,7 @@ void tst_QImageReader::readFromFileAfterJunk() if (format == "ppm" || format == "pbm" || format == "pgm" || format == "svg" || format == "svgz") iterations = 1; - if (format == "mng" || !QImageWriter::supportedImageFormats().contains(format)) { + if (!QImageWriter::supportedImageFormats().contains(format)) { for (int i = 0; i < iterations; ++i) { junkFile.write("deadbeef", 9); QCOMPARE(junkFile.write(imageData), qint64(imageData.size())); @@ -1321,15 +1279,6 @@ void tst_QImageReader::readFromResources_data() QTest::newRow("qtbug13653-no_eoi.jpg") << QString("qtbug13653-no_eoi.jpg") << QByteArray("jpg") << QSize(240, 180) << QString(""); - QTest::newRow("corrupt.mng") << QString("corrupt.mng") - << QByteArray("mng") << QSize(0, 0) - << QString("MNG error 901: Application signalled I/O error; chunk IHDR; subcode 0:0"); - QTest::newRow("fire.mng") << QString("fire.mng") - << QByteArray("mng") << QSize(30, 60) - << QString(""); - QTest::newRow("ball.mng") << QString("ball.mng") - << QByteArray("mng") << QSize(32, 32) - << QString(""); QTest::newRow("rect.svg") << QString("rect.svg") << QByteArray("svg") << QSize(105, 137) << QString(""); @@ -1497,9 +1446,6 @@ void tst_QImageReader::readCorruptImage_data() << QString("JPEG datastream contains no image") << QByteArray("jpeg"); QTest::newRow("corrupt gif") << QString("corrupt.gif") << true << QString("") << QByteArray("gif"); - QTest::newRow("corrupt mng") << QString("corrupt.mng") << true - << QString("MNG error 901: Application signalled I/O error; chunk IHDR; subcode 0:0") - << QByteArray("mng"); QTest::newRow("corrupt png") << QString("corrupt.png") << true << QString("") << QByteArray("png"); QTest::newRow("corrupt bmp") << QString("corrupt.bmp") << true << QString("") << QByteArray("bmp"); QTest::newRow("corrupt xpm (colors)") << QString("corrupt-colors.xpm") << true @@ -1509,7 +1455,6 @@ void tst_QImageReader::readCorruptImage_data() << QString("QImage: XPM pixels missing on image line 3") << QByteArray("xpm"); QTest::newRow("corrupt xbm") << QString("corrupt.xbm") << false << QString("") << QByteArray("xbm"); - QTest::newRow("corrupt tiff") << QString("corrupt-data.tif") << true << QString("") << QByteArray("tiff"); QTest::newRow("corrupt svg") << QString("corrupt.svg") << true << QString("") << QByteArray("svg"); QTest::newRow("corrupt svgz") << QString("corrupt.svgz") << true << QString("") << QByteArray("svgz"); } @@ -1578,148 +1523,6 @@ void tst_QImageReader::supportsOption() QVERIFY(!reader.supportsOption(option)); } -void tst_QImageReader::tiffCompression_data() -{ - QTest::addColumn<QString>("uncompressedFile"); - QTest::addColumn<QString>("compressedFile"); - - QTest::newRow("TIFF: adobedeflate") << "rgba_nocompression_littleendian.tif" - << "rgba_adobedeflate_littleendian.tif"; - QTest::newRow("TIFF: lzw") << "rgba_nocompression_littleendian.tif" - << "rgba_lzw_littleendian.tif"; - QTest::newRow("TIFF: packbits") << "rgba_nocompression_littleendian.tif" - << "rgba_packbits_littleendian.tif"; - QTest::newRow("TIFF: zipdeflate") << "rgba_nocompression_littleendian.tif" - << "rgba_zipdeflate_littleendian.tif"; -} - -void tst_QImageReader::tiffCompression() -{ - QFETCH(QString, uncompressedFile); - QFETCH(QString, compressedFile); - - SKIP_IF_UNSUPPORTED("tiff"); - - QImage uncompressedImage(prefix + uncompressedFile); - QImage compressedImage(prefix + compressedFile); - - QCOMPARE(uncompressedImage, compressedImage); -} - -void tst_QImageReader::tiffEndianness() -{ - SKIP_IF_UNSUPPORTED("tiff"); - - QImage littleEndian(prefix + "rgba_nocompression_littleendian.tif"); - QImage bigEndian(prefix + "rgba_nocompression_bigendian.tif"); - - QCOMPARE(littleEndian, bigEndian); -} - -void tst_QImageReader::tiffOrientation_data() -{ - QTest::addColumn<QString>("expected"); - QTest::addColumn<QString>("oriented"); - QTest::newRow("Indexed TIFF, orientation1") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_1.tiff"; - QTest::newRow("Indexed TIFF, orientation2") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_2.tiff"; - QTest::newRow("Indexed TIFF, orientation3") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_3.tiff"; - QTest::newRow("Indexed TIFF, orientation4") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_4.tiff"; - QTest::newRow("Indexed TIFF, orientation5") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_5.tiff"; - QTest::newRow("Indexed TIFF, orientation6") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_6.tiff"; - QTest::newRow("Indexed TIFF, orientation7") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_7.tiff"; - QTest::newRow("Indexed TIFF, orientation8") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_8.tiff"; - - QTest::newRow("Mono TIFF, orientation1") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_1.tiff"; - QTest::newRow("Mono TIFF, orientation2") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_2.tiff"; - QTest::newRow("Mono TIFF, orientation3") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_3.tiff"; - QTest::newRow("Mono TIFF, orientation4") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_4.tiff"; - QTest::newRow("Mono TIFF, orientation5") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_5.tiff"; - QTest::newRow("Mono TIFF, orientation6") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_6.tiff"; - QTest::newRow("Mono TIFF, orientation7") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_7.tiff"; - QTest::newRow("Mono TIFF, orientation8") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_8.tiff"; - - QTest::newRow("RGB TIFF, orientation1") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_1.tiff"; - QTest::newRow("RGB TIFF, orientation2") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_2.tiff"; - QTest::newRow("RGB TIFF, orientation3") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_3.tiff"; - QTest::newRow("RGB TIFF, orientation4") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_4.tiff"; - QTest::newRow("RGB TIFF, orientation5") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_5.tiff"; - QTest::newRow("RGB TIFF, orientation6") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_6.tiff"; - QTest::newRow("RGB TIFF, orientation7") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_7.tiff"; - QTest::newRow("RGB TIFF, orientation8") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_8.tiff"; -} - -void tst_QImageReader::tiffOrientation() -{ - QFETCH(QString, expected); - QFETCH(QString, oriented); - - SKIP_IF_UNSUPPORTED("tiff"); - - QImage expectedImage(prefix + expected); - QImage orientedImage(prefix + oriented); - QCOMPARE(expectedImage, orientedImage); -} - -void tst_QImageReader::tiffGrayscale() -{ - SKIP_IF_UNSUPPORTED("tiff"); - - QImage actualImage(prefix + "grayscale.tif"); - QImage expectedImage(prefix + "grayscale-ref.tif"); - - QCOMPARE(expectedImage, actualImage.convertToFormat(expectedImage.format())); -} - -void tst_QImageReader::dotsPerMeter_data() -{ - QTest::addColumn<QString>("fileName"); - QTest::addColumn<int>("expectedDotsPerMeterX"); - QTest::addColumn<int>("expectedDotsPerMeterY"); - QTest::addColumn<QByteArray>("format"); - QTest::newRow("TIFF: 72 dpi") << ("rgba_nocompression_littleendian.tif") << qRound(72 * (100 / 2.54)) << qRound(72 * (100 / 2.54)) << QByteArray("tiff"); - QTest::newRow("TIFF: 100 dpi") << ("image_100dpi.tif") << qRound(100 * (100 / 2.54)) << qRound(100 * (100 / 2.54)) << QByteArray("tiff"); -} - -void tst_QImageReader::dotsPerMeter() -{ - QFETCH(QString, fileName); - QFETCH(int, expectedDotsPerMeterX); - QFETCH(int, expectedDotsPerMeterY); - QFETCH(QByteArray, format); - - SKIP_IF_UNSUPPORTED(format); - - QImage image(prefix + fileName); - - QCOMPARE(image.dotsPerMeterX(), expectedDotsPerMeterX); - QCOMPARE(image.dotsPerMeterY(), expectedDotsPerMeterY); -} - -void tst_QImageReader::physicalDpi_data() -{ - QTest::addColumn<QString>("fileName"); - QTest::addColumn<int>("expectedPhysicalDpiX"); - QTest::addColumn<int>("expectedPhysicalDpiY"); - QTest::addColumn<QByteArray>("format"); - QTest::newRow("TIFF: 72 dpi") << "rgba_nocompression_littleendian.tif" << 72 << 72 << QByteArray("tiff"); - QTest::newRow("TIFF: 100 dpi") << "image_100dpi.tif" << 100 << 100 << QByteArray("tiff"); -} - -void tst_QImageReader::physicalDpi() -{ - QFETCH(QString, fileName); - QFETCH(int, expectedPhysicalDpiX); - QFETCH(int, expectedPhysicalDpiY); - QFETCH(QByteArray, format); - - SKIP_IF_UNSUPPORTED(format); - - QImage image(prefix + fileName); - - QCOMPARE(image.physicalDpiX(), expectedPhysicalDpiX); - QCOMPARE(image.physicalDpiY(), expectedPhysicalDpiY); -} - void tst_QImageReader::autoDetectImageFormat() { // Assume PNG is supported :-) @@ -1860,10 +1663,6 @@ void tst_QImageReader::testIgnoresFormatAndExtension_data() QTest::newRow("beavis.jpg") << "beavis" << "jpg" << "jpeg"; - QTest::newRow("fire.mng") << "fire" << "mng" << "mng"; - - QTest::newRow("image_100dpi.tif") << "image_100dpi" << "tif" << "tiff"; - QTest::newRow("rect.svg") << "rect" << "svg" << "svg"; QTest::newRow("rect.svgz") << "rect" << "svgz" << "svgz"; } diff --git a/tests/auto/gui/image/qimagewriter/images/teapot.tiff b/tests/auto/gui/image/qimagewriter/images/teapot.tiff Binary files differdeleted file mode 100644 index 20845c6e32..0000000000 --- a/tests/auto/gui/image/qimagewriter/images/teapot.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro index 10c950cf0a..b6c80b8d62 100644 --- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -3,15 +3,7 @@ TARGET = tst_qimagewriter QT += widgets testlib SOURCES += tst_qimagewriter.cpp MOC_DIR=tmp -!contains(QT_CONFIG, no-tiff):DEFINES += QTEST_HAVE_TIFF win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 -wince*: { - addFiles.files = images\\*.* - addFiles.path = images - DEPLOYMENT += addFiles - DEFINES += SRCDIR=\\\".\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" -} +TESTDATA += images/* diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 9acf210eeb..8473597dac 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -71,6 +71,7 @@ public: public slots: void init(); + void initTestCase(); void cleanup(); private slots: @@ -81,13 +82,6 @@ private slots: void writeImage2(); void supportedFormats(); - void readWriteNonDestructive_data(); - void readWriteNonDestructive(); - -#if defined QTEST_HAVE_TIFF - void largeTiff(); -#endif - void writeToInvalidDevice(); void supportsOption_data(); @@ -96,13 +90,16 @@ private slots: void saveWithNoFormat_data(); void saveWithNoFormat(); - void resolution_data(); - void resolution(); - void saveToTemporaryFile(); +private: + QString prefix; }; -static const QLatin1String prefix(SRCDIR "/images/"); +// helper to skip an autotest when the given image format is not supported +#define SKIP_IF_UNSUPPORTED(format) do { \ + if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \ + QSKIP("\"" + QByteArray(format) + "\" images are not supported"); \ +} while (0) static void initializePadding(QImage *image) { @@ -115,6 +112,13 @@ static void initializePadding(QImage *image) } } +void tst_QImageWriter::initTestCase() +{ + prefix = QFINDTESTDATA("images/"); + if (prefix.isEmpty()) + QFAIL("Can't find images directory!"); +} + // Testing get/set functions void tst_QImageWriter::getSetCheck() { @@ -194,9 +198,6 @@ void tst_QImageWriter::writeImage_data() QTest::newRow("PBM: ship63") << QString("ship63.pbm") << true << QByteArray("pbm"); QTest::newRow("XBM: gnus") << QString("gnus.xbm") << false << QByteArray("xbm"); QTest::newRow("JPEG: beavis") << QString("beavis.jpg") << true << QByteArray("jpeg"); -#if defined QTEST_HAVE_TIFF - QTest::newRow("TIFF: teapot") << QString("teapot.tiff") << false << QByteArray("tiff"); -#endif } void tst_QImageWriter::writeImage() @@ -205,6 +206,8 @@ void tst_QImageWriter::writeImage() QFETCH(bool, lossy); QFETCH(QByteArray, format); + SKIP_IF_UNSUPPORTED(format); + QImage image; { QImageReader reader(prefix + fileName); @@ -217,15 +220,22 @@ void tst_QImageWriter::writeImage() } { - // Shouldn't be able to write to read-only file - QFile sourceFile(prefix + "gen-" + fileName); - QFile::Permissions permissions = sourceFile.permissions(); - QVERIFY(sourceFile.setPermissions(QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther)); + bool skip = false; +#if defined(Q_OS_UNIX) + if (::geteuid() == 0) + skip = true; +#endif + if (!skip) { + // Shouldn't be able to write to read-only file + QFile sourceFile(prefix + "gen-" + fileName); + QFile::Permissions permissions = sourceFile.permissions(); + QVERIFY(sourceFile.setPermissions(QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther)); - QImageWriter writer(prefix + "gen-" + fileName, format); - QVERIFY(!writer.write(image)); + QImageWriter writer(prefix + "gen-" + fileName, format); + QVERIFY(!writer.write(image)); - QVERIFY(sourceFile.setPermissions(permissions)); + QVERIFY(sourceFile.setPermissions(permissions)); + } } QImage image2; @@ -268,41 +278,6 @@ void tst_QImageWriter::writeImage2_data() } } -#if defined QTEST_HAVE_TIFF -void tst_QImageWriter::largeTiff() -{ -#if !defined(Q_OS_WINCE) - QImage img(4096, 2048, QImage::Format_ARGB32); - - QPainter p(&img); - img.fill(0x0); - p.fillRect(0, 0, 4096, 2048, QBrush(Qt::CrossPattern)); - p.end(); - - QByteArray array; - QBuffer writeBuffer(&array); - writeBuffer.open(QIODevice::WriteOnly); - - QImageWriter writer(&writeBuffer, "tiff"); - QVERIFY(writer.write(img)); - - writeBuffer.close(); - - QBuffer readBuffer(&array); - readBuffer.open(QIODevice::ReadOnly); - - QImageReader reader(&readBuffer, "tiff"); - - QImage img2 = reader.read(); - QVERIFY(!img2.isNull()); - - QCOMPARE(img, img2); -#else - QWARN("not tested on WinCE"); -#endif -} -#endif - /* Workaround for the equality operator for indexed formats (which fails if the colortables are different). @@ -377,39 +352,6 @@ void tst_QImageWriter::supportedFormats() QCOMPARE(formatSet.size(), formats.size()); } -void tst_QImageWriter::readWriteNonDestructive_data() -{ - QTest::addColumn<QImage::Format>("format"); - QTest::addColumn<QImage::Format>("expectedFormat"); - QTest::addColumn<bool>("grayscale"); - QTest::newRow("tiff mono") << QImage::Format_Mono << QImage::Format_Mono << false; - QTest::newRow("tiff indexed") << QImage::Format_Indexed8 << QImage::Format_Indexed8 << false; - QTest::newRow("tiff rgb32") << QImage::Format_ARGB32 << QImage::Format_ARGB32 << false; - QTest::newRow("tiff grayscale") << QImage::Format_Indexed8 << QImage::Format_Indexed8 << true; -} - -void tst_QImageWriter::readWriteNonDestructive() -{ - QFETCH(QImage::Format, format); - QFETCH(QImage::Format, expectedFormat); - QFETCH(bool, grayscale); - QImage image = QImage(prefix + "colorful.bmp").convertToFormat(format); - - if (grayscale) { - QVector<QRgb> colors; - for (int i = 0; i < 256; ++i) - colors << qRgb(i, i, i); - image.setColorTable(colors); - } - - QVERIFY(image.save(prefix + "gen-readWriteNonDestructive.tiff")); - - QImage image2 = QImage(prefix + "gen-readWriteNonDestructive.tiff"); - QImage::Format readFormat = image2.format(); - QCOMPARE(readFormat, expectedFormat); - QCOMPARE(image, image2); -} - void tst_QImageWriter::writeToInvalidDevice() { QLatin1String fileName("/these/directories/do/not/exist/001.png"); @@ -449,15 +391,12 @@ void tst_QImageWriter::supportsOption_data() << QImageIOHandler::Description << QImageIOHandler::Quality << QImageIOHandler::Size); -#if defined QTEST_HAVE_TIFF - QTest::newRow("tiff") << QString("gen-black.tiff") - << (QIntList() << QImageIOHandler::Size - << QImageIOHandler::CompressionRatio); -#endif } void tst_QImageWriter::supportsOption() { + SKIP_IF_UNSUPPORTED(QTest::currentDataTag()); + QFETCH(QString, fileName); QFETCH(QIntList, options); @@ -500,9 +439,6 @@ void tst_QImageWriter::saveWithNoFormat_data() QTest::newRow("png") << prefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0); QTest::newRow("ppm") << prefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0); QTest::newRow("pbm") << prefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0); -#if defined QTEST_HAVE_TIFF - QTest::newRow("tiff") << prefix + QString("gen-out.tiff") << QByteArray("tiff") << QImageWriter::ImageWriterError(0); -#endif } void tst_QImageWriter::saveWithNoFormat() @@ -511,6 +447,8 @@ void tst_QImageWriter::saveWithNoFormat() QFETCH(QByteArray, format); QFETCH(QImageWriter::ImageWriterError, error); + SKIP_IF_UNSUPPORTED(format); + QImage niceImage(64, 64, QImage::Format_ARGB32); qMemSet(niceImage.bits(), 0, niceImage.byteCount()); @@ -532,39 +470,6 @@ void tst_QImageWriter::saveWithNoFormat() QVERIFY2(!outImage.isNull(), qPrintable(reader.errorString())); } -void tst_QImageWriter::resolution_data() -{ - QTest::addColumn<QString>("filename"); - QTest::addColumn<int>("expectedDotsPerMeterX"); - QTest::addColumn<int>("expectedDotsPerMeterY"); -#if defined QTEST_HAVE_TIFF - QTest::newRow("TIFF: 100 dpi") << ("image_100dpi.tif") << qRound(100 * (100 / 2.54)) << qRound(100 * (100 / 2.54)); - QTest::newRow("TIFF: 50 dpi") << ("image_50dpi.tif") << qRound(50 * (100 / 2.54)) << qRound(50 * (100 / 2.54)); - QTest::newRow("TIFF: 300 dot per meter") << ("image_300dpm.tif") << 300 << 300; -#endif -} - -void tst_QImageWriter::resolution() -{ - QFETCH(QString, filename); - QFETCH(int, expectedDotsPerMeterX); - QFETCH(int, expectedDotsPerMeterY); - - QImage image(prefix + QLatin1String("colorful.bmp")); - image.setDotsPerMeterX(expectedDotsPerMeterX); - image.setDotsPerMeterY(expectedDotsPerMeterY); - const QString generatedFilepath = prefix + "gen-" + filename; - { - QImageWriter writer(generatedFilepath); - QVERIFY(writer.write(image)); - } - QImageReader reader(generatedFilepath); - const QImage generatedImage = reader.read(); - - QCOMPARE(expectedDotsPerMeterX, generatedImage.dotsPerMeterX()); - QCOMPARE(expectedDotsPerMeterY, generatedImage.dotsPerMeterY()); -} - void tst_QImageWriter::saveToTemporaryFile() { QImage image(prefix + "kollada.png"); diff --git a/tests/auto/gui/image/qmovie/animations/dutch.mng b/tests/auto/gui/image/qmovie/animations/dutch.mng Binary files differdeleted file mode 100644 index 4917fdee7a..0000000000 --- a/tests/auto/gui/image/qmovie/animations/dutch.mng +++ /dev/null diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro index 5da0b80670..b2891a482f 100644 --- a/tests/auto/gui/image/qmovie/qmovie.pro +++ b/tests/auto/gui/image/qmovie/qmovie.pro @@ -6,7 +6,6 @@ MOC_DIR=tmp !contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF !contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG -!contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG RESOURCES += resources.qrc TESTDATA += animations/* diff --git a/tests/auto/gui/image/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp index d0c5e91f57..1a66141ea1 100644 --- a/tests/auto/gui/image/qmovie/tst_qmovie.cpp +++ b/tests/auto/gui/image/qmovie/tst_qmovie.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -137,10 +137,6 @@ void tst_QMovie::playMovie_data() { QTest::addColumn<QString>("fileName"); QTest::addColumn<int>("frameCount"); -#if defined(QTEST_HAVE_MNG) && !defined(Q_OS_WINCE) - // Qt/WinCE runs out of memory for this one... - QTest::newRow("home") << QString("animations/dutch.mng") << 10; -#endif #ifdef QTEST_HAVE_GIF QTest::newRow("comicsecard") << QString("animations/comicsecard.gif") << 5; QTest::newRow("trolltech") << QString("animations/trolltech.gif") << 34; @@ -191,7 +187,7 @@ void tst_QMovie::jumpToFrame_data() void tst_QMovie::jumpToFrame() { QFETCH(QString, fileName); - QMovie movie(fileName); + QMovie movie(QFINDTESTDATA(fileName)); movie.start(); movie.stop(); QVERIFY(movie.jumpToFrame(-1) == false); diff --git a/tests/auto/gui/image/qpicture/tst_qpicture.cpp b/tests/auto/gui/image/qpicture/tst_qpicture.cpp index d4dc254dcb..8c2db9bed7 100644 --- a/tests/auto/gui/image/qpicture/tst_qpicture.cpp +++ b/tests/auto/gui/image/qpicture/tst_qpicture.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro index fc09164c46..15098770c6 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.pro +++ b/tests/auto/gui/image/qpixmap/qpixmap.pro @@ -4,25 +4,9 @@ TARGET = tst_qpixmap QT += core-private gui-private widgets widgets-private testlib SOURCES += tst_qpixmap.cpp -wince* { - task31722_0.files = convertFromImage/task31722_0/*.png - task31722_0.path = convertFromImage/task31722_0 - - task31722_1.files = convertFromImage/task31722_1/*.png - task31722_1.path = convertFromImage/task31722_1 - - icons.files = convertFromToHICON/* - icons.path = convertFromToHICON - - loadFromData.files = loadFromData/* - loadFromData.path = loadFromData - - DEPLOYMENT += task31722_0 task31722_1 icons loadFromData - DEFINES += SRCDIR=\\\".\\\" - DEPLOYMENT_PLUGIN += qico -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" +!wince* { win32:LIBS += -lgdi32 -luser32 } RESOURCES += qpixmap.qrc +TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/* diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 7ae680dbdb..527dcce916 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -79,6 +79,7 @@ public: public slots: void init(); void cleanup(); + void cleanupTestCase(); private slots: void swap(); @@ -215,6 +216,11 @@ void tst_QPixmap::cleanup() { } +void tst_QPixmap::cleanupTestCase() +{ + QFile::remove(QLatin1String("temp_image.png")); +} + void tst_QPixmap::swap() { QPixmap p1( 16, 16 ), p2( 32, 32 ); @@ -300,7 +306,7 @@ void tst_QPixmap::convertFromImage_data() { QTest::addColumn<QImage>("img1"); QTest::addColumn<QImage>("img2"); - const QString prefix = QLatin1String(SRCDIR) + "/convertFromImage"; + const QString prefix = QFINDTESTDATA("convertFromImage"); { QImage img1; @@ -853,12 +859,14 @@ void tst_QPixmap::convertFromImageDetach() #if defined(Q_OS_WIN) +QT_BEGIN_NAMESPACE Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap); Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0); Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0); Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p); Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h); Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon); +QT_END_NAMESPACE void tst_QPixmap::toWinHBITMAP_data() { @@ -994,7 +1002,7 @@ void tst_QPixmap::toWinHICON_data() QTest::addColumn<int>("width"); QTest::addColumn<int>("height"); - const QString prefix = QLatin1String(SRCDIR) + "/convertFromToHICON"; + const QString prefix = QFINDTESTDATA("convertFromToHICON"); QTest::newRow("32bpp_16x16") << prefix + QLatin1String("/icon_32bpp") << 16 << 16; QTest::newRow("32bpp_32x32") << prefix + QLatin1String("/icon_32bpp") << 32 << 32; @@ -1290,7 +1298,7 @@ void tst_QPixmap::loadFromDataImage_data() { QTest::addColumn<QString>("imagePath"); - const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; + const QString prefix = QFINDTESTDATA("loadFromData"); QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; // When no extension is provided we try all extensions that has been registered by image providers @@ -1324,7 +1332,7 @@ void tst_QPixmap::fromImageReader_data() { QTest::addColumn<QString>("imagePath"); - const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; + const QString prefix = QFINDTESTDATA("loadFromData"); QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png"; @@ -1362,7 +1370,7 @@ void tst_QPixmap::fromImageReaderAnimatedGif() { QFETCH(QString, imagePath); - const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; + const QString prefix = QFINDTESTDATA("loadFromData"); const QString path = prefix + imagePath; QImageReader referenceReader(path); diff --git a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp index c79e42f908..0127e2cc83 100644 --- a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp b/tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp index 91ba2332d1..c9b2e054da 100644 --- a/tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp +++ b/tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp b/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp index 158ccc5770..f203cfec0f 100644 --- a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp +++ b/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index e473463828..1adae128cf 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -6,7 +6,7 @@ SUBDIRS=\ qfileopenevent \ qguimetatype \ qguivariant \ - qinputpanel \ + qinputmethod \ qkeysequence \ qmouseevent \ qmouseevent_modal \ @@ -15,3 +15,4 @@ SUBDIRS=\ qshortcut \ qtouchevent \ qwindow \ + qguiapplication \ diff --git a/tests/auto/gui/kernel/qclipboard/copier/main.cpp b/tests/auto/gui/kernel/qclipboard/copier/main.cpp index 7e3efa03ba..bbce35a15d 100644 --- a/tests/auto/gui/kernel/qclipboard/copier/main.cpp +++ b/tests/auto/gui/kernel/qclipboard/copier/main.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qclipboard/paster/main.cpp b/tests/auto/gui/kernel/qclipboard/paster/main.cpp index 3ca4886f0b..473ea8bd42 100644 --- a/tests/auto/gui/kernel/qclipboard/paster/main.cpp +++ b/tests/auto/gui/kernel/qclipboard/paster/main.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qclipboard/qclipboard.pro b/tests/auto/gui/kernel/qclipboard/qclipboard.pro index 692ca5dd3f..d97c58dea0 100644 --- a/tests/auto/gui/kernel/qclipboard/qclipboard.pro +++ b/tests/auto/gui/kernel/qclipboard/qclipboard.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = test copier paster - - +SUBDIRS = copier paster +test.depends += $$SUBDIRS +SUBDIRS += test diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro index 1c92fa4107..4be6769592 100644 --- a/tests/auto/gui/kernel/qclipboard/test/test.pro +++ b/tests/auto/gui/kernel/qclipboard/test/test.pro @@ -12,12 +12,11 @@ win32 { } wince* { - copier.files = ../copier/copier.exe - copier.path = copier - paster.files = ../paster/paster.exe - paster.path = paster - - DEPLOYMENT += copier paster rsc reg_resource + DEPLOYMENT += rsc reg_resource } mac: CONFIG += insignificant_test # QTBUG-23057 + +load(testcase) # for target.path and installTestHelperApp() +installTestHelperApp("../copier/copier",copier,copier) +installTestHelperApp("../paster/paster",paster,paster) diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index fcba0958e7..e1b0535e2f 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -46,7 +46,7 @@ #include <QtCore/QDir> #include <QtGui/QGuiApplication> #include <QtGui/QClipboard> -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC #include <Carbon/Carbon.h> #endif @@ -74,7 +74,7 @@ void tst_QClipboard::init() bool tst_QClipboard::nativeClipboardWorking() { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC PasteboardRef pasteboard; OSStatus status = PasteboardCreate(0, &pasteboard); if (status == noErr) @@ -295,7 +295,7 @@ void tst_QClipboard::setMimeData() QCOMPARE(spySelection.count(), 1); QCOMPARE(spyData.count(), 1); QCOMPARE(spyFindBuffer.count(), 0); -#elif defined(Q_WS_MAC) +#elif defined(Q_OS_MAC) QCOMPARE(spySelection.count(), 0); QCOMPARE(spyData.count(), 1); QCOMPARE(spyFindBuffer.count(), 1); @@ -328,7 +328,7 @@ void tst_QClipboard::setMimeData() QCOMPARE(spySelection.count(), 1); QCOMPARE(spyData.count(), 1); QCOMPARE(spyFindBuffer.count(), 0); -#elif defined(Q_WS_MAC) +#elif defined(Q_OS_MAC) QCOMPARE(spySelection.count(), 0); QCOMPARE(spyData.count(), 1); QCOMPARE(spyFindBuffer.count(), 1); diff --git a/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp b/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp index 47ff1b05f1..ae9cd55b7c 100644 --- a/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp +++ b/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qevent/tst_qevent.cpp b/tests/auto/gui/kernel/qevent/tst_qevent.cpp index f0771330f7..1d60ff2609 100644 --- a/tests/auto/gui/kernel/qevent/tst_qevent.cpp +++ b/tests/auto/gui/kernel/qevent/tst_qevent.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp index 0c0bff551b..9d138f6a2e 100644 --- a/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp +++ b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp index 207356fe84..770b729761 100644 --- a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp +++ b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro new file mode 100644 index 0000000000..fffa097d73 --- /dev/null +++ b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro @@ -0,0 +1,4 @@ +CONFIG += testcase +TARGET = tst_qguiapplication +QT += core gui testlib +SOURCES = tst_qguiapplication.cpp diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp new file mode 100644 index 0000000000..2fd875b7f4 --- /dev/null +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** 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/QGuiApplication> +#include <QtGui/QWindow> +#include <QDebug> + +class tst_QGuiApplication: public QObject +{ + Q_OBJECT + +private slots: + void focusObject(); + void allWindows(); + void topLevelWindows(); +}; + +class DummyWindow : public QWindow +{ +public: + DummyWindow() : m_focusObject(0) {} + + virtual QObject *focusObject() const + { + return m_focusObject; + } + + void setFocusObject(QObject *object) + { + m_focusObject = object; + emit focusObjectChanged(object); + } + + QObject *m_focusObject; +}; + + +void tst_QGuiApplication::focusObject() +{ + int argc = 0; + QGuiApplication app(argc, 0); + + QObject obj1, obj2, obj3; + DummyWindow window1; + DummyWindow window2; + window1.show(); + + QSignalSpy spy(&app, SIGNAL(focusObjectChanged(QObject *))); + + + // verify active window focus propagates to qguiapplication + QTest::qWaitForWindowShown(&window1); + window1.requestActivateWindow(); + QTRY_COMPARE(app.focusWindow(), &window1); + + window1.setFocusObject(&obj1); + QCOMPARE(app.focusObject(), &obj1); + QCOMPARE(spy.count(), 1); + + spy.clear(); + window1.setFocusObject(&obj2); + QCOMPARE(app.focusObject(), &obj2); + QCOMPARE(spy.count(), 1); + + spy.clear(); + window2.setFocusObject(&obj3); + QCOMPARE(app.focusObject(), &obj2); // not yet changed + window2.show(); + QTest::qWaitForWindowShown(&window2); + QTRY_COMPARE(app.focusWindow(), &window2); + QCOMPARE(app.focusObject(), &obj3); + QCOMPARE(spy.count(), 1); + + // focus change on unfocused window does not show + spy.clear(); + window1.setFocusObject(&obj1); + QCOMPARE(spy.count(), 0); + QCOMPARE(app.focusObject(), &obj3); +} + +void tst_QGuiApplication::allWindows() +{ + int argc = 0; + QGuiApplication app(argc, 0); + QWindow *window1 = new QWindow; + QWindow *window2 = new QWindow(window1); + QVERIFY(app.allWindows().contains(window1)); + QVERIFY(app.allWindows().contains(window2)); + QCOMPARE(app.allWindows().count(), 2); + delete window1; + window1 = 0; + window2 = 0; + QVERIFY(!app.allWindows().contains(window2)); + QVERIFY(!app.allWindows().contains(window1)); + QCOMPARE(app.allWindows().count(), 0); +} + +void tst_QGuiApplication::topLevelWindows() +{ + int argc = 0; + QGuiApplication app(argc, 0); + QWindow *window1 = new QWindow; + QWindow *window2 = new QWindow(window1); + QVERIFY(app.topLevelWindows().contains(window1)); + QVERIFY(!app.topLevelWindows().contains(window2)); + QCOMPARE(app.topLevelWindows().count(), 1); + delete window1; + window1 = 0; + window2 = 0; + QVERIFY(!app.topLevelWindows().contains(window2)); + QVERIFY(!app.topLevelWindows().contains(window1)); + QCOMPARE(app.topLevelWindows().count(), 0); +} + +QTEST_APPLESS_MAIN(tst_QGuiApplication) +#include "tst_qguiapplication.moc" diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp index d0f12ea945..0514eafa2d 100644 --- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp index 56a1fb0d8f..90984eb9f9 100644 --- a/tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qinputmethod/qinputmethod.pro b/tests/auto/gui/kernel/qinputmethod/qinputmethod.pro new file mode 100644 index 0000000000..015cc782eb --- /dev/null +++ b/tests/auto/gui/kernel/qinputmethod/qinputmethod.pro @@ -0,0 +1,4 @@ +CONFIG += testcase +TARGET = tst_qinputmethod +SOURCES += tst_qinputmethod.cpp +QT += core-private gui-private testlib diff --git a/tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp index b46899a84d..c10d954489 100644 --- a/tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp +++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -42,7 +42,7 @@ #include <QtTest/QtTest> #include <private/qguiapplication_p.h> -#include <private/qinputpanel_p.h> +#include <private/qinputmethod_p.h> #include <qplatforminputcontext_qpa.h> class PlatformInputContext : public QPlatformInputContext @@ -57,7 +57,7 @@ public: m_localeCallCount(0), m_inputDirectionCallCount(0), m_lastQueries(Qt::ImhNone), - m_action(QInputPanel::Click), + m_action(QInputMethod::Click), m_cursorPosition(0), m_lastEventType(QEvent::None) {} @@ -72,7 +72,7 @@ public: m_updateCallCount++; m_lastQueries = queries; } - virtual void invokeAction(QInputPanel::Action action, int cursorPosition) + virtual void invokeAction(QInputMethod::Action action, int cursorPosition) { m_action = action; m_cursorPosition = cursorPosition; @@ -112,7 +112,7 @@ public: mutable int m_localeCallCount; mutable int m_inputDirectionCallCount; Qt::InputMethodQueries m_lastQueries; - QInputPanel::Action m_action; + QInputMethod::Action m_action; int m_cursorPosition; int m_lastEventType; QRectF m_keyboardRect; @@ -139,12 +139,12 @@ public: Qt::InputMethodQueries m_lastQueries; }; -class tst_qinputpanel : public QObject +class tst_qinputmethod : public QObject { Q_OBJECT public: - tst_qinputpanel() {} - virtual ~tst_qinputpanel() {} + tst_qinputmethod() {} + virtual ~tst_qinputmethod() {} private slots: void initTestCase(); void visible(); @@ -164,158 +164,158 @@ private: PlatformInputContext m_platformInputContext; }; -void tst_qinputpanel::initTestCase() +void tst_qinputmethod::initTestCase() { - QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel()); - inputPanelPrivate->testContext = &m_platformInputContext; + QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); + inputMethodPrivate->testContext = &m_platformInputContext; } -void tst_qinputpanel::visible() +void tst_qinputmethod::visible() { - QCOMPARE(qApp->inputPanel()->visible(), false); - qApp->inputPanel()->show(); - QCOMPARE(qApp->inputPanel()->visible(), true); + QCOMPARE(qApp->inputMethod()->visible(), false); + qApp->inputMethod()->show(); + QCOMPARE(qApp->inputMethod()->visible(), true); - qApp->inputPanel()->hide(); - QCOMPARE(qApp->inputPanel()->visible(), false); + qApp->inputMethod()->hide(); + QCOMPARE(qApp->inputMethod()->visible(), false); - qApp->inputPanel()->setVisible(true); - QCOMPARE(qApp->inputPanel()->visible(), true); + qApp->inputMethod()->setVisible(true); + QCOMPARE(qApp->inputMethod()->visible(), true); - qApp->inputPanel()->setVisible(false); - QCOMPARE(qApp->inputPanel()->visible(), false); + qApp->inputMethod()->setVisible(false); + QCOMPARE(qApp->inputMethod()->visible(), false); } -void tst_qinputpanel::animating() +void tst_qinputmethod::animating() { - QCOMPARE(qApp->inputPanel()->isAnimating(), false); + QCOMPARE(qApp->inputMethod()->isAnimating(), false); m_platformInputContext.m_animating = true; - QCOMPARE(qApp->inputPanel()->isAnimating(), true); + QCOMPARE(qApp->inputMethod()->isAnimating(), true); m_platformInputContext.m_animating = false; - QCOMPARE(qApp->inputPanel()->isAnimating(), false); + QCOMPARE(qApp->inputMethod()->isAnimating(), false); - QSignalSpy spy(qApp->inputPanel(), SIGNAL(animatingChanged())); + QSignalSpy spy(qApp->inputMethod(), SIGNAL(animatingChanged())); m_platformInputContext.emitAnimatingChanged(); QCOMPARE(spy.count(), 1); } -void tst_qinputpanel::keyboarRectangle() +void tst_qinputmethod::keyboarRectangle() { - QCOMPARE(qApp->inputPanel()->keyboardRectangle(), QRectF()); + QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF()); m_platformInputContext.m_keyboardRect = QRectF(10, 20, 30, 40); - QCOMPARE(qApp->inputPanel()->keyboardRectangle(), QRectF(10, 20, 30, 40)); + QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF(10, 20, 30, 40)); - QSignalSpy spy(qApp->inputPanel(), SIGNAL(keyboardRectangleChanged())); + QSignalSpy spy(qApp->inputMethod(), SIGNAL(keyboardRectangleChanged())); m_platformInputContext.emitKeyboardRectChanged(); QCOMPARE(spy.count(), 1); } -void tst_qinputpanel::inputItem() +void tst_qinputmethod::inputItem() { - QVERIFY(!qApp->inputPanel()->inputItem()); - QSignalSpy spy(qApp->inputPanel(), SIGNAL(inputItemChanged())); + QVERIFY(!qApp->inputMethod()->inputItem()); + QSignalSpy spy(qApp->inputMethod(), SIGNAL(inputItemChanged())); - qApp->inputPanel()->setInputItem(&m_inputItem); + qApp->inputMethod()->setInputItem(&m_inputItem); - QCOMPARE(qApp->inputPanel()->inputItem(), &m_inputItem); + QCOMPARE(qApp->inputMethod()->inputItem(), &m_inputItem); QCOMPARE(spy.count(), 1); // reset - qApp->inputPanel()->setInputItem(0); + qApp->inputMethod()->setInputItem(0); } -void tst_qinputpanel::inputItemTransform() +void tst_qinputmethod::inputItemTransform() { - QCOMPARE(qApp->inputPanel()->inputItemTransform(), QTransform()); - QSignalSpy spy(qApp->inputPanel(), SIGNAL(cursorRectangleChanged())); + QCOMPARE(qApp->inputMethod()->inputItemTransform(), QTransform()); + QSignalSpy spy(qApp->inputMethod(), SIGNAL(cursorRectangleChanged())); QTransform transform; transform.translate(10, 10); transform.scale(2, 2); transform.shear(2, 2); - qApp->inputPanel()->setInputItemTransform(transform); + qApp->inputMethod()->setInputItemTransform(transform); - QCOMPARE(qApp->inputPanel()->inputItemTransform(), transform); + QCOMPARE(qApp->inputMethod()->inputItemTransform(), transform); QCOMPARE(spy.count(), 1); // reset - qApp->inputPanel()->setInputItemTransform(QTransform()); + qApp->inputMethod()->setInputItemTransform(QTransform()); } -void tst_qinputpanel::cursorRectangle() +void tst_qinputmethod::cursorRectangle() { - QCOMPARE(qApp->inputPanel()->cursorRectangle(), QRectF()); + QCOMPARE(qApp->inputMethod()->cursorRectangle(), QRectF()); QTransform transform; transform.translate(10, 10); transform.scale(2, 2); transform.shear(2, 2); - qApp->inputPanel()->setInputItemTransform(transform); - qApp->inputPanel()->setInputItem(&m_inputItem); + qApp->inputMethod()->setInputItemTransform(transform); + qApp->inputMethod()->setInputItem(&m_inputItem); - QCOMPARE(qApp->inputPanel()->cursorRectangle(), transform.mapRect(QRectF(1, 2, 3, 4))); + QCOMPARE(qApp->inputMethod()->cursorRectangle(), transform.mapRect(QRectF(1, 2, 3, 4))); // reset - qApp->inputPanel()->setInputItem(0); - qApp->inputPanel()->setInputItemTransform(QTransform()); + qApp->inputMethod()->setInputItem(0); + qApp->inputMethod()->setInputItemTransform(QTransform()); } -void tst_qinputpanel::invokeAction() +void tst_qinputmethod::invokeAction() { - QCOMPARE(m_platformInputContext.m_action, QInputPanel::Click); + QCOMPARE(m_platformInputContext.m_action, QInputMethod::Click); QCOMPARE(m_platformInputContext.m_cursorPosition, 0); - qApp->inputPanel()->invokeAction(QInputPanel::ContextMenu, 5); - QCOMPARE(m_platformInputContext.m_action, QInputPanel::ContextMenu); + qApp->inputMethod()->invokeAction(QInputMethod::ContextMenu, 5); + QCOMPARE(m_platformInputContext.m_action, QInputMethod::ContextMenu); QCOMPARE(m_platformInputContext.m_cursorPosition, 5); } -void tst_qinputpanel::reset() +void tst_qinputmethod::reset() { QCOMPARE(m_platformInputContext.m_resetCallCount, 0); - qApp->inputPanel()->reset(); + qApp->inputMethod()->reset(); QCOMPARE(m_platformInputContext.m_resetCallCount, 1); - qApp->inputPanel()->reset(); + qApp->inputMethod()->reset(); QCOMPARE(m_platformInputContext.m_resetCallCount, 2); } -void tst_qinputpanel::commit() +void tst_qinputmethod::commit() { QCOMPARE(m_platformInputContext.m_commitCallCount, 0); - qApp->inputPanel()->commit(); + qApp->inputMethod()->commit(); QCOMPARE(m_platformInputContext.m_commitCallCount, 1); - qApp->inputPanel()->commit(); + qApp->inputMethod()->commit(); QCOMPARE(m_platformInputContext.m_commitCallCount, 2); } -void tst_qinputpanel::update() +void tst_qinputmethod::update() { - qApp->inputPanel()->setInputItem(&m_inputItem); + qApp->inputMethod()->setInputItem(&m_inputItem); QCOMPARE(m_platformInputContext.m_updateCallCount, 0); QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImhNone)); - qApp->inputPanel()->update(Qt::ImQueryInput); + qApp->inputMethod()->update(Qt::ImQueryInput); QCOMPARE(m_platformInputContext.m_updateCallCount, 1); QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImQueryInput)); - qApp->inputPanel()->update(Qt::ImQueryAll); + qApp->inputMethod()->update(Qt::ImQueryAll); QCOMPARE(m_platformInputContext.m_updateCallCount, 2); QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImQueryAll)); - QCOMPARE(qApp->inputPanel()->keyboardRectangle(), QRectF(10, 20, 30, 40)); + QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF(10, 20, 30, 40)); // reset - qApp->inputPanel()->setInputItem(0); + qApp->inputMethod()->setInputItem(0); } -void tst_qinputpanel::query() +void tst_qinputmethod::query() { QInputMethodQueryEvent query(Qt::InputMethodQueries(Qt::ImPreferredLanguage | Qt::ImCursorRectangle)); QGuiApplication::sendEvent(&m_inputItem, &query); @@ -327,16 +327,16 @@ void tst_qinputpanel::query() QCOMPARE(cursorRectangle, QRect(1,2,3,4)); } -void tst_qinputpanel::inputDirection() +void tst_qinputmethod::inputDirection() { QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 0); - qApp->inputPanel()->inputDirection(); + qApp->inputMethod()->inputDirection(); QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 1); QCOMPARE(m_platformInputContext.m_localeCallCount, 0); - qApp->inputPanel()->locale(); + qApp->inputMethod()->locale(); QCOMPARE(m_platformInputContext.m_localeCallCount, 1); } -QTEST_MAIN(tst_qinputpanel) -#include "tst_qinputpanel.moc" +QTEST_MAIN(tst_qinputmethod) +#include "tst_qinputmethod.moc" diff --git a/tests/auto/gui/kernel/qinputpanel/qinputpanel.pro b/tests/auto/gui/kernel/qinputpanel/qinputpanel.pro deleted file mode 100644 index 5e3f4b1504..0000000000 --- a/tests/auto/gui/kernel/qinputpanel/qinputpanel.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += testcase -TARGET = tst_qinputpanel -SOURCES += tst_qinputpanel.cpp -QT += core-private gui-private testlib diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index fcc30a7afe..eed7977c82 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -47,7 +47,7 @@ #include <QTranslator> #include <QLibraryInfo> -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC #include <Carbon/Carbon.h> struct MacSpecialKey { int key; @@ -144,7 +144,7 @@ private slots: private: QTranslator *ourTranslator; QTranslator *qtTranslator; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC static const QString MacCtrl; static const QString MacMeta; static const QString MacAlt; @@ -154,7 +154,7 @@ private: }; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC const QString tst_QKeySequence::MacCtrl = QString(QChar(0x2318)); const QString tst_QKeySequence::MacMeta = QString(QChar(0x2303)); const QString tst_QKeySequence::MacAlt = QString(QChar(0x2325)); @@ -195,7 +195,7 @@ void tst_QKeySequence::operatorQString_data() QTest::newRow( "No modifier" ) << 0 << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << QString( "\x0c5" ); -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC QTest::newRow( "Ctrl+Left" ) << int(Qt::CTRL) << int(Qt::Key_Left) << QString( "Ctrl+Left" ); QTest::newRow( "Ctrl+," ) << int(Qt::CTRL) << int(Qt::Key_Comma) << QString( "Ctrl+," ); QTest::newRow( "Alt+Left" ) << int(Qt::ALT) << int(Qt::Key_Left) << QString( "Alt+Left" ); @@ -339,7 +339,7 @@ void tst_QKeySequence::standardKeys_data() QTest::newRow("zoomOut") << (int)QKeySequence::ZoomOut<< QString("CTRL+-"); QTest::newRow("whatsthis") << (int)QKeySequence::WhatsThis<< QString("SHIFT+F1"); -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) QTest::newRow("help") << (int)QKeySequence::HelpContents<< QString("Ctrl+?"); QTest::newRow("nextChild") << (int)QKeySequence::NextChild << QString("CTRL+}"); QTest::newRow("previousChild") << (int)QKeySequence::PreviousChild << QString("CTRL+{"); @@ -371,7 +371,7 @@ void tst_QKeySequence::keyBindings() { QList<QKeySequence> bindings = QKeySequence::keyBindings(QKeySequence::Copy); QList<QKeySequence> expected; -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) expected << QKeySequence("CTRL+C"); #elif defined Q_WS_X11 expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT"); @@ -402,7 +402,7 @@ void tst_QKeySequence::mnemonic_data() void tst_QKeySequence::mnemonic() { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC QSKIP("mnemonics are not used on Mac OS X"); #endif QFETCH(QString, string); @@ -429,7 +429,7 @@ void tst_QKeySequence::toString_data() QTest::addColumn<QString>("platformString"); -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC QTest::newRow("Ctrl+Left") << QString("Ctrl+Left") << QString("Ctrl+Left") << QString("Ctrl+Left"); QTest::newRow("Alt+Left") << QString("Alt+Left") << QString("Alt+Left") << QString("Alt+Left"); QTest::newRow("Alt+Shift+Left") << QString("Alt+Shift+Left") << QString("Alt+Shift+Left") << QString("Alt+Shift+Left"); @@ -529,17 +529,46 @@ void tst_QKeySequence::parseString_data() QTest::addColumn<QString>("strSequence"); QTest::addColumn<QKeySequence>("keycode"); + // Valid QTest::newRow("A") << "A" << QKeySequence(Qt::Key_A); QTest::newRow("a") << "a" << QKeySequence(Qt::Key_A); QTest::newRow("Ctrl+Left") << "Ctrl+Left" << QKeySequence(Qt::CTRL + Qt::Key_Left); - QTest::newRow("Ctrl++") << "Ctrl++" << QKeySequence(Qt::CTRL + Qt::Key_Plus); + QTest::newRow("CTRL+LEFT") << "CTRL+LEFT" << QKeySequence(Qt::CTRL + Qt::Key_Left); QTest::newRow("Meta+A") << "Meta+a" << QKeySequence(Qt::META + Qt::Key_A); + QTest::newRow("mEtA+A") << "mEtA+a" << QKeySequence(Qt::META + Qt::Key_A); + QTest::newRow("Ctrl++") << "Ctrl++" << QKeySequence(Qt::CTRL + Qt::Key_Plus); + + // Invalid modifiers QTest::newRow("Win+A") << "Win+a" << QKeySequence(Qt::Key_unknown); - QTest::newRow("4+3=2") << "4+3=2" << QKeySequence(Qt::Key_unknown); QTest::newRow("Super+Meta+A") << "Super+Meta+A" << QKeySequence(Qt::Key_unknown); + + // Invalid Keys QTest::newRow("Meta+Trolls") << "Meta+Trolls" << QKeySequence(Qt::Key_unknown); + QTest::newRow("Meta+Period") << "Meta+Period" << QKeySequence(Qt::Key_unknown); + QTest::newRow("Meta+Ypsilon") << "Meta+Ypsilon" << QKeySequence(Qt::Key_unknown); + + // Garbage + QTest::newRow("4+3=2") << "4+3=2" << QKeySequence(Qt::Key_unknown); QTest::newRow("Alabama") << "Alabama" << QKeySequence(Qt::Key_unknown); QTest::newRow("Simon+G") << "Simon+G" << QKeySequence(Qt::Key_unknown); + QTest::newRow("Shift+++2") << "Shift+++2" << QKeySequence(Qt::Key_unknown); + + // Wrong order + QTest::newRow("A+Meta") << "a+Meta" << QKeySequence(Qt::Key_unknown); + QTest::newRow("Meta+++Shift") << "Meta+++Shift" << QKeySequence(Qt::Key_unknown); + QTest::newRow("Meta+a+Shift") << "Meta+a+Shift" << QKeySequence(Qt::Key_unknown); + + // Only Modifiers - currently not supported + //QTest::newRow("Meta+Shift") << "Meta+Shift" << QKeySequence(Qt::META + Qt::SHIFT); + //QTest::newRow("Ctrl") << "Ctrl" << QKeySequence(Qt::CTRL); + //QTest::newRow("Shift") << "Shift" << QKeySequence(Qt::SHIFT); + + // Only Keys + QTest::newRow("a") << "a" << QKeySequence(Qt::Key_A); + QTest::newRow("A") << "A" << QKeySequence(Qt::Key_A); + + // Incomplete + QTest::newRow("Meta+Shift+") << "Meta+Shift+" << QKeySequence(Qt::Key_unknown); } void tst_QKeySequence::parseString() @@ -608,7 +637,7 @@ void tst_QKeySequence::translated() { QFETCH(QString, transKey); QFETCH(QString, compKey); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC QSKIP("No need to translate modifiers on Mac OS X"); #elif defined(Q_OS_WINCE) QSKIP("No need to translate modifiers on WinCE"); diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp index aca3ffc9cb..d8f1f0640e 100644 --- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp +++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp index ce006eaa99..d2627fe378 100644 --- a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp +++ b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp index 5474c4097d..cc46831965 100644 --- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp +++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp index ab798a7351..475b6ca2a8 100644 --- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp +++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -90,6 +90,11 @@ void tst_QScreen::angleBetween_data() << uint(Qt::InvertedLandscapeOrientation) << uint(Qt::LandscapeOrientation) << 180; + + QTest::newRow("Landscape Primary") + << uint(Qt::LandscapeOrientation) + << uint(Qt::PrimaryOrientation) + << QGuiApplication::primaryScreen()->angleBetween(Qt::LandscapeOrientation, QGuiApplication::primaryScreen()->primaryOrientation()); } void tst_QScreen::angleBetween() @@ -101,8 +106,8 @@ void tst_QScreen::angleBetween() Qt::ScreenOrientation a = Qt::ScreenOrientation(oa); Qt::ScreenOrientation b = Qt::ScreenOrientation(ob); - QCOMPARE(QScreen::angleBetween(a, b), expected); - QCOMPARE(QScreen::angleBetween(b, a), (360 - expected) % 360); + QCOMPARE(QGuiApplication::primaryScreen()->angleBetween(a, b), expected); + QCOMPARE(QGuiApplication::primaryScreen()->angleBetween(b, a), (360 - expected) % 360); } void tst_QScreen::transformBetween_data() @@ -149,6 +154,12 @@ void tst_QScreen::transformBetween_data() << uint(Qt::LandscapeOrientation) << rect << QTransform(-1, 0, 0, -1, rect.width(), rect.height()); + + QTest::newRow("Landscape Primary") + << uint(Qt::LandscapeOrientation) + << uint(Qt::PrimaryOrientation) + << rect + << QGuiApplication::primaryScreen()->transformBetween(Qt::LandscapeOrientation, QGuiApplication::primaryScreen()->primaryOrientation(), rect); } void tst_QScreen::transformBetween() @@ -161,7 +172,7 @@ void tst_QScreen::transformBetween() Qt::ScreenOrientation a = Qt::ScreenOrientation(oa); Qt::ScreenOrientation b = Qt::ScreenOrientation(ob); - QCOMPARE(QScreen::transformBetween(a, b, rect), expected); + QCOMPARE(QGuiApplication::primaryScreen()->transformBetween(a, b, rect), expected); } void tst_QScreen::orientationChange() @@ -169,10 +180,10 @@ void tst_QScreen::orientationChange() QScreen *screen = QGuiApplication::primaryScreen(); QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation); - QTRY_COMPARE(screen->currentOrientation(), Qt::LandscapeOrientation); + QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation); QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::PortraitOrientation); - QTRY_COMPARE(screen->currentOrientation(), Qt::PortraitOrientation); + QTRY_COMPARE(screen->orientation(), Qt::PortraitOrientation); } #include <tst_qscreen.moc> diff --git a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp index 228b73414e..97c749e5ba 100644 --- a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index 95e644987f..391600dd57 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the $MODULE$ of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 77fffef13a..d7c153dca1 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -57,6 +57,8 @@ private slots: void touchToMouseTranslation(); void mouseToTouchTranslation(); void mouseToTouchLoop(); + void orientation(); + void close(); void initTestCase() { touchDevice = new QTouchDevice; @@ -246,10 +248,12 @@ public: keyReleaseCode = event->key(); } void mousePressEvent(QMouseEvent *event) { - if (ignoreMouse) + if (ignoreMouse) { event->ignore(); - else + } else { mousePressButton = event->button(); + mousePressScreenPos = event->screenPos(); + } } void mouseReleaseEvent(QMouseEvent *event) { if (ignoreMouse) @@ -257,6 +261,14 @@ public: else mouseReleaseButton = event->button(); } + void mouseMoveEvent(QMouseEvent *event) { + if (ignoreMouse) { + event->ignore(); + } else { + mouseMoveButton = event->button(); + mouseMoveScreenPos = event->screenPos(); + } + } void touchEvent(QTouchEvent *event) { if (ignoreTouch) { event->ignore(); @@ -285,7 +297,8 @@ public: } int keyPressCode, keyReleaseCode; - int mousePressButton, mouseReleaseButton; + int mousePressButton, mouseReleaseButton, mouseMoveButton; + QPointF mousePressScreenPos, mouseMoveScreenPos; int touchPressedCount, touchReleasedCount; bool ignoreMouse, ignoreTouch; @@ -339,12 +352,25 @@ void tst_QWindow::touchToMouseTranslation() QList<QWindowSystemInterface::TouchPoint> points; QWindowSystemInterface::TouchPoint tp1, tp2; + const QRectF pressArea(101, 102, 4, 4); + const QRectF moveArea(105, 108, 4, 4); tp1.id = 1; tp1.state = Qt::TouchPointPressed; + tp1.area = pressArea; tp2.id = 2; tp2.state = Qt::TouchPointPressed; points << tp1 << tp2; QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points); + // Now an update but with changed list order. The mouse event should still + // be generated from the point with id 1. + tp1.id = 2; + tp1.state = Qt::TouchPointStationary; + tp2.id = 1; + tp2.state = Qt::TouchPointMoved; + tp2.area = moveArea; + points.clear(); + points << tp1 << tp2; + QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points); points[0].state = Qt::TouchPointReleased; points[1].state = Qt::TouchPointReleased; QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points); @@ -352,6 +378,8 @@ void tst_QWindow::touchToMouseTranslation() QTRY_COMPARE(window.mousePressButton, int(Qt::LeftButton)); QTRY_COMPARE(window.mouseReleaseButton, int(Qt::LeftButton)); + QTRY_COMPARE(window.mousePressScreenPos, pressArea.center()); + QTRY_COMPARE(window.mouseMoveScreenPos, moveArea.center()); window.mousePressButton = 0; window.mouseReleaseButton = 0; @@ -455,5 +483,41 @@ void tst_QWindow::mouseToTouchLoop() qApp->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, false); } +void tst_QWindow::orientation() +{ + QWindow window; + window.setGeometry(80, 80, 40, 40); + window.create(); + + window.reportContentOrientationChange(Qt::PortraitOrientation); + QCOMPARE(window.contentOrientation(), Qt::PortraitOrientation); + + window.reportContentOrientationChange(Qt::PrimaryOrientation); + QCOMPARE(window.contentOrientation(), Qt::PrimaryOrientation); + + QVERIFY(!window.requestWindowOrientation(Qt::LandscapeOrientation) || window.windowOrientation() == Qt::LandscapeOrientation); + QVERIFY(!window.requestWindowOrientation(Qt::PortraitOrientation) || window.windowOrientation() == Qt::PortraitOrientation); + QVERIFY(!window.requestWindowOrientation(Qt::PrimaryOrientation) || window.windowOrientation() == Qt::PrimaryOrientation); + + QSignalSpy spy(&window, SIGNAL(contentOrientationChanged(Qt::ScreenOrientation))); + window.reportContentOrientationChange(Qt::LandscapeOrientation); + QCOMPARE(spy.count(), 1); +} + +void tst_QWindow::close() +{ + QWindow a; + QWindow b; + QWindow c(&a); + + a.show(); + b.show(); + + // we can not close a non top level window + QVERIFY(!c.close()); + QVERIFY(a.close()); + QVERIFY(b.close()); +} + #include <tst_qwindow.moc> QTEST_MAIN(tst_QWindow); diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp index 2c006b224e..698470ac60 100644 --- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp index 77bd22a676..1690afcac4 100644 --- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp b/tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp index 1ebad41466..067773074e 100644 --- a/tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp +++ b/tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp index e84cbb5c19..0ff90f69c3 100644 --- a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp +++ b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 00a393562a..94e74a52e6 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp b/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp index 07ec8458af..9e30a85655 100644 --- a/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp +++ b/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro index 716d70c7f5..0209043d20 100644 --- a/tests/auto/gui/painting/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -4,13 +4,7 @@ TARGET = tst_qpainter QT += widgets widgets-private printsupport testlib SOURCES += tst_qpainter.cpp -wince* { - addFiles.files = drawEllipse drawLine_rop_bitmap drawPixmap_rop drawPixmap_rop_bitmap task217400.png - addFiles.path = . - DEPLOYMENT += addFiles - DEFINES += SRCDIR=\\\".\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" -} - mac*:CONFIG+=insignificant_test + +TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \ + task217400.png diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index d6511d4475..553e36a884 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -89,6 +89,7 @@ public: public slots: void init(); void cleanup(); + void cleanupTestCase(); private slots: void getSetCheck(); void drawPixmap_comp_data(); @@ -364,6 +365,13 @@ void tst_QPainter::cleanup() { } +void tst_QPainter::cleanupTestCase() +{ + QFile::remove(QLatin1String("dest.png")); + QFile::remove(QLatin1String("expected.png")); + QFile::remove(QLatin1String("foo.png")); +} + static const char* const maskSource_data[] = { "16 13 6 1", ". c None", @@ -453,7 +461,7 @@ QRgb qt_compose_alpha(QRgb source, QRgb dest) */ void tst_QPainter::drawPixmap_comp() { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC QSKIP("Mac has other ideas about alpha composition"); #endif QFETCH(uint, dest); @@ -1363,7 +1371,7 @@ void tst_QPainter::drawRoundRect() QFETCH(QRect, rect); QFETCH(bool, usePen); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if (QTest::currentDataTag() == QByteArray("rect(6, 12, 3, 14) with pen") || QTest::currentDataTag() == QByteArray("rect(6, 17, 3, 25) with pen") || QTest::currentDataTag() == QByteArray("rect(10, 6, 10, 3) with pen") || @@ -3108,7 +3116,7 @@ void tst_QPainter::drawImage_task217400() { QFETCH(QImage::Format, format); - const QImage src = QImage(QString(SRCDIR) + "/task217400.png") + const QImage src = QImage(QFINDTESTDATA("task217400.png")) .convertToFormat(format); QVERIFY(!src.isNull()); diff --git a/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp b/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp index 4603d9d613..14b1ddbf04 100644 --- a/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp +++ b/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index 5d48113aa8..bcd009dfb4 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -54,7 +54,8 @@ class tst_QPainterPath : public QObject Q_OBJECT public: - +public slots: + void cleanupTestCase(); private slots: void getSetCheck(); void swap(); @@ -115,6 +116,11 @@ private slots: void lineWithinBounds(); }; +void tst_QPainterPath::cleanupTestCase() +{ + QFile::remove(QLatin1String("data")); +} + // Testing get/set functions void tst_QPainterPath::getSetCheck() { diff --git a/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp b/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp index 371a142cc3..0b19615069 100644 --- a/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp +++ b/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qpathclipper/pathcompare.h b/tests/auto/gui/painting/qpathclipper/pathcompare.h index bb4c00222a..0ac33a7940 100644 --- a/tests/auto/gui/painting/qpathclipper/pathcompare.h +++ b/tests/auto/gui/painting/qpathclipper/pathcompare.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qpathclipper/paths.cpp b/tests/auto/gui/painting/qpathclipper/paths.cpp index f4e63a200f..853548ac36 100644 --- a/tests/auto/gui/painting/qpathclipper/paths.cpp +++ b/tests/auto/gui/painting/qpathclipper/paths.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qpathclipper/paths.h b/tests/auto/gui/painting/qpathclipper/paths.h index e270574304..60b32c64d7 100644 --- a/tests/auto/gui/painting/qpathclipper/paths.h +++ b/tests/auto/gui/painting/qpathclipper/paths.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp index 1e6bb20614..5c5ab53bf2 100644 --- a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp +++ b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp index 3da7294e9a..c3411bd981 100644 --- a/tests/auto/gui/painting/qpen/tst_qpen.cpp +++ b/tests/auto/gui/painting/qpen/tst_qpen.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp index 46a8f80f23..5e5f661a09 100644 --- a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp +++ b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp index dd33030d7e..3460ad702b 100644 --- a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp +++ b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -60,6 +60,23 @@ Q_DECLARE_METATYPE(QRect) QT_FORWARD_DECLARE_CLASS(QPrinter) +// Helper class to make sure temp files are cleaned up after test complete +class TempFileCleanup +{ +public: + TempFileCleanup(const QString &file) + : m_file(file) + { + } + + ~TempFileCleanup() + { + QFile::remove(m_file); + } +private: + QString m_file; +}; + class tst_QPrinter : public QObject { Q_OBJECT @@ -288,6 +305,7 @@ void tst_QPrinter::testPageRectAndPaperRect() QPrinter printer(QPrinter::HighResolution); printer.setOrientation(QPrinter::Orientation(orientation)); printer.setOutputFileName("silly"); + TempFileCleanup tmpFile("silly"); QRect pageRect = doPaperRect ? printer.paperRect() : printer.pageRect(); float inchesX = float(pageRect.width()) / float(printer.resolution()); @@ -376,6 +394,7 @@ void tst_QPrinter::testMargins() if (painter) delete painter; + QFile::remove("silly"); } void tst_QPrinter::testNonExistentPrinter() @@ -505,6 +524,7 @@ void tst_QPrinter::outputFormatFromSuffix() QPrinter p; QVERIFY(p.outputFormat() == QPrinter::NativeFormat); p.setOutputFileName("test.pdf"); + TempFileCleanup tmpFile("test.pdf"); QVERIFY(p.outputFormat() == QPrinter::PdfFormat); p.setOutputFileName(QString()); QVERIFY(p.outputFormat() == QPrinter::NativeFormat); @@ -865,6 +885,7 @@ void tst_QPrinter::errorReporting() QCOMPARE(painter.begin(&p), false); // it should check the output file is writable #endif p.setOutputFileName("test.pdf"); + TempFileCleanup tmpFile("test.pdf"); QCOMPARE(painter.begin(&p), true); // it should check the output QCOMPARE(p.isValid(), true); painter.end(); @@ -891,6 +912,7 @@ void tst_QPrinter::printDialogCompleter() { QPrintDialog dialog; dialog.printer()->setOutputFileName("file.pdf"); + TempFileCleanup tmpFile("file.pdf"); dialog.setEnabledOptions(QAbstractPrintDialog::PrintToFile); dialog.show(); @@ -917,6 +939,9 @@ static void printPage(QPainter *painter) void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles() { + TempFileCleanup tmpFile1("out1.ps"); + TempFileCleanup tmpFile2("out2.ps"); + QPrinter printer; { @@ -978,6 +1003,7 @@ void tst_QPrinter::testPdfTitle() painter.begin(&printer); painter.end(); } + TempFileCleanup tmpFile("file.pdf"); QFile file("file.pdf"); QVERIFY(file.open(QIODevice::ReadOnly)); // The we expect the title to appear in the PDF as: diff --git a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp index 6ffdc63e6c..d312469449 100644 --- a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -90,7 +90,7 @@ void tst_QPrinterInfo::macFixNameFormat(QString *printerName) { // Modify the format of the printer name to match Qt, lpstat returns // foo___domain_no, Qt returns foo @ domain.no -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC printerName->replace(QLatin1String("___"), QLatin1String(" @ ")); printerName->replace(QLatin1String("_"), QLatin1String(".")); #else diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp index c9ad8e00ab..863690fd78 100644 --- a/tests/auto/gui/painting/qregion/tst_qregion.cpp +++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp index b4e1b8ffb8..c04948899c 100644 --- a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp +++ b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp index 725c374708..f4cf586da1 100644 --- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp +++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 357b7359e4..e8374b0cae 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -130,6 +130,7 @@ struct SharedResource : public QOpenGLSharedResource void tst_QOpenGL::sharedResourceCleanup() { QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); window.setGeometry(0, 0, 10, 10); window.create(); @@ -152,6 +153,7 @@ void tst_QOpenGL::sharedResourceCleanup() QOpenGLContext *ctx2 = new QOpenGLContext; ctx2->setShareContext(ctx); ctx2->create(); + delete ctx; resource->free(); @@ -191,6 +193,7 @@ void tst_QOpenGL::sharedResourceCleanup() void tst_QOpenGL::multiGroupSharedResourceCleanup() { QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); window.setGeometry(0, 0, 10, 10); window.create(); @@ -212,6 +215,7 @@ void tst_QOpenGL::multiGroupSharedResourceCleanup() void tst_QOpenGL::multiGroupSharedResourceCleanupCustom() { QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); window.setGeometry(0, 0, 10, 10); window.create(); @@ -348,6 +352,7 @@ void qt_opengl_check_test_pattern(const QImage& img) void tst_QOpenGL::fboSimpleRendering() { QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); window.setGeometry(0, 0, 10, 10); window.create(); QOpenGLContext ctx; @@ -391,6 +396,7 @@ void tst_QOpenGL::fboRendering() #endif QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); window.setGeometry(0, 0, 10, 10); window.create(); QOpenGLContext ctx; @@ -430,6 +436,7 @@ void tst_QOpenGL::fboRendering() void tst_QOpenGL::fboHandleNulledAfterContextDestroyed() { QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); window.setGeometry(0, 0, 10, 10); window.create(); @@ -459,6 +466,7 @@ void tst_QOpenGL::openGLPaintDevice() #endif QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); window.setGeometry(0, 0, 128, 128); window.create(); @@ -506,6 +514,7 @@ void tst_QOpenGL::openGLPaintDevice() void tst_QOpenGL::aboutToBeDestroyed() { QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); window.setGeometry(0, 0, 128, 128); window.create(); diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp index d6fff734c0..c609b4a1ed 100644 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp +++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 4f1deec996..7eda35efb8 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index c3d41a27bf..ead4c8e71a 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -613,7 +613,7 @@ void tst_QFont::lastResortFont() void tst_QFont::styleName() { -#if !defined(Q_WS_MAC) +#if !defined(Q_OS_MAC) QSKIP("Only tested on Mac"); #else QFont font("Helvetica Neue"); diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index e7bbfbceff..7a1cc53c57 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -63,7 +63,7 @@ private slots: void fixedPitch_data(); void fixedPitch(); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC void trickyFonts_data(); void trickyFonts(); #endif @@ -132,7 +132,7 @@ void tst_QFontDatabase::fixedPitch_data() QTest::newRow( "Andale Mono" ) << QString( "Andale Mono" ) << true; QTest::newRow( "Courier" ) << QString( "Courier" ) << true; QTest::newRow( "Courier New" ) << QString( "Courier New" ) << true; -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC QTest::newRow( "Script" ) << QString( "Script" ) << false; QTest::newRow( "Lucida Console" ) << QString( "Lucida Console" ) << true; QTest::newRow( "DejaVu Sans" ) << QString( "DejaVu Sans" ) << false; @@ -162,7 +162,7 @@ void tst_QFontDatabase::fixedPitch() QCOMPARE(fi.fixedPitch(), fixedPitch); } -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC void tst_QFontDatabase::trickyFonts_data() { QTest::addColumn<QString>("font"); @@ -247,7 +247,7 @@ void tst_QFontDatabase::addAppFont() #endif QCOMPARE(fontDbChangedSpy.count(), 1); // addApplicationFont is supported on Mac, don't skip the test if it breaks. -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC if (id == -1) QSKIP("Skip the test since app fonts are not supported on this system"); #endif diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp index bc858bf38a..0b5486dd5a 100644 --- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp index a4e5c63e6d..8ef030ae60 100644 --- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index a0cda39c27..99e53f3261 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -98,9 +98,7 @@ private slots: void rawFontSetPixelSize_data(); void rawFontSetPixelSize(); -#if defined(Q_WS_X11) || defined(Q_WS_MAC) void multipleRawFontsFromData(); -#endif private: QString testFont; QString testFontBoldItalic; @@ -867,7 +865,6 @@ void tst_QRawFont::rawFontSetPixelSize() QCOMPARE(rawFont.pixelSize(), 24.0); } -#if defined(Q_WS_X11) || defined(Q_WS_MAC) void tst_QRawFont::multipleRawFontsFromData() { QFile file(testFont); @@ -884,7 +881,6 @@ void tst_QRawFont::multipleRawFontsFromData() QVERIFY(testFont.familyName() != (testFontBoldItalic.familyName()) || testFont.styleName() != (testFontBoldItalic.styleName())); } -#endif #endif // QT_NO_RAWFONT diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index b0a66eab07..66145f2dcf 100644 --- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp index 0358b5d471..5774be6830 100644 --- a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp +++ b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp index 9489a2e90e..74ec9db6de 100644 --- a/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp +++ b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp index 09b9a06a1d..bff014e424 100644 --- a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -50,6 +50,7 @@ #include <qabstracttextdocumentlayout.h> #include <qtextlayout.h> #include <qtextcursor.h> +#include <qtextobject.h> #include <qdebug.h> QT_FORWARD_DECLARE_CLASS(QTextDocument) @@ -152,6 +153,8 @@ private slots: void cursorPositionWithBlockUndoAndRedo2(); void cursorPositionWithBlockUndoAndRedo3(); + void joinNonEmptyRemovedBlockUserState(); + private: int blockCount(); @@ -1976,5 +1979,20 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo3() QCOMPARE(cursor.position(), cursorPositionBefore); } +void tst_QTextCursor::joinNonEmptyRemovedBlockUserState() +{ + cursor.insertText("Hello"); + cursor.insertBlock(); + cursor.insertText("World"); + cursor.block().setUserState(10); + + cursor.movePosition(QTextCursor::EndOfBlock); + cursor.movePosition(QTextCursor::PreviousBlock, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); + cursor.removeSelectedText(); + + QCOMPARE(cursor.block().userState(), 10); +} + QTEST_MAIN(tst_QTextCursor) #include "tst_qtextcursor.moc" diff --git a/tests/auto/gui/text/qtextdocument/common.h b/tests/auto/gui/text/qtextdocument/common.h index 081c71ea13..0841d7cd6a 100644 --- a/tests/auto/gui/text/qtextdocument/common.h +++ b/tests/auto/gui/text/qtextdocument/common.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index a84024ceab..c2ae853a92 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -76,6 +76,7 @@ public: public slots: void init(); void cleanup(); + void cleanupTestCase(); private slots: void getSetCheck(); void isEmpty(); @@ -231,7 +232,6 @@ tst_QTextDocument::tst_QTextDocument() tst_QTextDocument::~tst_QTextDocument() { - QFile::remove(QLatin1String("foo.png")); } void tst_QTextDocument::init() @@ -258,6 +258,11 @@ void tst_QTextDocument::cleanup() doc = 0; } +void tst_QTextDocument::cleanupTestCase() +{ + QFile::remove(QLatin1String("foo.png")); +} + void tst_QTextDocument::isEmpty() { QVERIFY(doc->isEmpty()); diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 63a67a0c10..33293400c2 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp index 91da86d3d1..20b72ffa1b 100644 --- a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp +++ b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -60,6 +60,7 @@ public: public slots: void init(); void cleanup(); + void cleanupTestCase(); private slots: void defaultPageSizeHandling(); @@ -85,6 +86,14 @@ void tst_QTextDocumentLayout::cleanup() doc = 0; } +void tst_QTextDocumentLayout::cleanupTestCase() +{ + if (qgetenv("QTEST_KEEP_IMAGEDATA").toInt() == 0) { + QFile::remove(QLatin1String("expected.png")); + QFile::remove(QLatin1String("img.png")); + } +} + void tst_QTextDocumentLayout::defaultPageSizeHandling() { QAbstractTextDocumentLayout *layout = doc->documentLayout(); diff --git a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp index 166b5d7c82..84539b86cc 100644 --- a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp +++ b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index e816b04153..e7435743e5 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -300,7 +300,7 @@ void tst_QTextLayout::simpleBoundingRect() void tst_QTextLayout::threeLineBoundingRect() { -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); #endif /* stricter check. break text into three lines */ @@ -419,7 +419,7 @@ void tst_QTextLayout::forcedBreaks() void tst_QTextLayout::breakAny() { -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); #endif QString text = "ABCD"; @@ -461,7 +461,7 @@ void tst_QTextLayout::breakAny() void tst_QTextLayout::noWrap() { -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); #endif QString text = "AB CD"; @@ -605,7 +605,7 @@ void tst_QTextLayout::charWordStopOnLineSeparator() void tst_QTextLayout::xToCursorAtEndOfLine() { -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); #endif QString text = "FirstLine SecondLine"; @@ -667,7 +667,7 @@ void tst_QTextLayout::charStopForSurrogatePairs() void tst_QTextLayout::tabStops() { -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); #endif QString txt("Hello there\tworld"); @@ -1461,7 +1461,7 @@ void tst_QTextLayout::textWidthWithLineSeparator() void tst_QTextLayout::cursorInLigatureWithMultipleLines() { -#if !defined(Q_WS_MAC) +#if !defined(Q_OS_MAC) QSKIP("This test can only be run on Mac"); #endif QTextLayout layout("first line finish", QFont("Times", 20)); @@ -1477,7 +1477,7 @@ void tst_QTextLayout::cursorInLigatureWithMultipleLines() void tst_QTextLayout::xToCursorForLigatures() { -#if !defined(Q_WS_MAC) +#if !defined(Q_OS_MAC) QSKIP("This test can only be run on Mac"); #endif QTextLayout layout("fi", QFont("Times", 20)); @@ -1501,7 +1501,7 @@ void tst_QTextLayout::xToCursorForLigatures() void tst_QTextLayout::cursorInNonStopChars() { -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) QSKIP("This test can not be run on Mac"); #endif QTextLayout layout(QString::fromUtf8("\xE0\xA4\xA4\xE0\xA5\x8D\xE0\xA4\xA8")); diff --git a/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp b/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp index 810c416875..79d3d8454b 100644 --- a/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp +++ b/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextobject/tst_qtextobject.cpp b/tests/auto/gui/text/qtextobject/tst_qtextobject.cpp index b621763cea..7b6f155d7a 100644 --- a/tests/auto/gui/text/qtextobject/tst_qtextobject.cpp +++ b/tests/auto/gui/text/qtextobject/tst_qtextobject.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp index 49d86a2c4b..67be46dff4 100644 --- a/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp +++ b/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp index b74bc3daf8..6fb376c72e 100644 --- a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp +++ b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextscriptengine/generate/main.cpp b/tests/auto/gui/text/qtextscriptengine/generate/main.cpp index 5bb13232ca..974a15450a 100644 --- a/tests/auto/gui/text/qtextscriptengine/generate/main.cpp +++ b/tests/auto/gui/text/qtextscriptengine/generate/main.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp index 638f13aea2..cf02d1af50 100644 --- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -56,7 +56,7 @@ -#if defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) || defined(Q_OS_MAC) #define private public #include <private/qtextengine_p.h> #include <qtextlayout.h> @@ -103,6 +103,8 @@ private slots: void mirroredChars_data(); void mirroredChars(); + void thaiIsolatedSaraAm(); + private: bool haveTestFonts; }; @@ -1161,7 +1163,7 @@ void tst_QTextScriptEngine::controlInSyllable_qtbug14204() void tst_QTextScriptEngine::combiningMarks_qtbug15675() { -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) QString s; s.append(QChar(0x0061)); s.append(QChar(0x0062)); @@ -1211,7 +1213,7 @@ void tst_QTextScriptEngine::mirroredChars_data() void tst_QTextScriptEngine::mirroredChars() { -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) QSKIP("Not supported on Mac"); #endif QFETCH(int, hintingPreference); @@ -1256,5 +1258,27 @@ void tst_QTextScriptEngine::mirroredChars() } } +void tst_QTextScriptEngine::thaiIsolatedSaraAm() +{ + if (QFontDatabase().families(QFontDatabase::Any).contains("Waree")) { + QString s; + s.append(QChar(0x0e33)); + + QTextLayout layout(s, QFont("Waree")); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + + QTextEngine *e = layout.engine(); + e->itemize(); + e->shape(0); + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(3)); + + unsigned short *logClusters = e->layoutData->logClustersPtr; + QCOMPARE(logClusters[0], ushort(0)); + } else + QSKIP("Cannot find Waree."); +} + QTEST_MAIN(tst_QTextScriptEngine) #include "tst_qtextscriptengine.moc" diff --git a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp index b4ecdf1f39..137b44a39a 100644 --- a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp +++ b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/text/qzip/tst_qzip.cpp b/tests/auto/gui/text/qzip/tst_qzip.cpp index d68cb2e2dc..eef517d15a 100644 --- a/tests/auto/gui/text/qzip/tst_qzip.cpp +++ b/tests/auto/gui/text/qzip/tst_qzip.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp index cfaafb37f4..ad45d00520 100644 --- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp +++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ |