diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gui/image/qimagereader/images/corrupt_clut.bmp | bin | 0 -> 368 bytes | |||
-rw-r--r-- | tests/auto/gui/image/qimagereader/tst_qimagereader.cpp | 1 | ||||
-rw-r--r-- | tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp | 29 | ||||
-rw-r--r-- | tests/manual/qopenglwidget/openglwidget/main.cpp | 7 | ||||
-rw-r--r-- | tests/manual/qopenglwidget/openglwidget/openglwidget.cpp | 12 | ||||
-rw-r--r-- | tests/manual/qopenglwidget/openglwidget/openglwidget.h | 2 |
6 files changed, 50 insertions, 1 deletions
diff --git a/tests/auto/gui/image/qimagereader/images/corrupt_clut.bmp b/tests/auto/gui/image/qimagereader/images/corrupt_clut.bmp Binary files differnew file mode 100644 index 0000000000..aeb063fce5 --- /dev/null +++ b/tests/auto/gui/image/qimagereader/images/corrupt_clut.bmp diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 86dd8c4daf..ff15dc5b6d 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -1482,6 +1482,7 @@ void tst_QImageReader::readCorruptImage_data() QTest::newRow("corrupt gif") << QString("corrupt.gif") << true << QString("") << QByteArray("gif"); 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 bmp (clut)") << QString("corrupt_clut.bmp") << true << QString("") << QByteArray("bmp"); QTest::newRow("corrupt xpm (colors)") << QString("corrupt-colors.xpm") << true << QString("QImage: XPM color specification is missing: bla9an.n#x") << QByteArray("xpm"); diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp index 5506c96221..78cb06986f 100644 --- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp @@ -70,6 +70,7 @@ private slots: void setRawDataAndGetAsVector(); void boundingRect(); void mixedScripts(); + void multiLineBoundingRect(); private: int m_testFontId; @@ -735,6 +736,34 @@ void tst_QGlyphRun::mixedScripts() QCOMPARE(glyphRuns.size(), 2); } +void tst_QGlyphRun::multiLineBoundingRect() +{ + QTextLayout layout; + layout.setText("Foo Bar"); + layout.beginLayout(); + + QTextLine line = layout.createLine(); + line.setNumColumns(4); + line.setPosition(QPointF(0, 0)); + + line = layout.createLine(); + line.setPosition(QPointF(0, 10)); + + layout.endLayout(); + + QCOMPARE(layout.lineCount(), 2); + + QList<QGlyphRun> firstLineGlyphRuns = layout.lineAt(0).glyphRuns(); + QList<QGlyphRun> allGlyphRuns = layout.glyphRuns(); + QCOMPARE(firstLineGlyphRuns.size(), 1); + QCOMPARE(allGlyphRuns.size(), 1); + + QGlyphRun firstLineGlyphRun = firstLineGlyphRuns.first(); + QGlyphRun allGlyphRun = allGlyphRuns.first(); + + QVERIFY(firstLineGlyphRun.boundingRect().height() < allGlyphRun.boundingRect().height()); +} + #endif // QT_NO_RAWFONT QTEST_MAIN(tst_QGlyphRun) diff --git a/tests/manual/qopenglwidget/openglwidget/main.cpp b/tests/manual/qopenglwidget/openglwidget/main.cpp index a56cea1dfe..3844ca3d0f 100644 --- a/tests/manual/qopenglwidget/openglwidget/main.cpp +++ b/tests/manual/qopenglwidget/openglwidget/main.cpp @@ -181,6 +181,13 @@ int main(int argc, char *argv[]) glw3->setObjectName("GL widget in scroll area (possibly native)"); glw3->setFormat(format); glw3->setFixedSize(600, 600); + OpenGLWidget *glw3child = new OpenGLWidget(0); + const float glw3ClearColor[] = { 0.5f, 0.2f, 0.8f }; + glw3child->setClearColor(glw3ClearColor); + glw3child->setObjectName("Child widget of GL Widget in scroll area"); + glw3child->setFormat(format); + glw3child->setParent(glw3); + glw3child->setGeometry(500, 500, 100, 100); // lower right corner of parent QScrollArea *sa = new QScrollArea; sa->setWidget(glw3); sa->setMinimumSize(100, 100); diff --git a/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp b/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp index 4d2463b84d..95e2b31405 100644 --- a/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp +++ b/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp @@ -78,6 +78,8 @@ public: int m_interval; QVector3D m_rotAxis; + + float clearColor[3]; }; @@ -85,6 +87,7 @@ OpenGLWidget::OpenGLWidget(int interval, const QVector3D &rotAxis, QWidget *pare : QOpenGLWidget(parent) { d.reset(new OpenGLWidgetPrivate(this)); + d->clearColor[0] = d->clearColor[1] = d->clearColor[2] = 0.0f; d->m_interval = interval; d->m_rotAxis = rotAxis; if (interval > 0) { @@ -151,7 +154,7 @@ void OpenGLWidgetPrivate::render() const qreal retinaScale = q->devicePixelRatio(); glViewport(0, 0, width() * retinaScale, height() * retinaScale); - glClearColor(0.0, 0.0, 0.0, 1.0); + glClearColor(clearColor[0], clearColor[1], clearColor[2], 1.0f); glClear(GL_COLOR_BUFFER_BIT); m_program->bind(); @@ -194,3 +197,10 @@ void OpenGLWidgetPrivate::render() if (m_interval <= 0) q->update(); } + +void OpenGLWidget::setClearColor(const float *c) +{ + d->clearColor[0] = c[0]; + d->clearColor[1] = c[1]; + d->clearColor[2] = c[2]; +} diff --git a/tests/manual/qopenglwidget/openglwidget/openglwidget.h b/tests/manual/qopenglwidget/openglwidget/openglwidget.h index a1d5490845..1b9a66d877 100644 --- a/tests/manual/qopenglwidget/openglwidget/openglwidget.h +++ b/tests/manual/qopenglwidget/openglwidget/openglwidget.h @@ -49,6 +49,8 @@ public: void resizeGL(int w, int h); void paintGL(); + void setClearColor(const float *c); + private: QScopedPointer<OpenGLWidgetPrivate> d; }; |