diff options
author | Liang Qi <liang.qi@qt.io> | 2017-07-06 13:52:42 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-07-06 13:54:25 +0200 |
commit | 7f269a5db8b88fbb14ee741f78e726b1a46c7d4d (patch) | |
tree | fa63387e6f70187e656dd9e6c4f1cd1b1f96c263 /tests | |
parent | 9ca3443a37284bedaf74475c26af173b00757178 (diff) | |
parent | 03b4838cb51513bd5d2edf76dccc4bc4a1181681 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
.qmake.conf
Change-Id: I43531e087bb810889d5c1fbfcdffb29b78804839
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 1 | ||||
-rw-r--r-- | tests/auto/corelib/io/qfileinfo/qfileinfo.pro | 2 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 67 | ||||
-rw-r--r-- | tests/auto/gui/image/qimagereader/tst_qimagereader.cpp | 3 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qwindow/BLACKLIST | 3 | ||||
-rw-r--r-- | tests/auto/network/ssl/qssldiffiehellmanparameters/qssldiffiehellmanparameters.pro | 2 | ||||
-rw-r--r-- | tests/auto/other/macgui/BLACKLIST | 3 | ||||
-rw-r--r-- | tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 59 | ||||
-rw-r--r-- | tests/auto/printsupport/printsupport.pro | 2 | ||||
-rw-r--r-- | tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro | 10 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qtoolbutton/BLACKLIST | 2 |
11 files changed, 105 insertions, 49 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index f4ab0d8464..0f8129cb74 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -21,7 +21,6 @@ installed_cmake.depends = cmake uikit: SUBDIRS = corelib gui -wince: SUBDIRS -= printsupport cross_compile: SUBDIRS -= tools cmake installed_cmake else:!qtConfig(process): SUBDIRS -= tools !qtHaveModule(opengl): SUBDIRS -= opengl diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro index 48673b20a9..496729f9f1 100644 --- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro @@ -5,4 +5,4 @@ SOURCES = tst_qfileinfo.cpp RESOURCES += qfileinfo.qrc \ testdata.qrc -win32:!wince:!winrt:LIBS += -ladvapi32 -lnetapi32 +win32:!winrt: LIBS += -ladvapi32 -lnetapi32 diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index a08d600d8c..661074ac16 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -923,6 +923,18 @@ void tst_QLocale::strtod_data() QTest::addColumn<int>("processed"); QTest::addColumn<bool>("ok"); + // plain numbers, success + QTest::newRow("0") << QString("0") << 0.0 << 1 << true; + QTest::newRow("0.") << QString("0.") << 0.0 << 2 << true; + QTest::newRow("0.0") << QString("0.0") << 0.0 << 3 << true; + QTest::newRow("0e+0") << QString("0e+0") << 0.0 << 4 << true; + QTest::newRow("0e-0") << QString("0e-0") << 0.0 << 4 << true; + QTest::newRow("0e+1") << QString("0e+1") << 0.0 << 4 << true; + QTest::newRow("0e-1") << QString("0e-1") << 0.0 << 4 << true; + QTest::newRow("0E+0") << QString("0E+0") << 0.0 << 4 << true; + QTest::newRow("0E-0") << QString("0E-0") << 0.0 << 4 << true; + QTest::newRow("0E+1") << QString("0E+1") << 0.0 << 4 << true; + QTest::newRow("0E-1") << QString("0E-1") << 0.0 << 4 << true; QTest::newRow("3.4") << QString("3.4") << 3.4 << 3 << true; QTest::newRow("0.035003945") << QString("0.035003945") << 0.035003945 << 11 << true; QTest::newRow("3.5003945e-2") << QString("3.5003945e-2") << 0.035003945 << 12 << true; @@ -931,6 +943,10 @@ void tst_QLocale::strtod_data() QTest::newRow("12456789012") << QString("12456789012") << 12456789012.0 << 11 << true; QTest::newRow("1.2456789012e10") << QString("1.2456789012e10") << 12456789012.0 << 15 << true; + // starts with junk, fails + QTest::newRow("a0") << QString("a0") << 0.0 << 0 << false; + QTest::newRow("a0.") << QString("a0.") << 0.0 << 0 << false; + QTest::newRow("a0.0") << QString("a0.0") << 0.0 << 0 << false; QTest::newRow("a3.4") << QString("a3.4") << 0.0 << 0 << false; QTest::newRow("b0.035003945") << QString("b0.035003945") << 0.0 << 0 << false; QTest::newRow("c3.5003945e-2") << QString("c3.5003945e-2") << 0.0 << 0 << false; @@ -939,7 +955,18 @@ void tst_QLocale::strtod_data() QTest::newRow("f12456789012") << QString("f12456789012") << 0.0 << 0 << false; QTest::newRow("g1.2456789012e10") << QString("g1.2456789012e10") << 0.0 << 0 << false; - QTest::newRow("3.4a") << QString("3.4a") << 3.4 << 3 << true; + // ends with junk, success + QTest::newRow("0a") << QString("0a") << 0.0 << 1 << true; + QTest::newRow("0.a") << QString("0.a") << 0.0 << 2 << true; + QTest::newRow("0.0a") << QString("0.0a") << 0.0 << 3 << true; + QTest::newRow("0e+0a") << QString("0e+0a") << 0.0 << 4 << true; + QTest::newRow("0e-0a") << QString("0e-0a") << 0.0 << 4 << true; + QTest::newRow("0e+1a") << QString("0e+1a") << 0.0 << 4 << true; + QTest::newRow("0e-1a") << QString("0e-1a") << 0.0 << 4 << true; + QTest::newRow("0E+0a") << QString("0E+0a") << 0.0 << 4 << true; + QTest::newRow("0E-0a") << QString("0E-0a") << 0.0 << 4 << true; + QTest::newRow("0E+1a") << QString("0E+1a") << 0.0 << 4 << true; + QTest::newRow("0E-1a") << QString("0E-1a") << 0.0 << 4 << true; QTest::newRow("0.035003945b") << QString("0.035003945b") << 0.035003945 << 11 << true; QTest::newRow("3.5003945e-2c") << QString("3.5003945e-2c") << 0.035003945 << 12 << true; QTest::newRow("0.000003945d") << QString("0.000003945d") << 0.000003945 << 11 << true; @@ -947,6 +974,10 @@ void tst_QLocale::strtod_data() QTest::newRow("12456789012f") << QString("12456789012f") << 12456789012.0 << 11 << true; QTest::newRow("1.2456789012e10g") << QString("1.2456789012e10g") << 12456789012.0 << 15 << true; + // "0x" prefix, success but only for the "0" before "x" + QTest::newRow("0x0") << QString("0x0") << 0.0 << 1 << true; + QTest::newRow("0x0.") << QString("0x0.") << 0.0 << 1 << true; + QTest::newRow("0x0.0") << QString("0x0.0") << 0.0 << 1 << true; QTest::newRow("0x3.4") << QString("0x3.4") << 0.0 << 1 << true; QTest::newRow("0x0.035003945") << QString("0x0.035003945") << 0.0 << 1 << true; QTest::newRow("0x3.5003945e-2") << QString("0x3.5003945e-2") << 0.0 << 1 << true; @@ -954,6 +985,9 @@ void tst_QLocale::strtod_data() QTest::newRow("0x3.945e-6") << QString("0x3.945e-6") << 0.0 << 1 << true; QTest::newRow("0x12456789012") << QString("0x12456789012") << 0.0 << 1 << true; QTest::newRow("0x1.2456789012e10") << QString("0x1.2456789012e10") << 0.0 << 1 << true; + + // hexfloat is not supported (yet) + QTest::newRow("0x1.921fb5p+1") << QString("0x1.921fb5p+1") << 0.0 << 1 << true; } void tst_QLocale::strtod() @@ -971,6 +1005,28 @@ void tst_QLocale::strtod() QCOMPARE(result, num); QCOMPARE(actualOk, ok); QCOMPARE(static_cast<int>(end - numData.constData()), processed); + + // make sure neither QByteArray, QString or QLocale also work + // (but they don't support incomplete parsing) + if (processed == num_str.size() || processed == 0) { + actualOk = false; + QCOMPARE(num_str.toDouble(&actualOk), num); + QCOMPARE(actualOk, ok); + + actualOk = false; + QCOMPARE(numData.toDouble(&actualOk), num); + QCOMPARE(actualOk, ok); + + actualOk = false; + QCOMPARE(QLocale::c().toDouble(num_str, &actualOk), num); + QCOMPARE(actualOk, ok); + } + + // and QStringRef, but we can limit the length without allocating memory + QStringRef num_strref(&num_str, 0, processed); + actualOk = false; + QCOMPARE(QLocale::c().toDouble(num_strref, &actualOk), num); + QCOMPARE(actualOk, ok); } void tst_QLocale::long_long_conversion_data() @@ -1593,10 +1649,9 @@ void tst_QLocale::macDefaultLocale() // make sure we are using the system to parse them QCOMPARE(locale.toString(1234.56), systemLocaleFormatNumber(QString("1,234.56"))); - QTime currentTime = QTime::currentTime(); - QTime utcTime = QDateTime::currentDateTime().toUTC().time(); - - int diff = currentTime.hour() - utcTime.hour(); + QTime testTime = QTime(1, 2, 3); + QTime utcTime = QDateTime(QDate::currentDate(), testTime).toUTC().time(); + int diff = testTime.hour() - utcTime.hour(); // Check if local time and utc time are on opposite sides of the 24-hour wrap-around. if (diff < -12) @@ -1604,7 +1659,7 @@ void tst_QLocale::macDefaultLocale() if (diff > 12) diff -= 24; - const QString timeString = locale.toString(QTime(1,2,3), QLocale::LongFormat); + const QString timeString = locale.toString(testTime, QLocale::LongFormat); QVERIFY(timeString.contains(QString("1:02:03"))); // To run this test make sure "Curreny" is US Dollar in System Preferences->Language & Region->Advanced. diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 574ad805ca..a908e06498 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -519,7 +519,7 @@ void tst_QImageReader::imageFormat_data() QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm") << QImage::Format_Indexed8; QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp") << QImage::Format_Indexed8; QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp") << QImage::Format_Indexed8; - QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp") << QImage::Format_RGB32; + QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp") << QImage::Format_ARGB32; 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; @@ -736,7 +736,6 @@ void tst_QImageReader::imageFormatBeforeRead() QSize size = reader.size(); QImage image(size, fileFormat); QVERIFY(reader.read(&image)); - QEXPECT_FAIL("bmp-3", "Semi-transparent BMPs not predicted", Continue); QCOMPARE(image.format(), fileFormat); } } diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index 19d9262bca..1443359377 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -1,6 +1,9 @@ [positioning:default] ubuntu-14.04 ubuntu-16.04 +osx-10.12 ci +[positioning:fake] +osx-10.12 ci [modalWindowPosition] ubuntu-14.04 ubuntu-16.04 diff --git a/tests/auto/network/ssl/qssldiffiehellmanparameters/qssldiffiehellmanparameters.pro b/tests/auto/network/ssl/qssldiffiehellmanparameters/qssldiffiehellmanparameters.pro index b8053f9eb3..dee95886e0 100644 --- a/tests/auto/network/ssl/qssldiffiehellmanparameters/qssldiffiehellmanparameters.pro +++ b/tests/auto/network/ssl/qssldiffiehellmanparameters/qssldiffiehellmanparameters.pro @@ -2,7 +2,7 @@ CONFIG += testcase CONFIG += parallel_test SOURCES += tst_qssldiffiehellmanparameters.cpp -!wince*:win32:LIBS += -lws2_32 +win32: LIBS += -lws2_32 QT = core network testlib TARGET = tst_qssldiffiehellmanparameters diff --git a/tests/auto/other/macgui/BLACKLIST b/tests/auto/other/macgui/BLACKLIST index 2b4bcafe80..2b6a0e2fe8 100644 --- a/tests/auto/other/macgui/BLACKLIST +++ b/tests/auto/other/macgui/BLACKLIST @@ -1,2 +1,3 @@ [nonModalOrder] -osx-10.11 +osx-10.11 ci +osx-10.12 ci diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 3a6102f2fa..16bb0b7c3e 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -39,6 +39,7 @@ #include <qpainter.h> #include <qprintengine.h> #include <qpagelayout.h> +#include <qtemporarydir.h> #include <math.h> @@ -70,12 +71,9 @@ class tst_QPrinter : public QObject { Q_OBJECT -public slots: -#ifdef QT_NO_PRINTER - void initTestCase(); - void cleanupTestCase(); -#else private slots: + void initTestCase(); +#if QT_CONFIG(printer) void testPageRectAndPaperRect(); void testPageRectAndPaperRect_data(); void testSetOptions(); @@ -134,19 +132,19 @@ private slots: void testPageMetrics_data(); void testPageMetrics(); #endif +private: + QTemporaryDir m_tempDir; }; -#ifdef QT_NO_PRINTER void tst_QPrinter::initTestCase() { +#if !QT_CONFIG(printer) QSKIP("This test requires printing support"); +#endif + QVERIFY2(m_tempDir.isValid(), qPrintable(m_tempDir.errorString())); } -void tst_QPrinter::cleanupTestCase() -{ - QSKIP("This test requires printing support"); -} -#else +#if QT_CONFIG(printer) #define MYCOMPARE(a, b) QCOMPARE(QVariant((int)a), QVariant((int)b)) @@ -248,8 +246,9 @@ void tst_QPrinter::testPageRectAndPaperRect() QPainter *painter = 0; QPrinter printer(QPrinter::HighResolution); printer.setOrientation(QPrinter::Orientation(orientation)); - printer.setOutputFileName("silly"); - TempFileCleanup tmpFile("silly"); + const QString fileName = m_tempDir.path() + QLatin1String("/silly"); + printer.setOutputFileName(fileName); + TempFileCleanup tmpFile(fileName); QRect pageRect = doPaperRect ? printer.paperRect() : printer.pageRect(); float inchesX = float(pageRect.width()) / float(printer.resolution()); @@ -421,8 +420,9 @@ void tst_QPrinter::outputFormatFromSuffix() QSKIP("No printers available."); QPrinter p; QCOMPARE(p.outputFormat(), QPrinter::NativeFormat); - p.setOutputFileName("test.pdf"); - TempFileCleanup tmpFile("test.pdf"); + const QString fileName = m_tempDir.path() + QLatin1String("/test.pdf"); + p.setOutputFileName(fileName); + TempFileCleanup tmpFile(fileName); QCOMPARE(p.outputFormat(), QPrinter::PdfFormat); p.setOutputFileName(QString()); QCOMPARE(p.outputFormat(), QPrinter::NativeFormat); @@ -510,8 +510,9 @@ void tst_QPrinter::errorReporting() p.setOutputFileName("/foobar/nonwritable.pdf"); QCOMPARE(painter.begin(&p), false); // it should check the output file is writable #endif - p.setOutputFileName("test.pdf"); - TempFileCleanup tmpFile("test.pdf"); + const QString fileName = m_tempDir.path() + QLatin1String("/test.pdf"); + p.setOutputFileName(fileName); + TempFileCleanup tmpFile(fileName); QCOMPARE(painter.begin(&p), true); // it should check the output QCOMPARE(p.isValid(), true); painter.end(); @@ -626,28 +627,30 @@ static void printPage(QPainter *painter) void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles() { - TempFileCleanup tmpFile1("out1.pdf"); - TempFileCleanup tmpFile2("out2.pdf"); + const QString fileName1 = m_tempDir.path() + QLatin1String("/out1.pdf"); + const QString fileName2 = m_tempDir.path() + QLatin1String("/out2.pdf"); + TempFileCleanup tmpFile1(fileName1); + TempFileCleanup tmpFile2(fileName2); QPrinter printer; { - printer.setOutputFileName("out1.pdf"); + printer.setOutputFileName(fileName1); QPainter painter(&printer); printPage(&painter); } { - printer.setOutputFileName("out2.pdf"); + printer.setOutputFileName(fileName2); QPainter painter(&printer); printPage(&painter); } - QFile file1("out1.pdf"); + QFile file1(fileName1); QVERIFY(file1.open(QIODevice::ReadOnly)); - QFile file2("out2.pdf"); + QFile file2(fileName2); QVERIFY(file2.open(QIODevice::ReadOnly)); while (!file1.atEnd() && !file2.atEnd()) { @@ -686,6 +689,8 @@ void tst_QPrinter::testCurrentPage() void tst_QPrinter::testPdfTitle() { + const QString fileName = m_tempDir.path() + QLatin1String("/file.pdf"); + // Check the document name is represented correctly in produced pdf { QPainter painter; @@ -693,13 +698,13 @@ void tst_QPrinter::testPdfTitle() // This string is just the UTF-8 encoding of the string: \()f ø hiragana o const unsigned char titleBuf[]={0x5c, 0x28, 0x29, 0x66, 0xc3, 0xb8, 0xe3, 0x81, 0x8a, 0x00}; const char *title = reinterpret_cast<const char*>(titleBuf); - printer.setOutputFileName("file.pdf"); + printer.setOutputFileName(fileName); printer.setDocName(QString::fromUtf8(title)); painter.begin(&printer); painter.end(); } - TempFileCleanup tmpFile("file.pdf"); - QFile file("file.pdf"); + TempFileCleanup tmpFile(fileName); + QFile file(fileName); QVERIFY(file.open(QIODevice::ReadOnly)); // The we expect the title to appear in the PDF as: // ASCII('\title (') UTF16(\\\(\)f ø hiragana o) ASCII(')'). @@ -1955,7 +1960,7 @@ void tst_QPrinter::testPageMetrics() QCOMPARE(printer.pageRect(QPrinter::Millimeter), QRectF(leftMMf, topMMf, heightMMf - leftMMf - rightMMf, widthMMf - topMMf - bottomMMf)); } -#endif // QT_NO_PRINTER +#endif // QT_CONFIG(printer) QTEST_MAIN(tst_QPrinter) #include "tst_qprinter.moc" diff --git a/tests/auto/printsupport/printsupport.pro b/tests/auto/printsupport/printsupport.pro index 062f46980a..647e48b120 100644 --- a/tests/auto/printsupport/printsupport.pro +++ b/tests/auto/printsupport/printsupport.pro @@ -1,4 +1,6 @@ TEMPLATE=subdirs +QT_FOR_CONFIG += printsupport +requires(qtConfig(printer)) SUBDIRS=\ dialogs \ kernel \ diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index 61939983e6..3527b424c1 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -6,16 +6,6 @@ SOURCES += tst_qdirmodel.cpp INCLUDEPATH += ../../../../shared/ HEADERS += ../../../../shared/emulationdetector.h -wince* { - addit.files = dirtest\\test1\\* - addit.path = dirtest\\test1 - tests.files = test\\* - tests.path = test - sourceFile.files = tst_qdirmodel.cpp - sourceFile.path = . - DEPLOYMENT += addit tests sourceFile -} - android { DEFINES += SRCDIR=\\\"./\\\" } else { diff --git a/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST b/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST new file mode 100644 index 0000000000..df4fda196f --- /dev/null +++ b/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST @@ -0,0 +1,2 @@ +[task176137_autoRepeatOfAction] +osx ci |