diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2016-03-10 17:09:59 -0600 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2016-03-10 17:09:59 -0600 |
commit | d8ef8e68805ab7f53258427c79ee5aaafec916ba (patch) | |
tree | 9d3b9afff38739829f41dc6c8ee327ccbafdb96b /tests/utils/gtest-qt-print-helpers.h | |
parent | f8a5d99b5ac03b5b759f67b33ed2c989fc0d0ceb (diff) | |
download | ayatana-indicator-display-d8ef8e68805ab7f53258427c79ee5aaafec916ba.tar.gz ayatana-indicator-display-d8ef8e68805ab7f53258427c79ee5aaafec916ba.tar.bz2 ayatana-indicator-display-d8ef8e68805ab7f53258427c79ee5aaafec916ba.zip |
add UsbManager
Diffstat (limited to 'tests/utils/gtest-qt-print-helpers.h')
-rw-r--r-- | tests/utils/gtest-qt-print-helpers.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/utils/gtest-qt-print-helpers.h b/tests/utils/gtest-qt-print-helpers.h new file mode 100644 index 0000000..7a0897e --- /dev/null +++ b/tests/utils/gtest-qt-print-helpers.h @@ -0,0 +1,45 @@ + +#pragma once + +#include <QDBusObjectPath> +#include <QString> +#include <QStringList> +#include <QVariant> + +inline QString qVariantToString(const QVariant& variant) { + QString output; + QDebug dbg(&output); + dbg << variant; + return output; +} + +inline void PrintTo(const QVariant& variant, std::ostream* os) { + QString output; + QDebug dbg(&output); + dbg << variant; + + *os << "QVariant(" << output.toStdString() << ")"; +} + +inline void PrintTo(const QString& s, std::ostream* os) { + *os << "\"" << s.toStdString() << "\""; +} + +inline void PrintTo(const QStringList& list, std::ostream* os) { + QString output; + QDebug dbg(&output); + dbg << list; + + *os << "QStringList(" << output.toStdString() << ")"; +} + +inline void PrintTo(const QList<QDBusObjectPath>& list, std::ostream* os) { + QString output; + for (const auto& path: list) + { + output.append("\"" + path.path() + "\","); + } + + *os << "QList<QDBusObjectPath>(" << output.toStdString() << ")"; +} + |