diff options
Diffstat (limited to 'tests/auto/gui')
-rw-r--r-- | tests/auto/gui/image/qimage/tst_qimage.cpp | 14 | ||||
-rw-r--r-- | tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp | 4 | ||||
-rw-r--r-- | tests/auto/gui/qopengl/tst_qopengl.cpp | 1 | ||||
-rw-r--r-- | tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp | 7 | ||||
-rw-r--r-- | tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp | 22 |
5 files changed, 46 insertions, 2 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 21481e374d..fac785ac86 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -211,6 +211,8 @@ private slots: void reinterpretAsFormat2(); + void complexTransform8bit(); + #ifdef Q_OS_DARWIN void toCGImage_data(); void toCGImage(); @@ -3366,6 +3368,18 @@ void tst_QImage::reinterpretAsFormat2() } } +void tst_QImage::complexTransform8bit() +{ + QImage img1(100, 100, QImage::Format_RGB32); + img1.fill(Qt::green); + img1 = img1.convertToFormat(QImage::Format_Indexed8); + QImage img2 = img1.transformed(QTransform().rotate(45), Qt::SmoothTransformation); + // Currently the format is always QImage::Format_ARGB32_Premultiplied, but it + // doesn't have to be, and if it becomes indexed this test is no longer be valid. + QVERIFY(img2.format() > QImage::Format_Indexed8); + QCOMPARE(img2.colorCount(), 0); +} + #ifdef Q_OS_DARWIN void tst_QImage::toCGImage_data() diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp index aea97a916e..c2c04b69c5 100644 --- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp @@ -1227,6 +1227,10 @@ void tst_QMatrixNxN::multiply4x4() QMatrix4x4 m5; m5 = m1 * m2; QVERIFY(isSame(m5, (const float *)m3Values)); + + QMatrix4x4 m1xm1 = m1 * m1; + m1 *= m1; + QCOMPARE(m1, m1xm1); } // Test matrix multiplication for 4x3 matrices. diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 87d93e0827..6d9456fa69 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -389,6 +389,7 @@ static bool fuzzyComparePixels(const QRgb testPixel, const QRgb refPixel, const static void fuzzyCompareImages(const QImage &testImage, const QImage &referenceImage, const char* file, int line) { + QCOMPARE(testImage.devicePixelRatio(), referenceImage.devicePixelRatio()); QCOMPARE(testImage.width(), referenceImage.width()); QCOMPARE(testImage.height(), referenceImage.height()); diff --git a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp index 39f7beca6f..f8dfdbd3b0 100644 --- a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp +++ b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp @@ -100,6 +100,7 @@ class tst_QOpenGlConfig : public QObject Q_OBJECT private slots: + void initTestCase(); void testConfiguration(); void testGlConfiguration(); void testBugList(); @@ -162,6 +163,12 @@ static void dumpConfiguration(QTextStream &str) } } +void tst_QOpenGlConfig::initTestCase() +{ + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) + QSKIP("OpenGL is not supported on this platform."); +} + void tst_QOpenGlConfig::testConfiguration() { QString result; diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index ef1ad76161..764b99646b 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -134,6 +134,7 @@ private slots: void clearResources(); void setPlainText(); + void toPlainText_data(); void toPlainText(); void toRawText(); @@ -2391,10 +2392,27 @@ void tst_QTextDocument::setPlainText() QCOMPARE(doc->toPlainText(), s); } +void tst_QTextDocument::toPlainText_data() +{ + QTest::addColumn<QString>("html"); + QTest::addColumn<QString>("expectedPlainText"); + + QTest::newRow("nbsp") << "Hello World" << "Hello World"; + QTest::newRow("empty_div") << "<div></div>hello" << "hello"; + QTest::newRow("br_and_p") << "<p>first<br></p><p>second<br></p>" << "first\n\nsecond\n"; + QTest::newRow("div") << "first<div>second<br>third</div>fourth" << "first\nsecond\nthird\nfourth"; // <div> and </div> become newlines... + QTest::newRow("br_text_end_of_div") << "<div><div>first<br>moretext</div>second<br></div>" << "first\nmoretext\nsecond\n"; // ... when there is text before <div> + QTest::newRow("br_end_of_div_like_gmail") << "<div><div><div>first<br></div>second<br></div>third<br></div>" << "first\nsecond\nthird\n"; // ... and when there is text before </div> + QTest::newRow("p_and_div") << "<div><div>first<p>second</p></div>third</div>" << "first\nsecond\nthird"; +} + void tst_QTextDocument::toPlainText() { - doc->setHtml("Hello World"); - QCOMPARE(doc->toPlainText(), QLatin1String("Hello World")); + QFETCH(QString, html); + QFETCH(QString, expectedPlainText); + + doc->setHtml(html); + QCOMPARE(doc->toPlainText(), expectedPlainText); } void tst_QTextDocument::toRawText() |