diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 30 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 18 | ||||
-rw-r--r-- | tests/auto/mediaobject/dummy/dummy.pro | 2 | ||||
-rw-r--r-- | tests/auto/qdir/tst_qdir.cpp | 20 | ||||
-rwxr-xr-x | tests/auto/qimagereader/images/txts.png | bin | 0 -> 5413 bytes | |||
-rw-r--r-- | tests/auto/qimagereader/qimagereader.qrc | 1 | ||||
-rw-r--r-- | tests/auto/qimagereader/tst_qimagereader.cpp | 28 | ||||
-rw-r--r-- | tests/auto/qlocale/tst_qlocale.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 15 | ||||
-rw-r--r-- | tests/auto/qscriptv8testsuite/abstracttestsuite.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qscriptv8testsuite/skip.txt | 14 | ||||
-rw-r--r-- | tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp | 85 | ||||
-rw-r--r-- | tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 48 |
14 files changed, 222 insertions, 63 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml b/tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml new file mode 100644 index 0000000..31bf69d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml @@ -0,0 +1,6 @@ +import QtQuick 1.0 +import Qt.test 1.0 + +QtObject { + function writeValue2() { MyQmlObject.value2 = 9 } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 40b0e1b..48466d5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -639,15 +639,29 @@ void tst_qdeclarativeecmascript::overrideExtensionProperties() void tst_qdeclarativeecmascript::attachedProperties() { - QDeclarativeComponent component(&engine, TEST_FILE("attachedProperty.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("a").toInt(), 19); - QCOMPARE(object->property("b").toInt(), 19); - QCOMPARE(object->property("c").toInt(), 19); - QCOMPARE(object->property("d").toInt(), 19); + { + QDeclarativeComponent component(&engine, TEST_FILE("attachedProperty.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("a").toInt(), 19); + QCOMPARE(object->property("b").toInt(), 19); + QCOMPARE(object->property("c").toInt(), 19); + QCOMPARE(object->property("d").toInt(), 19); + } - // ### Need to test attached property assignment + { + QDeclarativeComponent component(&engine, TEST_FILE("writeAttachedProperty.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QMetaObject::invokeMethod(object, "writeValue2"); + + MyQmlAttachedObject *attached = + qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object)); + QVERIFY(attached != 0); + + QCOMPARE(attached->value2(), 9); + } } void tst_qdeclarativeecmascript::enums() diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 8841aa3..3d6641b 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -658,6 +658,24 @@ void tst_qdeclarativetext::verticalAlignment() } } + //confirm that bounding rect is correctly positioned. + QString componentStr = "import QtQuick 1.0\nText { height: 80; text: \"Hello\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + QVERIFY(textObject != 0); + QRectF br = textObject->boundingRect(); + QVERIFY(br.y() == 0); + + textObject->setVAlign(QDeclarativeText::AlignVCenter); + br = textObject->boundingRect(); + QCOMPARE(qFloor(br.y()), qFloor((80.0 - br.height())/2)); + + textObject->setVAlign(QDeclarativeText::AlignBottom); + br = textObject->boundingRect(); + QCOMPARE(qFloor(br.y()), qFloor(80.0 - br.height())); + + delete textObject; } void tst_qdeclarativetext::font() diff --git a/tests/auto/mediaobject/dummy/dummy.pro b/tests/auto/mediaobject/dummy/dummy.pro index c81411c..9797500 100644 --- a/tests/auto/mediaobject/dummy/dummy.pro +++ b/tests/auto/mediaobject/dummy/dummy.pro @@ -1,7 +1,7 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.7.3 + VERSION=4.7.4 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index 2fa0c24..04f7fa9 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -420,6 +420,9 @@ void tst_QDir::isRelativePath_data() #endif QTest::newRow("data2") << "somedir" << true; QTest::newRow("data3") << "/somedir" << false; + + QTest::newRow("resource0") << ":/prefix" << false; + QTest::newRow("resource1") << ":/prefix/foo.bar" << false; } void tst_QDir::isRelativePath() @@ -868,6 +871,8 @@ void tst_QDir::canonicalPath_data() QTest::newRow("drive:\\..\\..") << QDir::toNativeSeparators(QDir::rootPath().append("../..")) << QDir::rootPath(); QTest::newRow("drive:") << QDir().canonicalPath().left(2) << QDir().canonicalPath(); #endif + + QTest::newRow("resource") << ":/tst_qdir/resources/entryList" << ":/tst_qdir/resources/entryList"; } void tst_QDir::canonicalPath() @@ -1061,6 +1066,9 @@ tst_QDir::cleanPath_data() QTest::newRow("data10") << "/:/" << "/:"; #endif #endif + + QTest::newRow("resource0") << ":/prefix/foo.bar" << ":/prefix/foo.bar"; + QTest::newRow("resource1") << "://prefix/..//prefix/foo.bar" << ":/prefix/foo.bar"; } @@ -1084,6 +1092,7 @@ void tst_QDir::absoluteFilePath_data() QTest::newRow("2") << "/" << "passwd" << "/passwd"; QTest::newRow("3") << "relative" << "path" << QDir::currentPath() + "/relative/path"; QTest::newRow("4") << "" << "" << QDir::currentPath(); + QTest::newRow("resource") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar"; } void tst_QDir::absoluteFilePath() @@ -1112,6 +1121,7 @@ void tst_QDir::absolutePath_data() QTest::newRow("4") << "c:/machine/share/dir1" << "c:/machine/share/dir1"; QTest::newRow("5") << "c:\\machine\\share\\dir1" << "c:/machine/share/dir1"; #endif + QTest::newRow("resource") << ":/prefix/foo.bar" << ":/prefix/foo.bar"; } void tst_QDir::absolutePath() @@ -1171,6 +1181,9 @@ void tst_QDir::relativeFilePath_data() QTest::newRow("33") << "//anotherHost/foo" << "C:/foo/bar" << "C:/foo/bar"; # endif #endif + + QTest::newRow("resource0") << ":/prefix" << "foo.bar" << "foo.bar"; + QTest::newRow("resource1") << ":/prefix" << ":/prefix/foo.bar" << "foo.bar"; } void tst_QDir::relativeFilePath() @@ -1193,6 +1206,7 @@ void tst_QDir::filePath_data() QTest::newRow("2") << "/" << "passwd" << "/passwd"; QTest::newRow("3") << "relative" << "path" << "relative/path"; QTest::newRow("4") << "" << "" << "."; + QTest::newRow("resource") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar"; } void tst_QDir::filePath() @@ -1255,6 +1269,8 @@ void tst_QDir::exists2_data() QTest::newRow("4") << "/testData" << false; QTest::newRow("5") << "tst_qdir.cpp" << true; QTest::newRow("6") << "/resources.cpp" << false; + QTest::newRow("resource0") << ":/prefix/foo.bar" << false; + QTest::newRow("resource1") << ":/tst_qdir/resources/entryList/file1.data" << true; } void tst_QDir::exists2() @@ -1291,6 +1307,8 @@ void tst_QDir::dirName_data() QTest::newRow("bslash1") << "\\winnt\\system32" << "system32"; QTest::newRow("bslash2") << "c:\\winnt\\system32\\kernel32.dll" << "kernel32.dll"; #endif + + QTest::newRow("resource") << ":/prefix" << "prefix"; } void tst_QDir::dirName() @@ -1961,6 +1979,8 @@ void tst_QDir::isRelative_data() foreach (QFileInfo root, QDir::drives()) { QTest::newRow(root.absolutePath().toLocal8Bit()) << root.absolutePath() << false; } + + QTest::newRow("resource") << ":/prefix" << false; } void tst_QDir::isRelative() diff --git a/tests/auto/qimagereader/images/txts.png b/tests/auto/qimagereader/images/txts.png Binary files differnew file mode 100755 index 0000000..99be1eb --- /dev/null +++ b/tests/auto/qimagereader/images/txts.png diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc index 5536b38..632b73a 100644 --- a/tests/auto/qimagereader/qimagereader.qrc +++ b/tests/auto/qimagereader/qimagereader.qrc @@ -64,5 +64,6 @@ <file>images/corrupt.svg</file> <file>images/corrupt.svgz</file> <file>images/qtbug13653-no_eoi.jpg</file> + <file>images/txts.png</file> </qresource> </RCC> diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index f02fd6a..5db5f56 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -183,6 +183,9 @@ private slots: void saveFormat_data(); void saveFormat(); + void readText_data(); + void readText(); + void preserveTexts_data(); void preserveTexts(); }; @@ -1968,6 +1971,31 @@ void tst_QImageReader::saveFormat() } +void tst_QImageReader::readText_data() +{ + QTest::addColumn<QString>("fileName"); + QTest::addColumn<QString>("key"); + QTest::addColumn<QString>("text"); + + QTest::newRow("png, tEXt before img") << "txts.png" << "Title" << "PNG"; + QTest::newRow("png, zTXt before img") << "txts.png" << "Comment" << "Some compressed text."; + QTest::newRow("png, tEXt after img") << "txts.png" << "Disclaimer" << "For testing only."; + QTest::newRow("png, zTXt after img") << "txts.png" << "Description" << "Rendered by Persistence of Vision (tm) Ray Tracer"; +} + + +void tst_QImageReader::readText() +{ + QFETCH(QString, fileName); + QFETCH(QString, key); + QFETCH(QString, text); + + QImage img(prefix + fileName); + QVERIFY(img.textKeys().contains(key)); + QCOMPARE(img.text(key), text); +} + + void tst_QImageReader::preserveTexts_data() { QTest::addColumn<QString>("text"); diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index 6f4de91..cabf12e 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -1147,7 +1147,11 @@ void tst_QLocale::macDefaultLocale() expectedGMTSpecifier.append(QString("0%1").arg(qAbs(diff))); else expectedGMTSpecifier.append(QString("%1").arg(qAbs(diff))); - QVERIFY(timeString.contains(expectedGMTSpecifier)); + QVERIFY2(timeString.contains(expectedGMTSpecifier), qPrintable( + QString("timeString `%1', expectedGMTSpecifier `%2'") + .arg(timeString) + .arg(expectedGMTSpecifier) + )); } QCOMPARE(locale.dayName(1), QString("Monday")); QCOMPARE(locale.dayName(7), QString("Sunday")); diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 480893a..4d032e8 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -52,6 +52,7 @@ #include <qsplashscreen.h> #include <private/qpixmapdata_p.h> +#include <private/qdrawhelper_p.h> #include <QSet> @@ -656,9 +657,12 @@ void tst_QPixmap::mask() QVERIFY(!pm.isNull()); QVERIFY(!bm.isNull()); - // hw: todo: this will fail if the default pixmap format is - // argb32_premultiplied. The mask will be all 1's - QVERIFY(pm.mask().isNull()); + if (!pm.hasAlphaChannel()) { + // This would fail if the default pixmap format is + // argb32_premultiplied. The mask will be all 1's. + // Therefore this is skipped when the alpha channel is present. + QVERIFY(pm.mask().isNull()); + } QImage img = bm.toImage(); QVERIFY(img.format() == QImage::Format_MonoLSB @@ -1280,7 +1284,10 @@ void tst_QPixmap::fromSymbianCFbsBitmap() QCOMPARE(actualColor, color); QImage shouldBe(pixmap.width(), pixmap.height(), image.format()); - shouldBe.fill(color.rgba()); + if (image.format() == QImage::Format_RGB16) + shouldBe.fill(qrgb565(color.rgba()).rawValue()); + else + shouldBe.fill(color.rgba()); QCOMPARE(image, shouldBe); } __UHEAP_MARKEND; diff --git a/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp b/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp index d47eb24..0978293 100644 --- a/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp +++ b/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp @@ -276,8 +276,11 @@ bool TestConfigParser::isKnownSymbol(const QString &symbol) << "Q_OS_SOLARIS" << "Q_OS_WINCE" << "Q_OS_SYMBIAN" + << "Q_OS_MAC" + << "Q_OS_WIN" << "Q_CC_MSVC" << "Q_CC_MINGW" + << "Q_CC_INTEL" ; } return knownSymbols.contains(symbol); @@ -299,12 +302,21 @@ bool TestConfigParser::isDefined(const QString &symbol) #ifdef Q_OS_SYMBIAN << "Q_OS_SYMBIAN" #endif +#ifdef Q_OS_MAC + << "Q_OS_MAC" +#endif +#ifdef Q_OS_WIN + << "Q_OS_WIN" +#endif #ifdef Q_CC_MSVC << "Q_CC_MSVC" #endif #ifdef Q_CC_MINGW << "Q_CC_MINGW" #endif +#ifdef Q_CC_INTEL + << "Q_CC_INTEL" +#endif ; } return definedSymbols.contains(symbol); diff --git a/tests/auto/qscriptv8testsuite/skip.txt b/tests/auto/qscriptv8testsuite/skip.txt index 3c2cc53..9658c2b 100644 --- a/tests/auto/qscriptv8testsuite/skip.txt +++ b/tests/auto/qscriptv8testsuite/skip.txt @@ -15,3 +15,17 @@ mul-exhaustive | Demands too much memory on WinCE [Q_OS_SYMBIAN] nested-repetition-count-overflow | Demands too much memory on Symbian unicode-test | Demands too much memory on Symbian + +[Q_CC_INTEL] +math-min-max | Unresolved failures with intel compiler +negate-zero | Unresolved failures with intel compiler +smi-negative-zero | Unresolved failures with intel compiler +str-to-num | Unresolved failures with intel compiler +to-precision | Unresolved failures with intel compiler + +[Q_OS_MAC] +smi-negative-zero | Unresolved failures on Mac OS X (Cocoa) +to-precision | Unresolved failures on Mac OS X (Cocoa) + +[Q_OS_WIN] +to-precision | Unresolved failures on Windows diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 4f4e706a..1952796 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -61,6 +61,9 @@ #include <private/qtextengine_p.h> #include <qtextlayout.h> #undef private +#else +#include <private/qtextengine_p.h> +#include <qtextlayout.h> #endif #include <qfontdatabase.h> @@ -105,6 +108,9 @@ private slots: void linearB(); void controlInSyllable_qtbug14204(); void combiningMarks_qtbug15675(); + + void mirroredChars_data(); + void mirroredChars(); }; tst_QTextScriptEngine::tst_QTextScriptEngine() @@ -1151,9 +1157,86 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675() QVERIFY(e->layoutData->items[0].num_glyphs == 4); QVERIFY(e->layoutData->glyphLayout.advances_y[2] > 0); +#elif defined(Q_WS_X11) + QFontDatabase db; + + if (!db.families().contains("DejaVu Sans Mono")) { + QSKIP("Required font (DejaVu Sans Mono) doesn't exist, skip test.", SkipAll); + return; + } + + QString s; + s.append(QChar(0x0062)); + s.append(QChar(0x0332)); + s.append(QChar(0x0063)); + + QTextLayout layout(s, QFont("DejaVu Sans Mono")); + QTextEngine *e = layout.d; + e->itemize(); + e->shape(0); + + QVERIFY(e->layoutData->items[0].num_glyphs == 3); + QVERIFY(e->layoutData->glyphLayout.advances_x[1] == 0); #else - QSKIP("Mac specific test", SkipAll); + QSKIP("X11/Mac specific test", SkipAll); +#endif +} + +void tst_QTextScriptEngine::mirroredChars_data() +{ + QTest::addColumn<int>("hintingPreference"); + + QTest::newRow("Default hinting") << int(QFont::PreferDefaultHinting); + QTest::newRow("No hinting") << int(QFont::PreferNoHinting); + QTest::newRow("Vertical hinting") << int(QFont::PreferVerticalHinting); + QTest::newRow("Full hinting") << int(QFont::PreferFullHinting); +} + +void tst_QTextScriptEngine::mirroredChars() +{ +#if defined(Q_WS_MAC) + QSKIP("Not supported on Mac", SkipAll); #endif + QFETCH(int, hintingPreference); + + QFont font; + font.setHintingPreference(QFont::HintingPreference(hintingPreference)); + + QString s; + s.append(QLatin1Char('(')); + s.append(QLatin1Char(')')); + + HB_Glyph leftParenthesis; + HB_Glyph rightParenthesis; + { + QTextLayout layout(s); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + + QTextEngine *e = layout.engine(); + e->itemize(); + e->shape(0); + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(2)); + + const QGlyphLayout &glyphLayout = e->layoutData->glyphLayout; + leftParenthesis = glyphLayout.glyphs[0]; + rightParenthesis = glyphLayout.glyphs[1]; + } + + { + QTextLayout layout(s); + layout.setFlags(Qt::TextForceRightToLeft); + + QTextEngine *e = layout.engine(); + e->itemize(); + e->shape(0); + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(2)); + + const QGlyphLayout &glyphLayout = e->layoutData->glyphLayout; + QCOMPARE(glyphLayout.glyphs[0], rightParenthesis); + QCOMPARE(glyphLayout.glyphs[1], leftParenthesis); + } } QTEST_MAIN(tst_QTextScriptEngine) diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index b309917..b209258 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -66,7 +66,6 @@ private slots: void getSetWindowSurface(); void flushOutsidePaintEvent(); void grabWidget(); - void staticContentsAndPartialUpdateSupport(); }; class MyWindowSurface : public QWindowSurface @@ -82,8 +81,6 @@ public: /* nothing */ } - using QWindowSurface::setStaticContentsSupport; - using QWindowSurface::setPartialUpdateSupport; private: QImage image; }; @@ -283,51 +280,6 @@ void tst_QWindowSurface::grabWidget() QVERIFY(QColor(childInvalidSubImage.pixel(0, 0)) == QColor(Qt::white)); } -void tst_QWindowSurface::staticContentsAndPartialUpdateSupport() -{ - QWidget widget; - MyWindowSurface surface(&widget); - - // Default values. - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); - - // Partial: YES, Static: YES - surface.setStaticContentsSupport(true); - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(surface.hasStaticContentsSupport()); - - // Static contents requires support for partial updates. - // We simply ingore bad combinations and spit out a warning. - - // CONFLICT: Partial: NO, Static: YES - QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setPartialUpdateSupport: static contents support requires partial update support"); - surface.setPartialUpdateSupport(false); - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(surface.hasStaticContentsSupport()); - - // Partial: YES, Static: NO - surface.setStaticContentsSupport(false); - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); - - // Partial: NO, Static: NO - surface.setPartialUpdateSupport(false); - QVERIFY(!surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); - - // CONFLICT: Partial: NO, Static: YES - QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setStaticContentsSupport: static contents support requires partial update support"); - surface.setStaticContentsSupport(true); - QVERIFY(!surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); - - // Partial: YES, Static: NO - surface.setPartialUpdateSupport(true); - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); -} - QTEST_MAIN(tst_QWindowSurface) #else // Q_WS_MAC |