diff options
Diffstat (limited to 'tests/auto/extensionsystem/pluginspec')
36 files changed, 317 insertions, 220 deletions
diff --git a/tests/auto/extensionsystem/pluginspec/test.pro b/tests/auto/extensionsystem/pluginspec/test.pro index aa82b3d921..df398b1fab 100644 --- a/tests/auto/extensionsystem/pluginspec/test.pro +++ b/tests/auto/extensionsystem/pluginspec/test.pro @@ -4,27 +4,23 @@ TARGET = pluginspec SOURCES += tst_pluginspec.cpp OTHER_FILES += \ - $$PWD/testspecs/simplespec.xml \ - $$PWD/testspecs/simplespec_experimental.xml \ - $$PWD/testspecs/spec1.xml \ - $$PWD/testspecs/spec2.xml \ - $$PWD/testspecs/spec_wrong1.xml \ - $$PWD/testspecs/spec_wrong2.xml \ - $$PWD/testspecs/spec_wrong3.xml \ - $$PWD/testspecs/spec_wrong4.xml \ - $$PWD/testspecs/spec_wrong5.xml \ - $$PWD/testdependencies/spec1.xml \ - $$PWD/testdependencies/spec2.xml \ - $$PWD/testdependencies/spec3.xml \ - $$PWD/testdependencies/spec4.xml \ - $$PWD/testdependencies/spec5.xml \ - $$PWD/testdir/spec.xml + $$PWD/testspecs/simplespec.json \ + $$PWD/testspecs/simplespec_experimental.json \ + $$PWD/testspecs/spec1.json \ + $$PWD/testspecs/spec2.json \ + $$PWD/testspecs/spec_wrong2.json \ + $$PWD/testspecs/spec_wrong3.json \ + $$PWD/testspecs/spec_wrong4.json \ + $$PWD/testspecs/spec_wrong5.json \ + $$PWD/testdependencies/spec1.json \ + $$PWD/testdependencies/spec2.json \ + $$PWD/testdependencies/spec3.json \ + $$PWD/testdependencies/spec4.json \ + $$PWD/testdependencies/spec5.json \ + $$PWD/testdir/spec.json QTC_LIB_DEPENDS += extensionsystem include(../../qttest.pri) DEFINES += "PLUGINSPEC_DIR=\\\"$$PWD\\\"" - -COPYDIR = $$OUT_PWD -COPYFILES = $$OTHER_FILES -include(../copy.pri) +DEFINES += "PLUGIN_DIR=\\\"$$OUT_PWD\\\"" diff --git a/tests/auto/extensionsystem/pluginspec/test.qbs b/tests/auto/extensionsystem/pluginspec/test.qbs index 365266d5e9..a6e65844ed 100644 --- a/tests/auto/extensionsystem/pluginspec/test.qbs +++ b/tests/auto/extensionsystem/pluginspec/test.qbs @@ -5,44 +5,43 @@ QtcAutotest { name: "ExtensionSystem pluginspec autotest" Depends { name: "Aggregation" } Depends { name: "ExtensionSystem" } - Depends { name: "pluginspec_test" } - cpp.defines: base.concat(['PLUGINSPEC_DIR="' + destinationDirectory + '"']) - files: "tst_pluginspec.cpp" + Group { + name: "Sources" + files: "tst_pluginspec.cpp" + cpp.defines: base.concat([ + 'PLUGIN_DIR="' + destinationDirectory + '"', + 'PLUGINSPEC_DIR="' + sourceDirectory + '"' + ]) + } + Group { id: testSpecsGroup name: "test specs" - fileTags: "copyable_resource" - copyable_resource.targetDirectory: product.destinationDirectory + "/testspecs" files: [ - "testspecs/simplespec.xml", - "testspecs/simplespec_experimental.xml", - "testspecs/spec1.xml", - "testspecs/spec2.xml", - "testspecs/spec_wrong1.xml", - "testspecs/spec_wrong2.xml", - "testspecs/spec_wrong3.xml", - "testspecs/spec_wrong4.xml", - "testspecs/spec_wrong5.xml", + "testspecs/simplespec.json", + "testspecs/simplespec_experimental.json", + "testspecs/spec1.json", + "testspecs/spec2.json", + "testspecs/spec_wrong2.json", + "testspecs/spec_wrong3.json", + "testspecs/spec_wrong4.json", + "testspecs/spec_wrong5.json", ] } Group { id: testDependenciesGroup name: "test dependencies" - fileTags: "copyable_resource" - copyable_resource.targetDirectory: product.destinationDirectory + "/testdependencies" files: [ - "testdependencies/spec1.xml", - "testdependencies/spec2.xml", - "testdependencies/spec3.xml", - "testdependencies/spec4.xml", - "testdependencies/spec5.xml", + "testdependencies/spec1.json", + "testdependencies/spec2.json", + "testdependencies/spec3.json", + "testdependencies/spec4.json", + "testdependencies/spec5.json", ] } Group { id: specGroup name: "spec" - fileTags: "copyable_resource" - copyable_resource.targetDirectory: product.destinationDirectory + "/testdir" - files: ["testdir/spec.xml"] + files: ["testdir/spec.json"] } } diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec1.json b/tests/auto/extensionsystem/pluginspec/testdependencies/spec1.json new file mode 100644 index 0000000000..62f4e614a9 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testdependencies/spec1.json @@ -0,0 +1,12 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "plugin1", + "Version" : "1.0.1", + "CompatVersion" : "1.0.0", + "Dependencies" : [ + { "Name" : "plugin2", "Version" : "2.3.0_2" }, + { "Name" : "plugin3", "Version" : "1.0.0" } + ] + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec1.xml b/tests/auto/extensionsystem/pluginspec/testdependencies/spec1.xml deleted file mode 100644 index 137e1b494c..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testdependencies/spec1.xml +++ /dev/null @@ -1,6 +0,0 @@ -<plugin name="plugin1" version="1.0.1" compatVersion="1.0.0"> - <dependencyList> - <dependency name="plugin2" version="2.3.0_2"/> - <dependency name="plugin3" version="1.0.0"/> - </dependencyList> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec2.json b/tests/auto/extensionsystem/pluginspec/testdependencies/spec2.json new file mode 100644 index 0000000000..020bc447a8 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testdependencies/spec2.json @@ -0,0 +1,8 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "plugin2", + "Version" : "2.4.1", + "CompatVersion" : "2.3.0" + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec2.xml b/tests/auto/extensionsystem/pluginspec/testdependencies/spec2.xml deleted file mode 100644 index 451f854185..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testdependencies/spec2.xml +++ /dev/null @@ -1,2 +0,0 @@ -<plugin name="plugin2" version="2.4.1" compatVersion="2.3.0"> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec3.json b/tests/auto/extensionsystem/pluginspec/testdependencies/spec3.json new file mode 100644 index 0000000000..9773582368 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testdependencies/spec3.json @@ -0,0 +1,8 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "plugin3", + "Version" : "1.0.0", + "CompatVersion" : "1.0.0" + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec3.xml b/tests/auto/extensionsystem/pluginspec/testdependencies/spec3.xml deleted file mode 100644 index 9fa01a442f..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testdependencies/spec3.xml +++ /dev/null @@ -1,2 +0,0 @@ -<plugin name="plugin3" version="1.0.0" compatVersion="1.0.0"> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec4.json b/tests/auto/extensionsystem/pluginspec/testdependencies/spec4.json new file mode 100644 index 0000000000..a574c8ee78 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testdependencies/spec4.json @@ -0,0 +1,11 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "plugin4", + "Version" : "1.0.1", + "CompatVersion" : "1.0.0", + "Dependencies" : [ + { "Name" : "plugin5", "Version" : "2.3.0_2" } + ] + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec4.xml b/tests/auto/extensionsystem/pluginspec/testdependencies/spec4.xml deleted file mode 100644 index b06bab2fa0..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testdependencies/spec4.xml +++ /dev/null @@ -1,5 +0,0 @@ -<plugin name="plugin4" version="1.0.1" compatVersion="1.0.0"> - <dependencyList> - <dependency name="plugin5" version="2.3.0_2"/> - </dependencyList> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec5.json b/tests/auto/extensionsystem/pluginspec/testdependencies/spec5.json new file mode 100644 index 0000000000..660aff9011 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testdependencies/spec5.json @@ -0,0 +1,8 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "plugin5", + "Version" : "1.0.1", + "CompatVersion" : "1.0.0" + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testdependencies/spec5.xml b/tests/auto/extensionsystem/pluginspec/testdependencies/spec5.xml deleted file mode 100644 index aab8f424c3..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testdependencies/spec5.xml +++ /dev/null @@ -1,2 +0,0 @@ -<plugin name="plugin5" version="1.0.1" compatVersion="1.0.0"> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testdir/spec.xml b/tests/auto/extensionsystem/pluginspec/testdir/spec.json index 6bd573957b..6bd573957b 100644 --- a/tests/auto/extensionsystem/pluginspec/testdir/spec.xml +++ b/tests/auto/extensionsystem/pluginspec/testdir/spec.json diff --git a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.h b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.h index 122a530432..e2b785ae6d 100644 --- a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.h +++ b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.h @@ -40,7 +40,7 @@ namespace MyPlugin { class MYPLUGIN_EXPORT MyPluginImpl : public ExtensionSystem::IPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "testplugin.json") + Q_PLUGIN_METADATA(IID "plugin" FILE "testplugin.json") public: MyPluginImpl(); diff --git a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.json b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.json index 0967ef424b..f6c891e9d3 100644 --- a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.json +++ b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.json @@ -1 +1,4 @@ -{} +{ + "Name" : "MyPlugin", + "Version" : "1.0.0" +} diff --git a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.pro b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.pro index 0f435476b6..c52eec0dc4 100644 --- a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.pro +++ b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.pro @@ -3,15 +3,11 @@ DEFINES += MYPLUGIN_LIBRARY SOURCES += testplugin.cpp HEADERS += testplugin.h testplugin_global.h -OTHER_FILES += testplugin.xml +OTHER_FILES += testplugin.json QTC_LIB_DEPENDS += extensionsystem include(../../../../../qtcreator.pri) include(../../../qttestrpath.pri) -COPYDIR = $$OUT_PWD -COPYFILES = $$PWD/testplugin.xml -include(../../copy.pri) - TARGET = $$qtLibraryName(test) CONFIG -= debug_and_release_target diff --git a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.qbs b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.qbs index 5bf464c01d..ce0ab64d78 100644 --- a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.qbs +++ b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.qbs @@ -7,6 +7,5 @@ Plugin { "testplugin.h", "testplugin.cpp", "testplugin_global.h" ] - filesToCopy: "testplugin.xml" cpp.defines: base.concat(["MYPLUGIN_LIBRARY"]) } diff --git a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.xml b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.xml deleted file mode 100644 index f8ab3f7a39..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.xml +++ /dev/null @@ -1,2 +0,0 @@ -<plugin name="test" version="1.0.0"> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/simplespec.json b/tests/auto/extensionsystem/pluginspec/testspecs/simplespec.json new file mode 100644 index 0000000000..2f1851a748 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testspecs/simplespec.json @@ -0,0 +1,8 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "MyPlugin", + "Version" : "2.2.3_9", + "CompatVersion" : "2.0.0" + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/simplespec.xml b/tests/auto/extensionsystem/pluginspec/testspecs/simplespec.xml deleted file mode 100644 index 6bd573957b..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testspecs/simplespec.xml +++ /dev/null @@ -1,2 +0,0 @@ -<plugin name="MyPlugin" version="2.2.3_9" compatVersion="2.0.0"> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/simplespec_experimental.json b/tests/auto/extensionsystem/pluginspec/testspecs/simplespec_experimental.json new file mode 100644 index 0000000000..5530383793 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testspecs/simplespec_experimental.json @@ -0,0 +1,9 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "MyPlugin", + "Version" : "2.2.3_9", + "CompatVersion" : "2.0.0", + "Experimental" : true + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/simplespec_experimental.xml b/tests/auto/extensionsystem/pluginspec/testspecs/simplespec_experimental.xml deleted file mode 100644 index 69fe37c53e..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testspecs/simplespec_experimental.xml +++ /dev/null @@ -1,2 +0,0 @@ -<plugin name="MyPlugin" version="2.2.3_9" compatVersion="2.0.0" experimental="true"> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec1.json b/tests/auto/extensionsystem/pluginspec/testspecs/spec1.json new file mode 100644 index 0000000000..fedae9dfc5 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testspecs/spec1.json @@ -0,0 +1,24 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "test", + "Version" : "1.0.1", + "CompatVersion" : "1.0.0", + "Vendor" : "Digia Plc", + "Copyright" : "(C) 2014 Digia Plc", + "License" : [ + "This is a default license bla", + "blubbblubb", + "end of terms" + ], + "Description" : [ + "This plugin is just a test.", + " it demonstrates the great use of the plugin spec." + ], + "Url" : "http://qt.digia.com", + "Dependencies" : [ + { "Name" : "SomeOtherPlugin", "Version" : "2.3.0_2" }, + { "Name" : "EvenOther", "Version" : "1.0.0" } + ] + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec1.xml b/tests/auto/extensionsystem/pluginspec/testspecs/spec1.xml deleted file mode 100644 index f1d801495e..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testspecs/spec1.xml +++ /dev/null @@ -1,18 +0,0 @@ -<plugin name="test" version="1.0.1" compatVersion="1.0.0"> - <vendor>Digia Plc</vendor> - <copyright>(C) 2014 Digia Plc</copyright> - <license> -This is a default license bla -blubbblubb -end of terms - </license> - <description> -This plugin is just a test. - it demonstrates the great use of the plugin spec. - </description> - <url>http://qt.digi.com</url> - <dependencyList> - <dependency name="SomeOtherPlugin" version="2.3.0_2"/> - <dependency name="EvenOther" version="1.0.0"/> - </dependencyList> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec2.json b/tests/auto/extensionsystem/pluginspec/testspecs/spec2.json new file mode 100644 index 0000000000..aaed8000a7 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testspecs/spec2.json @@ -0,0 +1,8 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "test", + "Version" : "3.1.4_10", + "Required" : true + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec2.xml b/tests/auto/extensionsystem/pluginspec/testspecs/spec2.xml deleted file mode 100644 index 24d272902a..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testspecs/spec2.xml +++ /dev/null @@ -1,2 +0,0 @@ -<plugin name="test" version="3.1.4_10" required="true"> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong1.xml b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong1.xml deleted file mode 100644 index 561c36c633..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong1.xml +++ /dev/null @@ -1,18 +0,0 @@ -<something name="test" version="1.0.1" compatVersion="1.0.0"> - <vendor>Digia Plc</vendor> - <copyright>(C) 2014 Digia Plc</copyright> - <license> -This is a default license bla -blubbblubb -end of terms - </license> - <description> -This plugin is just a test. - it demonstrates the great use of the plugin spec. - </description> - <url>http://qt.digia.com</url> - <dependencyList> - <dependency name="SomeOtherPlugin" version="2.3.0_2"/> - <dependency name="EvenOther" version="1.0.0"/> - </dependencyList> -</something> diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong2.json b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong2.json new file mode 100644 index 0000000000..1b53a5023d --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong2.json @@ -0,0 +1,23 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Version" : "1.0.1", + "CompatVersion" : "1.0.0", + "Vendor" : "Digia Plc", + "Copyright" : "(C) 2014 Digia Plc", + "License" : [ + "This is a default license bla", + "blubbblubb", + "end of terms" + ], + "Description" : [ + "This plugin is just a test.", + " it demonstrates the great use of the plugin spec." + ], + "Url" : "http://qt.digia.com", + "Dependencies" : [ + { "Name" : "SomeOtherPlugin", "Version" : "2.3.0_2" }, + { "Name" : "EvenOther", "Version" : "1.0.0" } + ] + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong2.xml b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong2.xml deleted file mode 100644 index 03c12acc20..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong2.xml +++ /dev/null @@ -1,18 +0,0 @@ -<plugin version="1.0.1" compatVersion="1.0.0"> - <vendor>Digia Plc</vendor> - <copyright>(C) 2014 Digia Plc</copyright> - <license> -This is a default license bla -blubbblubb -end of terms - </license> - <description> -This plugin is just a test. - it demonstrates the great use of the plugin spec. - </description> - <url>http://qt.digia.com</url> - <dependencyList> - <dependency name="SomeOtherPlugin" version="2.3.0_2"/> - <dependency name="EvenOther" version="1.0.0"/> - </dependencyList> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong3.json b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong3.json new file mode 100644 index 0000000000..1462ca501a --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong3.json @@ -0,0 +1,23 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "test", + "CompatVersion" : "1.0.0", + "Vendor" : "Digia Plc", + "Copyright" : "(C) 2014 Digia Plc", + "License" : [ + "This is a default license bla", + "blubbblubb", + "end of terms" + ], + "Description" : [ + "This plugin is just a test.", + " it demonstrates the great use of the plugin spec." + ], + "Url" : "http://qt.digia.com", + "Dependencies" : [ + { "Name" : "SomeOtherPlugin", "Version" : "2.3.0_2" }, + { "Name" : "EvenOther", "Version" : "1.0.0" } + ] + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong3.xml b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong3.xml deleted file mode 100644 index 95567f8671..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong3.xml +++ /dev/null @@ -1,18 +0,0 @@ -<plugin name="test" compatVersion="1.0.0"> - <vendor>Digia Plc</vendor> - <copyright>(C) 2014 Digia Plc</copyright> - <license> -This is a default license bla -blubbblubb -end of terms - </license> - <description> -This plugin is just a test. - it demonstrates the great use of the plugin spec. - </description> - <url>http://qt.digia.com</url> - <dependencyList> - <dependency name="SomeOtherPlugin" version="2.3.0_2"/> - <dependency name="EvenOther" version="1.0.0"/> - </dependencyList> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong4.json b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong4.json new file mode 100644 index 0000000000..b98f4bdb9d --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong4.json @@ -0,0 +1,24 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "test", + "Version" : "1.0.1", + "CompatVersion" : "1.0.0", + "Vendor" : "Digia Plc", + "Copyright" : "(C) 2014 Digia Plc", + "License" : [ + "This is a default license bla", + "blubbblubb", + "end of terms" + ], + "Description" : [ + "This plugin is just a test.", + " it demonstrates the great use of the plugin spec." + ], + "Url" : "http://qt.digia.com", + "Dependencies" : [ + { "Version" : "2.3.0_2" }, + { "Name" : "EvenOther", "Version" : "1.0.0" } + ] + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong4.xml b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong4.xml deleted file mode 100644 index 2ea33e31e8..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong4.xml +++ /dev/null @@ -1,18 +0,0 @@ -<plugin name="test" version="1.0.1" compatVersion="1.0.0"> - <vendor>Digia Plc</vendor> - <copyright>(C) 2014 Digia Plc</copyright> - <license> -This is a default license bla -blubbblubb -end of terms - </license> - <description> -This plugin is just a test. - it demonstrates the great use of the plugin spec. - </description> - <url>http://qt.digia.com</url> - <dependencyList> - <dependency version="2.3.0_2"/> - <dependency name="EvenOther" version="1.0.0"/> - </dependencyList> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong5.json b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong5.json new file mode 100644 index 0000000000..2d3fb804ae --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong5.json @@ -0,0 +1,24 @@ +{ + "IID" : "plugin", + "MetaData" : { + "Name" : "test", + "Version" : "1.0.1", + "CompatVersion" : "1.0.0", + "Vendor" : "Digia Plc", + "Copyright" : "(C) 2014 Digia Plc", + "License" : [ + "This is a default license bla", + "blubbblubb", + "end of terms" + ], + "Description" : [ + "This plugin is just a test.", + " it demonstrates the great use of the plugin spec." + ], + "Url" : "http://qt.digia.com", + "Dependencies" : [ + { "Name" : "SomeOtherPlugin", "Version" : "2.3aa.0_2" }, + { "Name" : "EvenOther", "Version" : "1.0.0" } + ] + } +} diff --git a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong5.xml b/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong5.xml deleted file mode 100644 index b9aaf18190..0000000000 --- a/tests/auto/extensionsystem/pluginspec/testspecs/spec_wrong5.xml +++ /dev/null @@ -1,18 +0,0 @@ -<plugin name="test" version="1.0.1" compatVersion="1.0.0"> - <vendor>Digia Plc</vendor> - <copyright>(C) 2014 Digia Plc</copyright> - <license> -This is a default license bla -blubbblubb -end of terms - </license> - <description> -This plugin is just a test. - it demonstrates the great use of the plugin spec. - </description> - <url>http://qt.digia.com</url> - <dependencyList> - <dependency name="SomeOtherPlugin" version="2.3aa.0_2"/> - <dependency name="EvenOther" version="1.0.0"/> - </dependencyList> -</plugin> diff --git a/tests/auto/extensionsystem/pluginspec/tst_pluginspec.cpp b/tests/auto/extensionsystem/pluginspec/tst_pluginspec.cpp index 8318a6bea6..f25e380bcb 100644 --- a/tests/auto/extensionsystem/pluginspec/tst_pluginspec.cpp +++ b/tests/auto/extensionsystem/pluginspec/tst_pluginspec.cpp @@ -32,6 +32,8 @@ #include <extensionsystem/pluginmanager_p.h> #include <extensionsystem/pluginmanager.h> +#include <QJsonDocument> +#include <QJsonObject> #include <QObject> #include <QMetaObject> #include <QtTest> @@ -39,6 +41,33 @@ using namespace ExtensionSystem; +static QJsonObject metaData(const QString &fileName) +{ + QFile f(fileName); + if (!f.open(QIODevice::ReadOnly)) { + qWarning() << "Could not open" << fileName; + return QJsonObject(); + } + QJsonParseError error; + QJsonDocument doc = QJsonDocument::fromJson(f.readAll(), &error); + if (error.error != QJsonParseError::NoError) { + qWarning() << "Could not parse" << fileName << ":" << error.errorString(); + return QJsonObject(); + } + return doc.object(); +} + +static QString libraryName(const QString &basename) +{ +#if defined(Q_OS_OSX) + return QLatin1String("lib") + basename + QLatin1String("_debug.dylib"); +#elif defined(Q_OS_UNIX) + return QLatin1String("lib") + basename + QLatin1String(".so"); +#else + return basename + QLatin1String("d.dll"); +#endif +} + class tst_PluginSpec : public QObject { Q_OBJECT @@ -56,19 +85,36 @@ private slots: void initializePlugin(); void initializeExtensions(); void init(); + void initTestCase(); + void cleanupTestCase(); + +private: + PluginManager *pm; }; void tst_PluginSpec::init() { + QLoggingCategory::setFilterRules(QLatin1String("qtc.*.debug=false")); QVERIFY(QDir::setCurrent(QLatin1String(PLUGINSPEC_DIR))); } +void tst_PluginSpec::initTestCase() +{ + pm = new PluginManager; + pm->setPluginIID(QLatin1String("plugin")); +} + +void tst_PluginSpec::cleanupTestCase() +{ + delete pm; + pm = 0; +} + void tst_PluginSpec::read() { Internal::PluginSpecPrivate spec(0); QCOMPARE(spec.state, PluginSpec::Invalid); - QVERIFY(spec.read("testspecs/spec1.xml")); - QCOMPARE(spec.state, PluginSpec::Read); + QVERIFY(spec.readMetaData(metaData("testspecs/spec1.json"))); QVERIFY(!spec.hasError); QVERIFY(spec.errorString.isEmpty()); QCOMPARE(spec.name, QString("test")); @@ -81,7 +127,7 @@ void tst_PluginSpec::read() QCOMPARE(spec.copyright, QString("(C) 2014 Digia Plc")); QCOMPARE(spec.license, QString("This is a default license bla\nblubbblubb\nend of terms")); QCOMPARE(spec.description, QString("This plugin is just a test.\n it demonstrates the great use of the plugin spec.")); - QCOMPARE(spec.url, QString("http://qt.digi.com")); + QCOMPARE(spec.url, QString("http://qt.digia.com")); PluginDependency dep1; dep1.name = QString("SomeOtherPlugin"); dep1.version = QString("2.3.0_2"); @@ -92,7 +138,7 @@ void tst_PluginSpec::read() // test missing compatVersion behavior // and 'required' attribute - QVERIFY(spec.read("testspecs/spec2.xml")); + QVERIFY(spec.readMetaData(metaData("testspecs/spec2.json"))); QCOMPARE(spec.version, QString("3.1.4_10")); QCOMPARE(spec.compatVersion, QString("3.1.4_10")); QCOMPARE(spec.required, true); @@ -102,27 +148,23 @@ void tst_PluginSpec::readError() { Internal::PluginSpecPrivate spec(0); QCOMPARE(spec.state, PluginSpec::Invalid); - QVERIFY(!spec.read("non-existing-file.xml")); + QVERIFY(!spec.readMetaData(metaData("non-existing-file.json"))); QCOMPARE(spec.state, PluginSpec::Invalid); - QVERIFY(spec.hasError); - QVERIFY(!spec.errorString.isEmpty()); - QVERIFY(!spec.read("testspecs/spec_wrong1.xml")); - QCOMPARE(spec.state, PluginSpec::Invalid); - QVERIFY(spec.hasError); - QVERIFY(!spec.errorString.isEmpty()); - QVERIFY(!spec.read("testspecs/spec_wrong2.xml")); + QVERIFY(!spec.hasError); + QVERIFY(spec.errorString.isEmpty()); + QVERIFY(spec.readMetaData(metaData("testspecs/spec_wrong2.json"))); QCOMPARE(spec.state, PluginSpec::Invalid); QVERIFY(spec.hasError); QVERIFY(!spec.errorString.isEmpty()); - QVERIFY(!spec.read("testspecs/spec_wrong3.xml")); + QVERIFY(spec.readMetaData(metaData("testspecs/spec_wrong3.json"))); QCOMPARE(spec.state, PluginSpec::Invalid); QVERIFY(spec.hasError); QVERIFY(!spec.errorString.isEmpty()); - QVERIFY(!spec.read("testspecs/spec_wrong4.xml")); + QVERIFY(spec.readMetaData(metaData("testspecs/spec_wrong4.json"))); QCOMPARE(spec.state, PluginSpec::Invalid); QVERIFY(spec.hasError); QVERIFY(!spec.errorString.isEmpty()); - QVERIFY(!spec.read("testspecs/spec_wrong5.xml")); + QVERIFY(spec.readMetaData(metaData("testspecs/spec_wrong5.json"))); QCOMPARE(spec.state, PluginSpec::Invalid); QVERIFY(spec.hasError); QVERIFY(!spec.errorString.isEmpty()); @@ -168,7 +210,7 @@ void tst_PluginSpec::versionCompare() void tst_PluginSpec::provides() { Internal::PluginSpecPrivate spec(0); - QVERIFY(spec.read("testspecs/simplespec.xml")); + QVERIFY(spec.readMetaData(metaData("testspecs/simplespec.json"))); QVERIFY(!spec.provides("SomeOtherPlugin", "2.2.3_9")); QVERIFY(!spec.provides("MyPlugin", "2.2.3_10")); QVERIFY(!spec.provides("MyPlugin", "2.2.4")); @@ -193,7 +235,7 @@ void tst_PluginSpec::provides() void tst_PluginSpec::experimental() { Internal::PluginSpecPrivate spec(0); - QVERIFY(spec.read("testspecs/simplespec_experimental.xml")); + QVERIFY(spec.readMetaData(metaData("testspecs/simplespec_experimental.json"))); QCOMPARE(spec.experimental, true); QCOMPARE(spec.enabledInSettings, false); } @@ -201,15 +243,9 @@ void tst_PluginSpec::experimental() void tst_PluginSpec::locationAndPath() { Internal::PluginSpecPrivate spec(0); - QVERIFY(spec.read("testspecs/simplespec.xml")); - QCOMPARE(spec.location, QString(QDir::currentPath()+"/testspecs")); - QCOMPARE(spec.filePath, QString(QDir::currentPath()+"/testspecs/simplespec.xml")); - QVERIFY(spec.read("testdir/../testspecs/simplespec.xml")); - QCOMPARE(spec.location, QString(QDir::currentPath()+"/testspecs")); - QCOMPARE(spec.filePath, QString(QDir::currentPath()+"/testspecs/simplespec.xml")); - QVERIFY(spec.read("testdir/spec.xml")); - QCOMPARE(spec.location, QString(QDir::currentPath()+"/testdir")); - QCOMPARE(spec.filePath, QString(QDir::currentPath()+"/testdir/spec.xml")); + QVERIFY(spec.read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test")))); + QCOMPARE(spec.location, QString(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin"))); + QCOMPARE(spec.filePath, QString(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test")))); } void tst_PluginSpec::resolveDependencies() @@ -218,20 +254,33 @@ void tst_PluginSpec::resolveDependencies() PluginSpec *spec1 = Internal::PluginManagerPrivate::createSpec(); specs.append(spec1); Internal::PluginSpecPrivate *spec1Priv = Internal::PluginManagerPrivate::privateSpec(spec1); - spec1Priv->read("testdependencies/spec1.xml"); + spec1Priv->readMetaData(metaData("testdependencies/spec1.json")); + spec1Priv->state = PluginSpec::Read; // fake read state for plugin resolving + PluginSpec *spec2 = Internal::PluginManagerPrivate::createSpec(); specs.append(spec2); - Internal::PluginManagerPrivate::privateSpec(spec2)->read("testdependencies/spec2.xml"); + Internal::PluginSpecPrivate *spec2Priv = Internal::PluginManagerPrivate::privateSpec(spec2); + spec2Priv->readMetaData(metaData("testdependencies/spec2.json")); + spec2Priv->state = PluginSpec::Read; // fake read state for plugin resolving + PluginSpec *spec3 = Internal::PluginManagerPrivate::createSpec(); specs.append(spec3); - Internal::PluginManagerPrivate::privateSpec(spec3)->read("testdependencies/spec3.xml"); + Internal::PluginSpecPrivate *spec3Priv = Internal::PluginManagerPrivate::privateSpec(spec3); + spec3Priv->readMetaData(metaData("testdependencies/spec3.json")); + spec3Priv->state = PluginSpec::Read; // fake read state for plugin resolving + PluginSpec *spec4 = Internal::PluginManagerPrivate::createSpec(); specs.append(spec4); Internal::PluginSpecPrivate *spec4Priv = Internal::PluginManagerPrivate::privateSpec(spec4); - spec4Priv->read("testdependencies/spec4.xml"); + spec4Priv->readMetaData(metaData("testdependencies/spec4.json")); + spec4Priv->state = PluginSpec::Read; // fake read state for plugin resolving + PluginSpec *spec5 = Internal::PluginManagerPrivate::createSpec(); specs.append(spec5); - Internal::PluginManagerPrivate::privateSpec(spec5)->read("testdependencies/spec5.xml"); + Internal::PluginSpecPrivate *spec5Priv = Internal::PluginManagerPrivate::privateSpec(spec5); + spec5Priv->readMetaData(metaData("testdependencies/spec5.json")); + spec5Priv->state = PluginSpec::Read; // fake read state for plugin resolving + QVERIFY(spec1Priv->resolveDependencies(specs)); QCOMPARE(spec1Priv->dependencySpecs.size(), 2); QVERIFY(!spec1Priv->dependencySpecs.key(spec2).name.isEmpty()); @@ -246,8 +295,7 @@ void tst_PluginSpec::loadLibrary() { PluginSpec *ps = Internal::PluginManagerPrivate::createSpec(); Internal::PluginSpecPrivate *spec = Internal::PluginManagerPrivate::privateSpec(ps); - PluginManager *manager = new PluginManager(); - QVERIFY(spec->read("testplugin/testplugin.xml")); + QVERIFY(spec->read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test")))); QVERIFY(spec->resolveDependencies(QList<PluginSpec *>())); QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString)); QVERIFY(spec->plugin != 0); @@ -255,14 +303,13 @@ void tst_PluginSpec::loadLibrary() QCOMPARE(spec->state, PluginSpec::Loaded); QVERIFY(!spec->hasError); QCOMPARE(spec->plugin->pluginSpec(), ps); - delete manager; delete ps; } void tst_PluginSpec::initializePlugin() { Internal::PluginSpecPrivate spec(0); - QVERIFY(spec.read("testplugin/testplugin.xml")); + QVERIFY(spec.read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test")))); QVERIFY(spec.resolveDependencies(QList<PluginSpec *>())); QVERIFY2(spec.loadLibrary(), qPrintable(spec.errorString)); bool isInitialized; @@ -280,7 +327,7 @@ void tst_PluginSpec::initializePlugin() void tst_PluginSpec::initializeExtensions() { Internal::PluginSpecPrivate spec(0); - QVERIFY(spec.read("testplugin/testplugin.xml")); + QVERIFY(spec.read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test")))); QVERIFY(spec.resolveDependencies(QList<PluginSpec *>())); QVERIFY2(spec.loadLibrary(), qPrintable(spec.errorString)); bool isExtensionsInitialized; |