aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/integration/usb-manager-test.cpp17
-rw-r--r--tests/unit/usb-snap-test.cpp15
-rw-r--r--tests/utils/qdbus-helpers.h21
3 files changed, 24 insertions, 29 deletions
diff --git a/tests/integration/usb-manager-test.cpp b/tests/integration/usb-manager-test.cpp
index aca5325..5e3377d 100644
--- a/tests/integration/usb-manager-test.cpp
+++ b/tests/integration/usb-manager-test.cpp
@@ -20,9 +20,10 @@
#define QT_NO_KEYWORDS
#include <tests/utils/adbd-server.h>
-#include <tests/utils/glib-fixture.h>
#include <tests/utils/dbus-types.h>
+#include <tests/utils/glib-fixture.h>
#include <tests/utils/gtest-qt-print-helpers.h>
+#include <tests/utils/qdbus-helpers.h>
#include <src/usb-manager.h>
@@ -78,20 +79,6 @@ protected:
delete s;
}
- bool qDBusArgumentToMap(QVariant const& variant, QVariantMap& map)
- {
- if (variant.canConvert<QDBusArgument>())
- {
- QDBusArgument value(variant.value<QDBusArgument>());
- if (value.currentType() == QDBusArgument::MapType)
- {
- value >> map;
- return true;
- }
- }
- return false;
- }
-
void SetUp() override
{
super::SetUp();
diff --git a/tests/unit/usb-snap-test.cpp b/tests/unit/usb-snap-test.cpp
index 84555cc..e8f8bb2 100644
--- a/tests/unit/usb-snap-test.cpp
+++ b/tests/unit/usb-snap-test.cpp
@@ -19,6 +19,7 @@
#define QT_NO_KEYWORDS
#include <tests/utils/dbus-types.h>
+#include <tests/utils/qdbus-helpers.h>
#include <tests/utils/glib-fixture.h>
#include <tests/utils/gtest-qt-print-helpers.h>
@@ -64,20 +65,6 @@ public:
protected:
- bool qDBusArgumentToMap(QVariant const& variant, QVariantMap& map)
- {
- if (variant.canConvert<QDBusArgument>())
- {
- QDBusArgument value(variant.value<QDBusArgument>());
- if (value.currentType() == QDBusArgument::MapType)
- {
- value >> map;
- return true;
- }
- }
- return false;
- }
-
void SetUp() override
{
super::SetUp();
diff --git a/tests/utils/qdbus-helpers.h b/tests/utils/qdbus-helpers.h
new file mode 100644
index 0000000..f873e23
--- /dev/null
+++ b/tests/utils/qdbus-helpers.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#define QT_NO_KEYWORDS
+#include <QDBusArgument>
+#include <QVariant>
+
+bool qDBusArgumentToMap(QVariant const& variant, QVariantMap& map)
+{
+ if (variant.canConvert<QDBusArgument>())
+ {
+ QDBusArgument value(variant.value<QDBusArgument>());
+ if (value.currentType() == QDBusArgument::MapType)
+ {
+ value >> map;
+ return true;
+ }
+ }
+
+ return false;
+}
+