diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-11 01:00:36 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-11 01:00:36 +0200 |
commit | 5d92f1793aa8438ea974cc2232d2aa3b1b2b2472 (patch) | |
tree | dbb78cdbbf7e03f07d616ab76eb0466c74f7767e /tests | |
parent | 5ae2cbce2c4d5f319f1ddf1895d0f43f1c6ceafe (diff) | |
parent | 405e297756240b5f14e44b5fbd6a88091d2eddeb (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I1df9adea124326ef7c7802839eb93efc4302b287
Diffstat (limited to 'tests')
4 files changed, 80 insertions, 1 deletions
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h index 04ce042e24..ac349c2f75 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h @@ -35,7 +35,7 @@ class ThePlugin : public QObject, public PluginInterface { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../empty.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../utf8_data.json") Q_INTERFACES(PluginInterface) public: diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index f852a82ed3..4316ea14ea 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -213,6 +213,14 @@ void tst_QPluginLoader::errorString() { QPluginLoader loader( sys_qualifiedLibraryName("theplugin")); //a plugin + + // Check metadata + const QJsonObject metaData = loader.metaData(); + QCOMPARE(metaData.value("IID").toString(), QStringLiteral("org.qt-project.Qt.autotests.plugininterface")); + const QJsonObject kpluginObject = metaData.value("MetaData").toObject().value("KPlugin").toObject(); + QCOMPARE(kpluginObject.value("Name[mr]").toString(), QString::fromUtf8("चौकट भूमिती")); + + // Load QCOMPARE(loader.load(), true); QCOMPARE(loader.errorString(), unknown); diff --git a/tests/auto/corelib/plugin/qpluginloader/utf8_data.json b/tests/auto/corelib/plugin/qpluginloader/utf8_data.json new file mode 100644 index 0000000000..7763b65178 --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/utf8_data.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Name": "WindowGeometry", + "Name[mr]": "चौकट भूमिती", + "Name[pa]": "ਵਿੰਡੋਜੁਮੈਟਰੀ", + "Name[th]": "มิติขนาดของหน้าต่าง", + "Name[uk]": "Розміри вікна", + "Name[zh_CN]": "窗口形状", + "Name[zh_TW]": "視窗位置", + "ServiceTypes": [ + "KCModule" + ] + }, + "X-KDE-ParentComponents": [ + "windowgeometry" + ] +} diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index db125f6644..21c9f41646 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp @@ -30,6 +30,7 @@ #include <QtGui/QOpenGLFunctions> #include <QtGui/QPainter> #include <QtGui/QScreen> +#include <QtGui/QStaticText> #include <QtWidgets/QDesktopWidget> #include <QtWidgets/QGraphicsView> #include <QtWidgets/QGraphicsScene> @@ -40,6 +41,8 @@ #include <QtTest/QtTest> #include <QSignalSpy> #include <private/qguiapplication_p.h> +#include <private/qstatictext_p.h> +#include <private/qopengltextureglyphcache_p.h> #include <qpa/qplatformintegration.h> class tst_QOpenGLWidget : public QObject @@ -64,6 +67,10 @@ private slots: void stackWidgetOpaqueChildIsVisible(); void offscreen(); void offscreenThenOnscreen(); + +#ifdef QT_BUILD_INTERNAL + void staticTextDanglingPointer(); +#endif }; void tst_QOpenGLWidget::initTestCase() @@ -675,6 +682,53 @@ void tst_QOpenGLWidget::offscreenThenOnscreen() QVERIFY(image.pixel(30, 40) == qRgb(0, 0, 255)); } +class StaticTextPainterWidget : public QOpenGLWidget +{ +public: + StaticTextPainterWidget(QWidget *parent = nullptr) + : QOpenGLWidget(parent) + { + } + + void paintEvent(QPaintEvent *) + { + QPainter p(this); + text.setText(QStringLiteral("test")); + p.drawStaticText(0, 0, text); + + ctx = QOpenGLContext::currentContext(); + } + + QStaticText text; + QOpenGLContext *ctx; +}; + +#ifdef QT_BUILD_INTERNAL +void tst_QOpenGLWidget::staticTextDanglingPointer() +{ + QWidget w; + StaticTextPainterWidget *glw = new StaticTextPainterWidget(&w); + w.resize(640, 480); + glw->resize(320, 200); + w.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&w)); + QStaticTextPrivate *d = QStaticTextPrivate::get(&glw->text); + + QCOMPARE(d->itemCount, 1); + QFontEngine *fe = d->items->fontEngine(); + + for (int i = QFontEngine::Format_None; i <= QFontEngine::Format_ARGB; ++i) { + QOpenGLTextureGlyphCache *cache = + (QOpenGLTextureGlyphCache *) fe->glyphCache(glw->ctx, + QFontEngine::GlyphFormat(i), + QTransform()); + if (cache != nullptr) + QCOMPARE(cache->paintEnginePrivate(), nullptr); + } +} +#endif + QTEST_MAIN(tst_QOpenGLWidget) #include "tst_qopenglwidget.moc" |