diff options
author | Alex Merry <dev@randomguy3.me.uk> | 2011-10-29 19:49:57 +0200 |
---|---|---|
committer | Alex Merry <dev@randomguy3.me.uk> | 2011-10-29 19:49:57 +0200 |
commit | 3a853f050b5e253323eba30090803665f738afd8 (patch) | |
tree | 6a69aaa7e6fe11c4468bbcd9ee5e42db7f79370e /mpris2 | |
parent | 0e465c8e07a45778837757d5cf1e05a8f5a331b4 (diff) |
A working root interface test
Diffstat (limited to 'mpris2')
-rw-r--r-- | mpris2/interfacetest.cpp | 5 | ||||
-rw-r--r-- | mpris2/interfacetest.h | 6 | ||||
-rw-r--r-- | mpris2/rootinterfacetest.cpp | 10 | ||||
-rw-r--r-- | mpris2/roottestwidget.cpp | 5 | ||||
-rw-r--r-- | mpris2/testconsole.h | 6 |
5 files changed, 18 insertions, 14 deletions
diff --git a/mpris2/interfacetest.cpp b/mpris2/interfacetest.cpp index b6ebb62..4df0d59 100644 --- a/mpris2/interfacetest.cpp +++ b/mpris2/interfacetest.cpp @@ -23,6 +23,7 @@ #include "interfacetest.h" #include <QtDBus> +#include <QDebug> #include <QTimer> using namespace Mpris2; @@ -131,6 +132,8 @@ bool InterfaceTest::checkPropValid(const QString& propName, QVariant::Type expTy } else if (oldProps.contains(propName)) { // FIXME: QVariant equality only works for builtin types if (props[propName] != oldProps[propName]) { + qDebug() << "Old value:" << oldProps[propName]; + qDebug() << "New value:" << props[propName]; outOfDateProperties.insert(propName, props[propName]); props[propName] = oldProps[propName]; } @@ -159,6 +162,8 @@ void InterfaceTest::initialTest() QDBusConnection::sessionBus().connect(iface->service(), iface->path(), iface->interface(), "propertiesChanged", /* signature, */ this, SLOT( _m_propertiesChanged(QString,QVariantMap,QStringList))); + + emit propertiesChanged(properties().keys()); } void InterfaceTest::incrementalTest() diff --git a/mpris2/interfacetest.h b/mpris2/interfacetest.h index 38f9627..0d2da75 100644 --- a/mpris2/interfacetest.h +++ b/mpris2/interfacetest.h @@ -72,7 +72,7 @@ namespace Mpris2 * * @param desc a user-readable description of the error */ - void interfaceError(LocationType locType, const QString& location, const QString& desc); + void interfaceError(Mpris2::InterfaceTest::LocationType locType, const QString& location, const QString& desc); /** * Reports that there might be a problem with the interface. @@ -83,7 +83,7 @@ namespace Mpris2 * * @param desc a user-readable description of the warning */ - void interfaceWarning(LocationType locType, const QString& location, const QString& desc); + void interfaceWarning(Mpris2::InterfaceTest::LocationType locType, const QString& location, const QString& desc); /** * Reports salient information about the testing. @@ -97,7 +97,7 @@ namespace Mpris2 * needs to check something worked as expected (because it * can't be checked directly in the interface). */ - void interfaceInfo(LocationType locType, const QString& location, const QString& desc); + void interfaceInfo(Mpris2::InterfaceTest::LocationType locType, const QString& location, const QString& desc); /** * Reports that some properties have changed. diff --git a/mpris2/rootinterfacetest.cpp b/mpris2/rootinterfacetest.cpp index 095d375..7359fa0 100644 --- a/mpris2/rootinterfacetest.cpp +++ b/mpris2/rootinterfacetest.cpp @@ -25,7 +25,7 @@ using namespace Mpris2; RootInterfaceTest::RootInterfaceTest(const QString& service, QObject* parent) - : InterfaceTest(service, MPRIS2_ROOT_IFACE, parent) + : InterfaceTest(MPRIS2_ROOT_IFACE, service, parent) { } @@ -53,8 +53,8 @@ void RootInterfaceTest::checkPropertyDesktopEntry(const QVariantMap& oldProps) void RootInterfaceTest::checkPropertySupportedUriSchemes(const QVariantMap& oldProps) { - if (checkPropValid("SupportedUriSchemes", QVariant::Map, oldProps)) { - QVariantMap uriSchemes = props["SupportedUriSchemes"].toMap(); + if (checkPropValid("SupportedUriSchemes", QVariant::StringList, oldProps)) { + QStringList uriSchemes = props["SupportedUriSchemes"].toStringList(); if (!uriSchemes.contains("file")) { emit interfaceWarning(Property, "SupportedUriSchemes", "\"file\" is not listed as a supported URI scheme (this is unusual)"); } @@ -64,8 +64,8 @@ void RootInterfaceTest::checkPropertySupportedUriSchemes(const QVariantMap& oldP void RootInterfaceTest::checkPropertySupportedMimeTypes(const QVariantMap& oldProps) { - if (checkPropValid("SupportedMimeTypes", QVariant::Map, oldProps)) { - QVariantMap mimeTypes = props["SupportedMimeTypes"].toMap(); + if (checkPropValid("SupportedMimeTypes", QVariant::StringList, oldProps)) { + QStringList mimeTypes = props["SupportedMimeTypes"].toStringList(); if (mimeTypes.isEmpty()) { emit interfaceWarning(Property, "SupportedMimeTypes", "The media player claims not to support any mime types"); } diff --git a/mpris2/roottestwidget.cpp b/mpris2/roottestwidget.cpp index 08685a6..42c9d52 100644 --- a/mpris2/roottestwidget.cpp +++ b/mpris2/roottestwidget.cpp @@ -31,6 +31,8 @@ RootTestWidget::RootTestWidget(RootInterfaceTest *test, QWidget *parent) this->test, SLOT(testRaise())); connect(ui.quitBtn, SIGNAL(clicked(bool)), this->test, SLOT(testQuit())); + connect(test, SIGNAL(propertiesChanged(QStringList)), + this, SLOT(propertiesChanged(QStringList))); } RootTestWidget::~RootTestWidget() @@ -40,9 +42,6 @@ RootTestWidget::~RootTestWidget() void RootTestWidget::runInitialTest() { test->initialTest(); - ui.raiseBtn->setEnabled(true); - ui.quitBtn->setEnabled(true); - updateProperties(); } void RootTestWidget::runIncrementalTest() diff --git a/mpris2/testconsole.h b/mpris2/testconsole.h index b530dd8..4ac3039 100644 --- a/mpris2/testconsole.h +++ b/mpris2/testconsole.h @@ -35,9 +35,9 @@ namespace Mpris2 virtual ~TestConsole(); public slots: - void interfaceError(InterfaceTest::LocationType locType, const QString& location, const QString& desc); - void interfaceWarning(InterfaceTest::LocationType locType, const QString& location, const QString& desc); - void interfaceInfo(InterfaceTest::LocationType locType, const QString& location, const QString& desc); + void interfaceError(Mpris2::InterfaceTest::LocationType locType, const QString& location, const QString& desc); + void interfaceWarning(Mpris2::InterfaceTest::LocationType locType, const QString& location, const QString& desc); + void interfaceInfo(Mpris2::InterfaceTest::LocationType locType, const QString& location, const QString& desc); private: QTextEdit* edit; |