diff options
author | Rainer Keller <Rainer.Keller@qt.io> | 2019-03-01 16:02:22 +0100 |
---|---|---|
committer | Rainer Keller <Rainer.Keller@qt.io> | 2019-03-05 07:23:08 +0000 |
commit | e93c6d13952831a74f2376b8a6369c0b7cd10d26 (patch) | |
tree | f4d77e94be91450a9d628dd786cb66ce41cf4d19 | |
parent | 576d8d1a1340b53f354bbf336bddf6494b74df68 (diff) |
qml: Provide global information server security support
Change-Id: I6b60a0bfd018c41045f09fa0608cd9de58f59082
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
-rw-r--r-- | tests/auto/declarative/declarative.pro | 4 | ||||
-rw-r--r-- | tests/auto/declarative/tst_opcua.cpp | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 35ac792..cebe679 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -5,3 +5,7 @@ SOURCES += tst_opcua.cpp HEADERS += $$PWD/../../common/backend_environment.h INCLUDEPATH += $$PWD/../../common IMPORTPATH += $$PWD/../../../src/plugins/declarative + +# This tries to check if the server has security support +QT += opcua_private +qtConfig(mbedtls): DEFINES += SERVER_SUPPORTS_SECURITY diff --git a/tests/auto/declarative/tst_opcua.cpp b/tests/auto/declarative/tst_opcua.cpp index 23f3dd2..b4b5c86 100644 --- a/tests/auto/declarative/tst_opcua.cpp +++ b/tests/auto/declarative/tst_opcua.cpp @@ -38,11 +38,11 @@ #include <QtQuickTest/quicktest.h> #include <QObject> #include <QProcess> +#include <QQmlContext> +#include <QQmlEngine> #include <QTcpServer> #include <QTcpSocket> -class QQmlEngine; - static QString envOrDefault(const char *env, QString def) { return qEnvironmentVariableIsSet(env) ? qgetenv(env).constData() : def; @@ -111,8 +111,11 @@ public slots: QString port = envOrDefault("OPCUA_PORT", QString::number(defaultPort)); } void qmlEngineAvailable(QQmlEngine *engine) { - Q_UNUSED(engine); - // nothing + bool value = false; +#ifdef SERVER_SUPPORTS_SECURITY + value = true; +#endif + engine->rootContext()->setContextProperty("SERVER_SUPPORTS_SECURITY", value); } void cleanupTestCase() { if (m_serverProcess.state() == QProcess::Running) { |