diff options
author | David Edmundson <davidedmundson@kde.org> | 2014-11-21 14:54:33 +0100 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2015-01-05 12:29:14 +0100 |
commit | 54079de9f9968513a741eeceb2a24c2fd2ddbb96 (patch) | |
tree | e045615a3ff753506d91a9f021c4f000f9599271 /tests/auto | |
parent | aeceb5e383c2c2946dd09dc70136cb905481b924 (diff) |
Add annotation to rename methods created by qdbusxml2cpp
Under DBus it is possible to have methods and signals with the same name
or have methods which are reserved c++ keywords.
For example the logind session interface has a signal and method both
called Lock.
This patch allows generated methods to use a different method name
specified in the annotation that the original DBus name in the DBus
interface in a similar manner to how one can rename accessors.
[ChangeLog][QtDBus] Add annotation org.qtproject.QtDBus.MethodName to allow
autogenerating C++ methods with different names to the original DBus method
Change-Id: I08bbe77554fbdd348e93f82d45bab0d75d360c27
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp b/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp index eac61a38b8..f6e4e3bdd9 100644 --- a/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp +++ b/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp @@ -160,6 +160,16 @@ void tst_qdbusxml2cpp::process_data() .arg(basicTypeList[i].cppType), QRegularExpression::DotMatchesEverythingOption); } + QTest::newRow("method-name") + << "<method name=\"Method\">" + "<arg type=\"s\" direction=\"in\"/>" + "<annotation name=\"org.qtproject.QtDBus.MethodName\" value=\"MethodRenamed\" />" + "</method>" + << QRegularExpression("Q_SLOTS:.*QDBusPendingReply<> MethodRenamed\\(const QString &\\w*", + QRegularExpression::DotMatchesEverythingOption) + << QRegularExpression("Q_SLOTS:.*void MethodRenamed\\(const QString &\\w*", + QRegularExpression::DotMatchesEverythingOption); + QTest::newRow("method-complex") << "<method name=\"Method\">" "<arg type=\"(dd)\" direction=\"in\"/>" |