From b66357e3ebf3e3dbda04f880e87184e247882843 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 5 Sep 2018 10:01:00 -0700 Subject: moc: Fix compilation of text strings containing non-ASCII On platforms where char is signed, like x86, the following is an error (narrowing conversion): unsigned char x[] = { '\xc3' }; Change-Id: I495bc19409f348069f5bfffd15518f9ef4e43faf Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Thiago Macieira --- .../corelib/plugin/qpluginloader/theplugin/theplugin.h | 2 +- .../corelib/plugin/qpluginloader/tst_qpluginloader.cpp | 8 ++++++++ tests/auto/corelib/plugin/qpluginloader/utf8_data.json | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/auto/corelib/plugin/qpluginloader/utf8_data.json (limited to 'tests/auto/corelib/plugin') 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 8e3ea91c40..c517c0809a 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -210,6 +210,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" + ] +} -- cgit v1.2.3