summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonrad Kujawa <konrad.kujawa@qt.io>2023-06-09 10:49:29 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-06-09 12:05:32 +0000
commitc8e577986ce9f1ff712fefb6280b1b961d6d5796 (patch)
tree95528cc60f946cb7027bf77f823b6e5e79613d92
parentc5177e404860ffc40e7389b9eb433ce78d43ae07 (diff)
Fix failing test when QtGRPC is configured without Qml dependencyv6.6.0-beta1
Fixes: QTBUG-114409 Change-Id: Ic1baba43fd9d78f956e8595b814200bc934b5598 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 65f5d590edd044a798b1bf7dc2e9f16ff4f0b70c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/protobufgen/CMakeLists.txt4
-rw-r--r--tests/auto/protobufgen/tst_qtprotobufgen.cpp14
2 files changed, 13 insertions, 5 deletions
diff --git a/tests/auto/protobufgen/CMakeLists.txt b/tests/auto/protobufgen/CMakeLists.txt
index 1903f10..05b7f10 100644
--- a/tests/auto/protobufgen/CMakeLists.txt
+++ b/tests/auto/protobufgen/CMakeLists.txt
@@ -53,6 +53,10 @@ if(MINGW)
endif()
if(TARGET Qt6::Qml)
+ qt_internal_extend_target(tst_qtprotobufgen
+ DEFINES
+ HAVE_QML
+ )
qt_add_protobuf(tst_qtprotobufgenplugin
PROTO_FILES
../shared/data/proto/nopackage.proto
diff --git a/tests/auto/protobufgen/tst_qtprotobufgen.cpp b/tests/auto/protobufgen/tst_qtprotobufgen.cpp
index 1bfa85d..95258d4 100644
--- a/tests/auto/protobufgen/tst_qtprotobufgen.cpp
+++ b/tests/auto/protobufgen/tst_qtprotobufgen.cpp
@@ -15,7 +15,7 @@
using namespace Qt::StringLiterals;
const QLatin1StringView protobuftyperegistrations("_protobuftyperegistrations.cpp");
-const QLatin1StringView protobufQmlPlugin("_uri_testplugin.cpp");
+[[maybe_unused]] const QLatin1StringView protobufQmlPlugin("_uri_testplugin.cpp");
const QLatin1StringView cppExtension(".qpb.cpp");
const QLatin1StringView headerExtension(".qpb.h");
const QLatin1StringView protocGenQtprotobufKey(" --plugin=protoc-gen-qtprotobuf=");
@@ -241,17 +241,19 @@ void tst_qtprotobufgen::cmakeGeneratedFile_data()
<< "extranamespace"
<< "/extra-namespace/"
<< QString(extension);
-
+#ifdef HAVE_QML
QTest::addRow("nopackage%s", extension.data())
<< "nopackage"
<< "/qml-no-package/"
<< QString(extension);
+#endif
}
-
+#ifdef HAVE_QML
QTest::addRow("nopackage%s", protobufQmlPlugin.data())
<< "nopackage"
<< "/qml-no-package/"
<< QString(protobufQmlPlugin);
+#endif
}
void tst_qtprotobufgen::cmakeGeneratedFile()
@@ -348,21 +350,23 @@ void tst_qtprotobufgen::cmdLineGeneratedFile_data()
<< "/extra-namespace/"
<< QString(extension)
<< "";
-
+#ifdef HAVE_QML
QTest::addRow("nopackage%s", extension.data())
<< "nopackage"
<< "QML_URI=nopackage.uri.test;EXPORT_MACRO=TST_QTPROTOBUFGENPLUGIN"
<< "/qml-no-package/"
<< QString(extension)
<< "";
+#endif
}
-
+#ifdef HAVE_QML
QTest::addRow("nopackage%s", protobufQmlPlugin.data())
<< "nopackage"
<< "QML_URI=nopackage.uri.test;EXPORT_MACRO=TST_QTPROTOBUFGENPLUGIN"
<< "/qml-no-package/"
<< QString(protobufQmlPlugin)
<< "";
+#endif
}
void tst_qtprotobufgen::cmdLineGeneratedFile()