diff options
author | Jannis Voelker <jannis.voelker@basyskom.com> | 2018-04-03 11:58:24 +0200 |
---|---|---|
committer | Frank Meerkoetter <frank.meerkoetter@basyskom.com> | 2018-04-05 18:12:00 +0000 |
commit | 39657dc15542f292e707869307fb2d86df7bd780 (patch) | |
tree | 4a972a77ff36acb5ee1aa9e6d51613d733ee5a76 | |
parent | d3eb70ec825005c922ccee920de2c0043edc1137 (diff) |
Test usage of the valueAttributeType parameter in all backends
Some types require type information for correct conversion from the
Qt type to the OPC UA type.
This patch changes the writeMultipleAttributes() test to use a type which
requires type information to make sure all backends use that parameter.
Change-Id: I5df4ab1f673562288971477305f2ce98931ed631
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
-rw-r--r-- | tests/auto/qopcuaclient/tst_client.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/auto/qopcuaclient/tst_client.cpp b/tests/auto/qopcuaclient/tst_client.cpp index 7276d0c..c947a06 100644 --- a/tests/auto/qopcuaclient/tst_client.cpp +++ b/tests/auto/qopcuaclient/tst_client.cpp @@ -477,18 +477,16 @@ void Tst_QOpcUaClient::writeMultipleAttributes() QFETCH(QOpcUaClient *, opcuaClient); OpcuaConnector connector(opcuaClient, m_endpoint); - QScopedPointer<QOpcUaNode> node(opcuaClient->node(readWriteNode)); + QScopedPointer<QOpcUaNode> node(opcuaClient->node("ns=2;s=Demo.Static.Scalar.QualifiedName")); QVERIFY(node != 0); - WRITE_VALUE_ATTRIBUTE(node, QVariant(double(0)), QOpcUa::Types::Double); - QOpcUaNode::AttributeMap map; - map[QOpcUa::NodeAttribute::DisplayName] = QVariant(QLatin1String("NewDisplayName")); - map[QOpcUa::NodeAttribute::Value] = QVariant(double(23.5)); + map[QOpcUa::NodeAttribute::DisplayName] = QVariant::fromValue(QOpcUa::QLocalizedText(QStringLiteral("en"), QStringLiteral("NewDisplayName"))); + map[QOpcUa::NodeAttribute::Value] = QVariant::fromValue(QOpcUa::QQualifiedName(2, QStringLiteral("TestString"))); QSignalSpy writeSpy(node.data(), &QOpcUaNode::attributeWritten); - node->writeAttributes(map); + node->writeAttributes(map, QOpcUa::Types::QualifiedName); writeSpy.wait(); if (writeSpy.size() < 2) @@ -503,7 +501,7 @@ void Tst_QOpcUaClient::writeMultipleAttributes() QVERIFY(writeSpy.at(1).at(0).value<QOpcUa::NodeAttribute>() == QOpcUa::NodeAttribute::Value); QVERIFY(writeSpy.at(1).at(1).value<QOpcUa::UaStatusCode>() == QOpcUa::UaStatusCode::Good); QVERIFY(node->attributeError(QOpcUa::NodeAttribute::Value) == QOpcUa::UaStatusCode::Good); - QVERIFY(node->attribute(QOpcUa::NodeAttribute::Value) == double(23.5)); + QVERIFY(node->attribute(QOpcUa::NodeAttribute::Value).value<QOpcUa::QQualifiedName>() == QOpcUa::QQualifiedName(2, QStringLiteral("TestString"))); } void Tst_QOpcUaClient::getRootNode() |