diff options
Diffstat (limited to 'sources')
5 files changed, 22 insertions, 13 deletions
diff --git a/sources/shiboken2/ApiExtractor/tests/CMakeLists.txt b/sources/shiboken2/ApiExtractor/tests/CMakeLists.txt index 860a37d9d..e100ef493 100644 --- a/sources/shiboken2/ApiExtractor/tests/CMakeLists.txt +++ b/sources/shiboken2/ApiExtractor/tests/CMakeLists.txt @@ -4,13 +4,18 @@ find_package(Qt5Test) find_package(Qt5Xml) find_package(Qt5XmlPatterns) +set(CMAKE_AUTORCC ON) + macro(declare_test testname) # gone: qt4_automoc("${testname}.cpp") - if (EXISTS "${testname}.h") - add_executable(${testname} "${testname}.h ${testname}.cpp") - else () - add_executable(${testname} "${testname}.cpp") + set(SOURCES "${testname}.cpp") + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testname}.h") + list(APPEND SOURCES "${testname}.h") + endif () + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testname}.qrc") + list(APPEND SOURCES "${testname}.qrc") endif () + add_executable(${testname} ${SOURCES}) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${apiextractor_SOURCE_DIR} @@ -35,8 +40,6 @@ declare_test(testabstractmetatype) declare_test(testaddfunction) declare_test(testarrayargument) declare_test(testcodeinjection) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/utf8code.txt" - "${CMAKE_CURRENT_BINARY_DIR}/utf8code.txt" COPYONLY) declare_test(testcontainer) declare_test(testconversionoperator) declare_test(testconversionruletag) @@ -68,7 +71,5 @@ declare_test(testvoidarg) declare_test(testtyperevision) if (NOT DISABLE_DOCSTRINGS) declare_test(testmodifydocumentation) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/a.xml" - "${CMAKE_CURRENT_BINARY_DIR}/a.xml" COPYONLY) endif() diff --git a/sources/shiboken2/ApiExtractor/tests/testcodeinjection.cpp b/sources/shiboken2/ApiExtractor/tests/testcodeinjection.cpp index bf1057ee9..68da25373 100644 --- a/sources/shiboken2/ApiExtractor/tests/testcodeinjection.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testcodeinjection.cpp @@ -40,13 +40,11 @@ void TestCodeInjections::testReadFileUtf8() int argc = 0; char *argv[] = {NULL}; QCoreApplication app(argc, argv); - QString filePath = QDir::currentPath(); QString xmlCode = QLatin1String("\ <typesystem package=\"Foo\">\n\ <value-type name='A'>\n\ - <conversion-rule file='") + filePath + QLatin1String("/utf8code.txt'/>\n\ - <inject-code class='target' file='") + filePath - + QLatin1String("/utf8code.txt'/>\n\ + <conversion-rule file=':/utf8code.txt'/>\n\ + <inject-code class='target' file=':/utf8code.txt'/>\n\ </value-type>\n\ <value-type name='A::B'/>\n\ </typesystem>\n"); diff --git a/sources/shiboken2/ApiExtractor/tests/testcodeinjection.qrc b/sources/shiboken2/ApiExtractor/tests/testcodeinjection.qrc new file mode 100644 index 000000000..61d59567b --- /dev/null +++ b/sources/shiboken2/ApiExtractor/tests/testcodeinjection.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource> + <file>utf8code.txt</file> + </qresource> +</RCC> diff --git a/sources/shiboken2/ApiExtractor/tests/testmodifydocumentation.cpp b/sources/shiboken2/ApiExtractor/tests/testmodifydocumentation.cpp index 7911a5eb1..f615befb4 100644 --- a/sources/shiboken2/ApiExtractor/tests/testmodifydocumentation.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testmodifydocumentation.cpp @@ -60,7 +60,7 @@ R"(<typesystem package="Foo"> QCOMPARE(docMods[1].code().trimmed(), QLatin1String("<para>Some changed contents here</para>")); QCOMPARE(docMods[1].signature(), QString()); QtDocParser docParser; - docParser.setDocumentationDataDirectory(QDir::currentPath()); + docParser.setDocumentationDataDirectory(QLatin1String(":")); docParser.fillDocumentation(classA); const QString actualDocSimplified = classA->documentation().value().simplified(); diff --git a/sources/shiboken2/ApiExtractor/tests/testmodifydocumentation.qrc b/sources/shiboken2/ApiExtractor/tests/testmodifydocumentation.qrc new file mode 100644 index 000000000..76b1bfc61 --- /dev/null +++ b/sources/shiboken2/ApiExtractor/tests/testmodifydocumentation.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource> + <file>a.xml</file> + </qresource> +</RCC> |