autopilot-qt-1.4+15.10.20150825/0000755000015300001610000000000012567022276016365 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/driver/0000755000015300001610000000000012567022276017660 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/driver/qttestability.h0000644000015300001610000000047112567021612022726 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #ifndef QTTESTABILITY_H #define QTTESTABILITY_H extern "C" void qt_testability_init(void); #endif autopilot-qt-1.4+15.10.20150825/driver/rootnode.h0000644000015300001610000000104312567021612021651 0ustar pbuserpbgroup00000000000000#ifndef ROOTNODE_H #define ROOTNODE_H #include "qtnode.h" #include class QCoreApplication; class QObject; class RootNode: public QObjectNode { public: RootNode(QCoreApplication* application); virtual NodeIntrospectionData GetIntrospectionData() const; void AddChild(QObject* child); virtual std::string GetName() const; virtual std::string GetPath() const; virtual xpathselect::NodeVector Children() const; private: QCoreApplication* application_; QList children_; }; #endif // ROOTNODE_H autopilot-qt-1.4+15.10.20150825/driver/dbus_object.cpp0000644000015300001610000002254612567021612022651 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #include "dbus_object.h" #include "introspection.h" #include "qtnode.h" #include #include #include #ifdef QT5_SUPPORT #include #else #include #endif #include #include DBusNode::Ptr GetNodeWithId(int object_id) { QString query = QString("//*[id=%1]").arg(object_id); QList objects = GetNodesThatMatchQuery(query); if (objects.isEmpty()) { qWarning() << "No Object with with id" << object_id << "found in object tree."; return DBusNode::Ptr(); } return objects.at(0); } DBusObject::DBusObject(QObject *parent) : QObject(parent) { } void DBusObject::GetState(const QString &piece, const QDBusMessage &msg) { _queries.append(Query(piece, msg)); // We need to surrender to the Qt event loop, so we do the processing // via a queued slot connection: QMetaObject::invokeMethod( this, "ProcessQuery", Qt::QueuedConnection ); } void DBusObject::RegisterSignalInterest(int object_id, QString signal_name) { SignalId signal(object_id, signal_name); if (signal_watchers_.contains(signal)) { qDebug() << "Already watching signal" << signal_name << "on object with id" << object_id; return; } QObjectNode::Ptr node = std::dynamic_pointer_cast(GetNodeWithId(object_id)); if (! node) { qWarning() << "Unable to register signal interest."; return; } QObject* obj = node->getWrappedObject(); QString munged_signal_name = QString("2%1").arg(signal_name); SignalSpyPtr signal_spy(new QSignalSpy(obj, munged_signal_name.toLocal8Bit().data())); if (signal_spy->isValid()) { signal_watchers_[signal] = signal_spy; qDebug() << "Now watching for emissions of the" << signal_name << "signal on object with id" << object_id; } else { qWarning() << "Signal name was not vlaid."; } } void DBusObject::GetSignalEmissions(int object_id, QString signal_name, const QDBusMessage &message) { QDBusMessage reply = message.createReply(); SignalId signal(object_id, signal_name); if (signal_watchers_.contains(signal)) { SignalSpyPtr signal_spy = signal_watchers_[signal]; QList signal_emit_list; qDebug() << "Signal emissions" << signal_spy.data()->length() << signal_spy.data(); for (int i = 0; i < signal_spy->length(); ++i) { QList signal_emission; foreach(const QVariant &arg, signal_spy->at(i)) { // We cannot marshall QObject* or QObject: // Marshalling a pointer through DBus makes no sense as its just an address to protected memory // Marshalling a QObject (without pointer) is not possible because of QObjects no-copy-nature if((int)arg.type() != (int)QMetaType::QObjectStar) { signal_emission.append(arg); } } signal_emit_list.append(QVariant(signal_emission)); } reply << QVariant(signal_emit_list); } else { qDebug() << "That signal was never registered for watching."; } if (QDBusConnection::sessionBus().send(reply)) qDebug("Reply sent."); else qDebug("Error on reply send."); } void DBusObject::ListSignals(int object_id, const QDBusMessage& message) { QObjectNode::Ptr node = std::dynamic_pointer_cast(GetNodeWithId(object_id)); QDBusMessage reply = message.createReply(); if (! node) { qWarning() << "Unable to list signals."; } else { QObject *object = node->getWrappedObject(); const QMetaObject *meta = object->metaObject(); QList signal_list; do { for (int i = meta->methodOffset(); i < meta->methodCount(); ++i) { QMetaMethod method = meta->method(i); if (method.methodType() == QMetaMethod::Signal) { #ifdef QT5_SUPPORT QString signature = QString::fromLatin1(method.methodSignature()); #else QString signature = QString::fromLatin1(method.signature()); #endif signal_list.append(QVariant(signature)); } } meta = meta->superClass(); } while(meta); reply << QVariant(signal_list); } QDBusConnection::sessionBus().send(reply); } void DBusObject::ListMethods(int object_id, const QDBusMessage &message) { QDBusMessage reply = message.createReply(); QObjectNode::Ptr node = std::dynamic_pointer_cast(GetNodeWithId(object_id)); if (! node) { qWarning() << "No Object found while listing methods."; } else { QObject *object = node->getWrappedObject(); const QMetaObject *meta = object->metaObject(); QList method_list; do { for (int i = meta->methodOffset(); i < meta->methodCount(); ++i) { QMetaMethod method = meta->method(i); if (method.methodType() == QMetaMethod::Slot || method.methodType() == QMetaMethod::Method) { #ifdef QT5_SUPPORT QString signature = QString::fromLatin1(method.methodSignature()); #else QString signature = QString::fromLatin1(method.signature()); #endif method_list.append(QVariant(signature)); } } meta = meta->superClass(); } while(meta); reply << QVariant(method_list); } QDBusConnection::sessionBus().send(reply); } void DBusObject::InvokeMethod(int object_id, QString method_name, QVariantList args, const QDBusMessage &message) { Q_UNUSED(message); QObjectNode::Ptr node = std::dynamic_pointer_cast(GetNodeWithId(object_id)); if (! node) { qWarning() << "No Object found."; return; } QObject *object = node->getWrappedObject(); const QMetaObject *meta = object->metaObject(); int method_index = -1; do { method_index = meta->indexOfMethod(method_name.toLocal8Bit()); if (method_index == -1) meta = meta->superClass(); } while(meta && method_index == -1); if (method_index == -1) { qWarning() << "Unable to find method" << method_name << "On object with id" << object_id; return; } QMetaMethod method = meta->method(method_index); qDebug() << "Method parameter names:" << method.parameterNames(); qDebug() << "Method parameter types:" << method.parameterTypes(); #ifdef QT5_SUPPORT qDebug() << "Method signature:" << method.methodSignature() << "return type:" << method.typeName(); #else qDebug() << "Method signature:" << method.signature() << "return type:" << method.typeName(); #endif QVector generic_args(10); QList parameterTypes = method.parameterTypes(); if (args.size() != parameterTypes.size()) { qCritical() << "Method takes" << parameterTypes.size() << "Arguments, but" << args.size() << "arguments were provided instead. Not calling method."; return; } for (int i = 0; i < args.size(); ++i) { QVariant passed_value = args.at(i); QByteArray passed_type_name = passed_value.typeName(); QByteArray required_type_name = parameterTypes.at(i); // Special treatment for QVariants as the target type if (required_type_name == "QVariant") { generic_args[i] = Q_ARG(QVariant, args.at(i)); continue; } if (passed_type_name != required_type_name) { // TODO - try and convert to correct type... if it's needed. qCritical() << "Argument" << i << "Is of the wrong type."; qCritical() << " Expected:" << required_type_name; qCritical() << " Got:" << passed_type_name; break; } generic_args[i] = QGenericArgument(passed_type_name, passed_value.constData()); } // method.invoke(...) takes between 0 and 10 parameters. Since We can't convert a QVector into // an argument list (like we can in Python), I'm stuck with this terrible syntax: bool ret = method.invoke(object, generic_args.at(0), generic_args.at(1), generic_args.at(2), generic_args.at(3), generic_args.at(4), generic_args.at(5), generic_args.at(6), generic_args.at(7), generic_args.at(8), generic_args.at(9)); if (ret) qDebug() << "Method Invoked."; else qDebug() << "Method invocation failed."; } void DBusObject::ProcessQuery() { Query query = _queries.takeFirst(); QList state = Introspect(query.first); QDBusMessage msg = query.second; QVariant var; var.setValue(state); msg << var; QDBusConnection::sessionBus().send(msg); } autopilot-qt-1.4+15.10.20150825/driver/rootnode.cpp0000644000015300001610000000241712567021612022212 0ustar pbuserpbgroup00000000000000#include "rootnode.h" #include "introspection.h" #include #include #include #include RootNode::RootNode(QCoreApplication* application) : QObjectNode(application) , application_(application) { } NodeIntrospectionData RootNode::GetIntrospectionData() const { NodeIntrospectionData data; data.object_path = QString::fromStdString(GetPath()); data.state = GetNodeProperties(application_); QStringList child_names; foreach(QObject* child, children_) { child_names.append(child->metaObject()->className()); } data.state["Children"] = PackProperty(child_names); data.state["id"] = PackProperty(GetId()); return data; } void RootNode::AddChild(QObject* child) { children_.append(child); } std::string RootNode::GetName() const { QString appName = application_->applicationName().remove(' ').remove('.'); return appName.isEmpty() ? "Root" : appName.toStdString(); } std::string RootNode::GetPath() const { return "/" + GetName(); } xpathselect::NodeVector RootNode::Children() const { xpathselect::NodeVector children; foreach(QObject* child, children_) children.push_back(std::make_shared(child, shared_from_this())); return children; } autopilot-qt-1.4+15.10.20150825/driver/dbus_adaptor_qt.cpp0000644000015300001610000000412612567021612023533 0ustar pbuserpbgroup00000000000000#include "dbus_adaptor_qt.h" #include AutopilotQtSpecificAdaptor::AutopilotQtSpecificAdaptor(QObject *parent) : QDBusAbstractAdaptor(parent) { setAutoRelaySignals(true); } void AutopilotQtSpecificAdaptor::RegisterSignalInterest(int object_id, QString signal_name) { QMetaObject::invokeMethod( parent(), "RegisterSignalInterest", Qt::QueuedConnection, Q_ARG(int, object_id), Q_ARG(QString, signal_name) ); } void AutopilotQtSpecificAdaptor::GetSignalEmissions(int object_id, QString signal_name, const QDBusMessage &message) { message.setDelayedReply(true); QMetaObject::invokeMethod( parent(), "GetSignalEmissions", Qt::QueuedConnection, Q_ARG(int, object_id), Q_ARG(QString, signal_name), Q_ARG(QDBusMessage, message) ); } void AutopilotQtSpecificAdaptor::ListSignals(int object_id, const QDBusMessage& message) { message.setDelayedReply(true); QMetaObject::invokeMethod( parent(), "ListSignals", Qt::QueuedConnection, Q_ARG(int, object_id), Q_ARG(QDBusMessage, message) ); } void AutopilotQtSpecificAdaptor::ListMethods(int object_id, const QDBusMessage& message) { message.setDelayedReply(true); QMetaObject::invokeMethod( parent(), "ListMethods", Qt::QueuedConnection, Q_ARG(int, object_id), Q_ARG(QDBusMessage, message) ); } void AutopilotQtSpecificAdaptor::InvokeMethod(int object_id, QString method_name, QVariantList args, const QDBusMessage &message) { QMetaObject::invokeMethod( parent(), "InvokeMethod", Qt::QueuedConnection, Q_ARG(int, object_id), Q_ARG(QString, method_name), Q_ARG(QVariantList, args), Q_ARG(QDBusMessage, message) ); } autopilot-qt-1.4+15.10.20150825/driver/main.cpp0000644000015300001610000000072512567021612021305 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #include #include #include #include "qttestability.h" int main(int argc, char **argv) { QApplication app(argc, argv); QMainWindow win; win.show(); qt_testability_init(); return app.exec(); } autopilot-qt-1.4+15.10.20150825/driver/qtnode.cpp0000644000015300001610000004763612567021612021667 0ustar pbuserpbgroup00000000000000#include "qtnode.h" #include "introspection.h" #include #ifdef QT5_SUPPORT #include #include #include #include #include #include #else #include #include #endif #include #include #include #include #include #include #include const QByteArray AP_ID_NAME("_autopilot_id"); void CollectSpecialChildren(QObject* object, xpathselect::NodeVector& children, DBusNode::Ptr parent); void GetDataElementChildren(QTableWidget* table, xpathselect::NodeVector& children, DBusNode::Ptr parent); void GetDataElementChildren(QTreeView* tree_view, xpathselect::NodeVector& children, DBusNode::Ptr parent); void GetDataElementChildren(QTreeWidget* tree_widget, xpathselect::NodeVector& children, DBusNode::Ptr parent); void GetDataElementChildren(QListView* list_view, xpathselect::NodeVector& children, DBusNode::Ptr parent); void CollectAllIndices(QModelIndex index, QAbstractItemModel *model, QModelIndexList &collection); QVariant SafePackProperty(QVariant const& prop); bool MatchProperty(QVariantMap const& packed_properties, std::string const& name, QVariant value); // Produce an id suitable for xpathselects' GetId int32_t calculate_ap_id(quint64 big_id) { int32_t high = static_cast(big_id >> 32); int32_t low = static_cast(big_id); return high ^ low; } // Marshall the NodeIntrospectionData data into a D-Bus argument QDBusArgument &operator<<(QDBusArgument &argument, NodeIntrospectionData const& node_data) { argument.beginStructure(); argument << node_data.object_path << node_data.state; argument.endStructure(); return argument; } // Retrieve the NodeIntrospectionData data from the D-Bus argument const QDBusArgument &operator>>(QDBusArgument const& argument, NodeIntrospectionData& node_data) { argument.beginStructure(); argument >> node_data.object_path >> node_data.state; argument.endStructure(); return argument; } void GetDataElementChildren(QTableWidget *table, xpathselect::NodeVector& children, DBusNode::Ptr parent) { QList tablewidgetitems = table->findItems("*", Qt::MatchWildcard|Qt::MatchRecursive); foreach (QTableWidgetItem *item, tablewidgetitems){ children.push_back( std::make_shared(item, parent) ); } } void CollectAllIndices(QModelIndex index, QAbstractItemModel *model, QModelIndexList &collection) { for(int c=0; c < model->columnCount(index); ++c) { for(int r=0; r < model->rowCount(index); ++r) { QModelIndex new_index = model->index(r, c, index); collection.push_back(new_index); if(new_index.isValid() && qHash(new_index) != qHash(index)) { CollectAllIndices(new_index, model, collection); } } } } // Pack property, but return a default blank if the packed property is invalid. QVariant SafePackProperty(QVariant const& prop) { static QVariant blank_default = PackProperty(""); QVariant property_attempt = PackProperty(prop); if(property_attempt.isValid()) return property_attempt; else return blank_default; } bool MatchProperty(QVariantMap const& packed_properties, std::string const& name, QVariant value) { QString qname = QString::fromStdString(name); if (! packed_properties.contains(qname)) return false; // Because the properties are packed, we need the value, not the type. QVariant object_value = qvariant_cast(packed_properties[qname]).at(1); if (value.canConvert(object_value.type())) { value.convert(object_value.type()); return value == object_value; } return false; } void GetDataElementChildren(QTreeView* tree_view, xpathselect::NodeVector& children, DBusNode::Ptr parent) { QAbstractItemModel* abstract_model = tree_view->model(); if(! abstract_model) { qDebug() << "Unable to get element children from QTreeView " << "with objectName '" << tree_view->objectName() << "'. " << "No model found."; return; } QModelIndexList all_indices; for(int c=0; c < abstract_model->columnCount(); ++c) { for(int r=0; r < abstract_model->rowCount(); ++r) { QModelIndex index = abstract_model->index(r, c); all_indices.push_back(index); CollectAllIndices(index, abstract_model, all_indices); } } foreach(QModelIndex index, all_indices) { if(index.isValid()) { children.push_back( std::make_shared( index, tree_view, parent) ); } } } void GetDataElementChildren(QTreeWidget* tree_widget, xpathselect::NodeVector& children, DBusNode::Ptr parent) { for(int i=0; i < tree_widget->topLevelItemCount(); ++i) { children.push_back( std::make_shared( tree_widget->topLevelItem(i), parent) ); } } void GetDataElementChildren(QListView* list_view, xpathselect::NodeVector& children, DBusNode::Ptr parent) { QAbstractItemModel* abstract_model = list_view->model(); if(! abstract_model) { qDebug() << "Unable to get element children from QListView " << "with objectName '" << list_view->objectName() << "'. " << "No model found."; return; } QModelIndexList all_indices; QModelIndex root_index = list_view->rootIndex(); if(root_index.isValid()) { // The root item is the parent item to the view's toplevel items CollectAllIndices(root_index, abstract_model, all_indices); } else { for(int c=0; c < abstract_model->columnCount(); ++c) { for(int r=0; r < abstract_model->rowCount(); ++r) { QModelIndex index = abstract_model->index(r, c); all_indices.push_back(index); CollectAllIndices(index, abstract_model, all_indices); } } } foreach(QModelIndex index, all_indices) { if(index.isValid()) { children.push_back( std::make_shared( index, list_view, parent) ); } } } QObjectNode::QObjectNode(QObject *obj, DBusNode::Ptr parent) : object_(obj) , parent_(parent) { std::string parent_path = parent ? parent->GetPath() : ""; full_path_ = parent_path + "/" + GetName(); } QObjectNode::QObjectNode(QObject* obj) : object_(obj) { full_path_ = "/" + GetName(); } QObject* QObjectNode::getWrappedObject() const { return object_; } NodeIntrospectionData QObjectNode::GetIntrospectionData() const { NodeIntrospectionData data; data.object_path = QString::fromStdString(GetPath()); data.state = GetNodeProperties(object_); data.state["id"] = PackProperty(GetId()); return data; } std::string QObjectNode::GetName() const { QString name = object_->metaObject()->className(); // QML type names get mangled by Qt - they get _QML_N or _QMLTYPE_N appended. if (name.contains('_')) name = name.split('_').front(); return name.toStdString(); } std::string QObjectNode::GetPath() const { return full_path_; } int32_t QObjectNode::GetId() const { // Note: This method is used to assign ids to both the root node (with a QApplication object) and // child nodes. This used to be separate code, but now that we export QApplication properties, // we can use this one method everywhere. static int32_t next_id=0; QList property_names = object_->dynamicPropertyNames(); if (!property_names.contains(AP_ID_NAME)) { int32_t new_id = ++next_id; object_->setProperty(AP_ID_NAME, QVariant(new_id)); } return qvariant_cast(object_->property(AP_ID_NAME)); } bool QObjectNode::MatchStringProperty(std::string const& name, std::string const& value) const { return MatchProperty(GetNodeProperties(object_), name, QString::fromStdString(value)); } bool QObjectNode::MatchIntegerProperty(std::string const& name, int32_t value) const { if (name == "id") return value == GetId(); return MatchProperty(GetNodeProperties(object_), name, value); } bool QObjectNode::MatchBooleanProperty(std::string const& name, bool value) const { return MatchProperty(GetNodeProperties(object_), name, value); } template bool AttemptGetSpecialChildren(QObject* object, xpathselect::NodeVector& children, DBusNode::Ptr parent) { auto className = T::staticMetaObject.className(); if(object->inherits(className)) { T* table = qobject_cast(object); if(table) { GetDataElementChildren(table, children, parent); } else { qDebug() << "Casting object (with objectName: " << object->objectName() << ") " << "to " << className << "failed. Unable to retrieve children."; return false; } return true; } return false; } void CollectSpecialChildren(QObject* object, xpathselect::NodeVector& children, DBusNode::Ptr parent) { // Need to make sure to make these checks in the correct order. // i.e. Because QTreeWidget inherits from QTreeView do it first otherwise // we would never reach the specific QTreeWidget code. AttemptGetSpecialChildren(object, children, parent) || AttemptGetSpecialChildren(object, children, parent) || AttemptGetSpecialChildren(object, children, parent) || AttemptGetSpecialChildren(object, children, parent); } xpathselect::NodeVector QObjectNode::Children() const { xpathselect::NodeVector children; CollectSpecialChildren(object_, children, shared_from_this()); #ifdef QT5_SUPPORT // Qt5's hierarchy for QML has changed a bit: // - On top there's a QQuickView which holds all the QQuick items // - QQuickItems don't always follow the QObject type hierarchy (e.g. QQuickListView does not), therefore we use the QQuickItem's childItems() // - In case it is not a QQuickItem, fall back to the standard QObject hierarchy QQuickView *view = qobject_cast(object_); if (view && view->rootObject() != 0) { children.push_back(std::make_shared(view->rootObject(), shared_from_this())); } QQuickItem* item = qobject_cast(object_); if (item) { foreach (QQuickItem *childItem, item->childItems()) { if (childItem->parentItem() == item) { children.push_back(std::make_shared(childItem, shared_from_this())); } } } else { foreach (QObject *child, object_->children()) { if (child->parent() == object_) children.push_back(std::make_shared(child, shared_from_this())); } } #else foreach (QObject *child, object_->children()) { if (child->parent() == object_) children.push_back(std::make_shared(child, shared_from_this())); } // If our wrapped object is a QGraphicsScene, we need to explicitly grab any child graphics // items that are derived from QObjects. Declarative UIs use this idiom, so this need to be // done to support QML applications. QGraphicsScene *scene = qobject_cast(object_); if (scene) { QList child_items = scene->items(); foreach(QGraphicsItem* item, child_items) { QGraphicsObject *obj = item->toGraphicsObject(); if (obj && ! obj->parent()) children.push_back(std::make_shared(obj, shared_from_this())); } } #endif return children; } xpathselect::Node::Ptr QObjectNode::GetParent() const { return parent_; } // QModelIndexNode QModelIndexNode::QModelIndexNode(QModelIndex index, QAbstractItemView* parent_view, DBusNode::Ptr parent) : index_(index) , parent_view_(parent_view) , parent_(parent) { std::string parent_path = parent ? parent->GetPath() : ""; full_path_ = parent_path + "/" + GetName(); } NodeIntrospectionData QModelIndexNode::GetIntrospectionData() const { NodeIntrospectionData data; data.object_path = QString::fromStdString(GetPath()); data.state = GetProperties(); data.state["id"] = PackProperty(GetId()); return data; } QVariantMap QModelIndexNode::GetProperties() const { QVariantMap properties; const QAbstractItemModel* model = index_.model(); if(model) { // Make an attempt to store the 'text' of a node to be user friendly-ish. properties["text"] = SafePackProperty(model->data(index_)); // Include any Role data (mung the role name with added "Role") const QHash role_names = model->roleNames(); QMap item_data = model->itemData(index_); foreach(int name, role_names.keys()) { if(item_data.contains(name)) { properties[role_names[name]+"Role"] = SafePackProperty(item_data[name]); } else { properties[role_names[name]+"Role"] = PackProperty(""); } } } QRect rect = parent_view_->visualRect(index_); QRect global_rect( parent_view_->viewport()->mapToGlobal(rect.topLeft()), rect.size()); QRect viewport_contents = parent_view_->viewport()->contentsRect(); properties["onScreen"] = PackProperty(viewport_contents.contains(rect)); properties["globalRect"] = PackProperty(global_rect); return properties; } xpathselect::Node::Ptr QModelIndexNode::GetParent() const { return parent_; } std::string QModelIndexNode::GetName() const { return "QModelIndex"; } std::string QModelIndexNode::GetPath() const { return full_path_; } int32_t QModelIndexNode::GetId() const { return calculate_ap_id(static_cast(qHash(index_))); } bool QModelIndexNode::MatchStringProperty(std::string const& name, std::string const& value) const { return MatchProperty(GetProperties(), name, QString::fromStdString(value)); } bool QModelIndexNode::MatchIntegerProperty(std::string const& name, int32_t value) const { if (name == "id") return value == GetId(); return MatchProperty(GetProperties(), name, value); } bool QModelIndexNode::MatchBooleanProperty(std::string const& name, bool value) const { return MatchProperty(GetProperties(), name, value); } xpathselect::NodeVector QModelIndexNode::Children() const { // Doesn't have any children. xpathselect::NodeVector children; return children; } // QTableWidgetItemNode QTableWidgetItemNode::QTableWidgetItemNode(QTableWidgetItem *item, DBusNode::Ptr parent) : item_(item) , parent_(parent) { std::string parent_path = parent ? parent->GetPath() : ""; full_path_ = parent_path + "/" + GetName(); } NodeIntrospectionData QTableWidgetItemNode::GetIntrospectionData() const { NodeIntrospectionData data; data.object_path = QString::fromStdString(GetPath()); data.state = GetProperties(); data.state["id"] = PackProperty(GetId()); return data; } QVariantMap QTableWidgetItemNode::GetProperties() const { QVariantMap properties; QTableWidget* parent = item_->tableWidget(); QRect cellrect = parent->visualItemRect(item_); QRect r = QRect(parent->mapToGlobal(cellrect.topLeft()), cellrect.size()); properties["globalRect"] = PackProperty(r); properties["text"] = SafePackProperty(PackProperty(item_->text())); properties["toolTip"] = SafePackProperty(PackProperty(item_->toolTip())); properties["icon"] = SafePackProperty(PackProperty(item_->icon())); properties["whatsThis"] = SafePackProperty(PackProperty(item_->whatsThis())); properties["row"] = SafePackProperty(PackProperty(item_->row())); properties["isSelected"] = SafePackProperty(PackProperty(item_->isSelected())); properties["column"] = SafePackProperty(PackProperty(item_->column())); return properties; } xpathselect::Node::Ptr QTableWidgetItemNode::GetParent() const { return parent_; } std::string QTableWidgetItemNode::GetName() const { return "QTableWidgetItem"; } std::string QTableWidgetItemNode::GetPath() const { return full_path_; } int32_t QTableWidgetItemNode::GetId() const { return calculate_ap_id(static_cast(reinterpret_cast(item_))); } bool QTableWidgetItemNode::MatchStringProperty(std::string const& name, std::string const& value) const { return MatchProperty(GetProperties(), name, QString::fromStdString(value)); } bool QTableWidgetItemNode::MatchIntegerProperty(std::string const& name, int32_t value) const { if (name == "id") return value == GetId(); return MatchProperty(GetProperties(), name, value); } bool QTableWidgetItemNode::MatchBooleanProperty(std::string const& name, bool value) const { return MatchProperty(GetProperties(), name, value); } xpathselect::NodeVector QTableWidgetItemNode::Children() const { // Doesn't have any children. xpathselect::NodeVector children; return children; } // QTreeWidgetItemNode QTreeWidgetItemNode::QTreeWidgetItemNode(QTreeWidgetItem *item, DBusNode::Ptr parent) : item_(item) , parent_(parent) { std::string parent_path = parent ? parent->GetPath() : ""; full_path_ = parent_path + "/" + GetName(); } NodeIntrospectionData QTreeWidgetItemNode::GetIntrospectionData() const { NodeIntrospectionData data; data.object_path = QString::fromStdString(GetPath()); data.state = GetProperties(); data.state["id"] = PackProperty(GetId()); return data; } QVariantMap QTreeWidgetItemNode::GetProperties() const { QVariantMap properties; QTreeWidget* parent = item_->treeWidget(); QRect cellrect = parent->visualItemRect(item_); QRect r = QRect(parent->viewport()->mapToGlobal(cellrect.topLeft()), cellrect.size()); properties["globalRect"] = PackProperty(r); properties["text"] = SafePackProperty(item_->text(0)); properties["columns"] = SafePackProperty(item_->columnCount()); properties["checkState"] = SafePackProperty(item_->checkState(0)); properties["isDisabled"] = SafePackProperty(item_->isDisabled()); properties["isExpanded"] = SafePackProperty(item_->isExpanded()); properties["isFirstColumnSpanned"] = SafePackProperty(item_->isFirstColumnSpanned()); properties["isHidden"] = SafePackProperty(item_->isHidden()); properties["isSelected"] = SafePackProperty(item_->isSelected()); return properties; } xpathselect::Node::Ptr QTreeWidgetItemNode::GetParent() const { return parent_; } std::string QTreeWidgetItemNode::GetName() const { return "QTreeWidgetItem"; } std::string QTreeWidgetItemNode::GetPath() const { return full_path_; } int32_t QTreeWidgetItemNode::GetId() const { return calculate_ap_id(static_cast(reinterpret_cast(item_))); } bool QTreeWidgetItemNode::MatchStringProperty(std::string const& name, std::string const& value) const { return MatchProperty(GetProperties(), name, QString::fromStdString(value)); } bool QTreeWidgetItemNode::MatchIntegerProperty(std::string const& name, int32_t value) const { if (name == "id") return value == GetId(); return MatchProperty(GetProperties(), name, value); } bool QTreeWidgetItemNode::MatchBooleanProperty(std::string const& name, bool value) const { return MatchProperty(GetProperties(), name, value); } xpathselect::NodeVector QTreeWidgetItemNode::Children() const { xpathselect::NodeVector children; for(int i=0; i < item_->childCount(); ++i) { children.push_back( std::make_shared(item_->child(i),shared_from_this()) ); } return children; } autopilot-qt-1.4+15.10.20150825/driver/dbus_object.h0000644000015300001610000000236212567021612022310 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #ifndef DBUS_OBJECT_H #define DBUS_OBJECT_H #include #include #include #include #include #include #include class DBusObject : public QObject { Q_OBJECT public: DBusObject(QObject* parent=nullptr); public slots: void GetState(const QString &piece, const QDBusMessage& msg); void RegisterSignalInterest(int object_id, QString signal_name); void GetSignalEmissions(int object_id, QString signal_name, const QDBusMessage &message); void ListSignals(int object_id, const QDBusMessage& message); void ListMethods(int object_id, const QDBusMessage& message); void InvokeMethod(int object_id, QString method_name, QVariantList args, const QDBusMessage &message); private slots: void ProcessQuery(); private: typedef QPair Query; QQueue _queries; typedef QPair SignalId; typedef QSharedPointer SignalSpyPtr; QMap signal_watchers_; }; #endif autopilot-qt-1.4+15.10.20150825/driver/introspection.h0000644000015300001610000000147412567021612022730 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #ifndef INTROSPECTION_H #define INTROSPECTION_H #include "qtnode.h" #include /// Introspect 'obj' and return it's properties in a QVariantMap. QList Introspect(const QString& query_string); /// Get a list of DBusNode pointers that match the given query. QList GetNodesThatMatchQuery(QString const& query_string); /// Return true if 't' is a type that we can marshall over DBus QVariant PackProperty(QVariant const& prop); /// Return a QVariantMap containing all the properties for the /// given QObject. QVariantMap GetNodeProperties(QObject* obj); #endif autopilot-qt-1.4+15.10.20150825/driver/introspection.cpp0000644000015300001610000002256312567021612023265 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #include #include #include #ifdef QT5_SUPPORT #include #include #include #include #include #include #include #else #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include "autopilot_types.h" #include "introspection.h" #include "qtnode.h" #include "rootnode.h" QVariant IntrospectNode(QObject* obj); QString GetNodeName(QObject* obj); QStringList GetNodeChildNames(QObject* obj); void AddCustomProperties(QObject* obj, QVariantMap& properties); QList Introspect(QString const& query_string) { QList state; QList node_list = GetNodesThatMatchQuery(query_string); foreach (DBusNode::Ptr obj, node_list) { state.append(obj->GetIntrospectionData()); } return state; } QList GetNodesThatMatchQuery(QString const& query_string) { #ifdef QT5_SUPPORT std::shared_ptr root = std::make_shared(QApplication::instance()); // Add all QWidget top level widgets foreach (const QWidget *widget, QApplication::topLevelWidgets()) { root->AddChild((QObject*) widget); } // Add all QML top level Windows foreach (QWindow *widget, QGuiApplication::allWindows()) { root->AddChild((QObject*) widget); } #else std::shared_ptr root = std::make_shared(QApplication::instance()); foreach (QWidget *widget, QApplication::topLevelWidgets()) { root->AddChild((QObject*) widget); } #endif QList node_list; xpathselect::NodeVector list = xpathselect::SelectNodes(root, query_string.toStdString()); for (auto node : list) { // node may be our root node wrapper *or* an ordinary qobject wrapper auto object_ptr = std::static_pointer_cast(node); if (object_ptr) { node_list.append(object_ptr); } } return node_list; } QVariant IntrospectNode(QObject* obj) { // return must be (name, state_map) QString object_name = GetNodeName(obj); QVariantMap object_properties = GetNodeProperties(obj); QList object_tuple = { QVariant(object_name), QVariant(object_properties) }; return QVariant(object_tuple); } QString GetNodeName(QObject* obj) { return obj->metaObject()->className(); } QVariantMap GetNodeProperties(QObject* obj) { QVariantMap object_properties; const QMetaObject* meta = obj->metaObject(); do { for(int i = meta->propertyOffset(); i < meta->propertyCount(); ++i) { QMetaProperty prop = meta->property(i); if (!prop.isValid()) { qDebug() << "Property at index" << i << "Is not valid!"; continue; } QVariant object_property = PackProperty(prop.read(obj)); if (! object_property.isValid()) continue; if (!object_properties.contains(prop.name())) { object_properties[prop.name()] = object_property; } } foreach(const QByteArray &dynamicPropertyName, obj->dynamicPropertyNames()) { QVariant dynamicPropertyValue = obj->property(dynamicPropertyName); QVariant object_property = PackProperty(dynamicPropertyValue); if (! object_property.isValid()) continue; object_properties[dynamicPropertyName] = object_property; } meta = meta->superClass(); } while(meta); AddCustomProperties(obj, object_properties); // add the 'Children' pseudo-property: QStringList children = GetNodeChildNames(obj); if (!children.empty()) object_properties["Children"] = PackProperty(children); return object_properties; } void AddCustomProperties(QObject* obj, QVariantMap &properties) { // Add any custom properties we need to the given QObject. // Add GlobalRect support for QWidget-derived classes QWidget *w = qobject_cast(obj); if (w) { QRect r = w->rect(); r = QRect(w->mapToGlobal(r.topLeft()), r.size()); properties["globalRect"] = PackProperty(r); } // ...and support for QGraphicsItem-derived classes. else if (QGraphicsItem *i = qobject_cast(obj)) { // need to get the view that this item is in. Should only be one. If there's // more than one, we're in trouble. QGraphicsView *view = i->scene()->views().last(); QRectF bounding_rect = i->boundingRect(); bounding_rect = i->mapRectToScene(bounding_rect); QRect scene_rect = view->mapFromScene(bounding_rect).boundingRect(); QRect global_rect = QRect( view->mapToGlobal(scene_rect.topLeft()), scene_rect.size()); properties["globalRect"] = PackProperty(global_rect); } #ifdef QT5_SUPPORT // ... and support for QQuickItems (aka. Qt5 Declarative items) else if (QQuickItem *i = qobject_cast(obj)) { QQuickWindow *view = i->window(); QRectF bounding_rect = i->boundingRect(); bounding_rect = i->mapRectToScene(bounding_rect); QRect global_rect = QRect(view->mapToGlobal(bounding_rect.toRect().topLeft()), bounding_rect.size().toSize()); properties["globalRect"] = PackProperty(global_rect); } #endif } QVariant PackProperty(QVariant const& prop) { switch (prop.type()) { case QVariant::Int: case QVariant::Bool: case QVariant::String: case QVariant::UInt: case QVariant::LongLong: case QVariant::ULongLong: case QVariant::StringList: case QVariant::Double: { return QList { QVariant(TYPE_PLAIN), prop }; } case QVariant::ByteArray: { return QList { QVariant(TYPE_PLAIN), QVariant(QString(qvariant_cast(prop))) }; } case QVariant::Point: { QPoint p = qvariant_cast(prop); return QList { QVariant(TYPE_POINT), QVariant(p.x()), QVariant(p.y()) }; } case QVariant::Rect: { QRect r = qvariant_cast(prop); return QList { QVariant(TYPE_RECT), QVariant(r.x()), QVariant(r.y()), QVariant(r.width()), QVariant(r.height()) }; } case QVariant::Size: { QSize s = qvariant_cast(prop); return QList { QVariant(TYPE_SIZE), QVariant(s.width()), QVariant(s.height()) }; } case QVariant::Color: { QColor color = qvariant_cast(prop).toRgb(); return QList { QVariant(TYPE_COLOR), QVariant(color.red()), QVariant(color.green()), QVariant(color.blue()), QVariant(color.alpha()) }; } case QVariant::Url: { return QList { QVariant(TYPE_PLAIN), QVariant(prop.toUrl().toString()) }; } // Depending on the architecture, floating points might be of type QMetaType::Float instead of QVariant::Double // QDBus however, can only carry QVariant types, so lets convert it to QVariant::Double case QMetaType::Float: { return QList { QVariant(TYPE_PLAIN), QVariant(prop.toDouble()) }; } case QVariant::Date: case QVariant::DateTime: { return QList { QVariant(TYPE_DATETIME), QVariant(prop.toDateTime().toTime_t()) }; } case QVariant::Time: { QTime t = qvariant_cast(prop); return QList { QVariant(TYPE_TIME), QVariant(t.hour()), QVariant(t.minute()), QVariant(t.second()), QVariant(t.msec()) }; } default: { return QVariant(); // unsupported type, will not be sent to the client. } } } QStringList GetNodeChildNames(QObject* obj) { QStringList child_names; foreach (QObject *child, obj->children()) { if (child->parent() == obj) { child_names.append(GetNodeName(child)); } } #ifdef QT5_SUPPORT // In case of a QQuickWindow, add the main contentItem() if (QQuickWindow *window = qobject_cast(obj)) { child_names.append(GetNodeName(window->contentItem())); } // In case of QQuickItems include also childItems(), not only children(). if (QQuickItem *item = qobject_cast(obj)) { foreach (QObject *child, item->childItems()) { child_names.append(GetNodeName(child)); } } #endif return child_names; } autopilot-qt-1.4+15.10.20150825/driver/qtnode.h0000644000015300001610000001200612567021612021313 0ustar pbuserpbgroup00000000000000#ifndef QTNODE_H #define QTNODE_H #include #include #include #include #include class QAbstractItemView; class QTableWidgetItem; class QTreeView; class QTreeWidgetItem; /// A simple data structure representing the state of a single node: struct NodeIntrospectionData { QString object_path; QVariantMap state; }; Q_DECLARE_METATYPE(NodeIntrospectionData); Q_DECLARE_METATYPE(QList); QDBusArgument &operator<<(QDBusArgument &argument, NodeIntrospectionData const& node_data); const QDBusArgument &operator>>(QDBusArgument const& argument, NodeIntrospectionData &node_data); // Interface for Introspecting an object to query it's details. class DBusNode : public xpathselect::Node { public: typedef std::shared_ptr Ptr; DBusNode() {} virtual ~DBusNode() {} virtual NodeIntrospectionData GetIntrospectionData() const=0; }; /// Specialist class for all QObject object nodes. /// This will cover a majority of what we use and we will only need to break /// out to specialist classes for a couple of minor edge-cases (i.e. QModelIndex) /// /// QObjectNode wraps a single QObject pointer. It derives from /// xpathselect::Node (DBusNode) and, like that class, is designed to be /// allocated on the heap and stored in a std::shared_ptr. class QObjectNode : public DBusNode, public std::enable_shared_from_this { public: typedef std::shared_ptr Ptr; QObjectNode(QObject* object, DBusNode::Ptr parent); explicit QObjectNode(QObject* object); QObject* getWrappedObject() const; // DBusNode virtual NodeIntrospectionData GetIntrospectionData() const; // xpathselect::Node xpathselect::Node::Ptr GetParent() const; virtual std::string GetName() const; virtual std::string GetPath() const; virtual int32_t GetId() const; virtual bool MatchStringProperty(std::string const& name, std::string const& value) const; virtual bool MatchIntegerProperty(std::string const& name, int32_t value) const; virtual bool MatchBooleanProperty(std::string const& name, bool value) const; virtual xpathselect::NodeVector Children() const; private: QObject *object_; std::string full_path_; DBusNode::Ptr parent_; }; class QModelIndexNode : public DBusNode, public std::enable_shared_from_this { public: QModelIndexNode(QModelIndex index, QAbstractItemView* parent_view, DBusNode::Ptr parent); // DBusNode virtual NodeIntrospectionData GetIntrospectionData() const; // xpathselect::Node xpathselect::Node::Ptr GetParent() const; virtual std::string GetName() const; virtual std::string GetPath() const; virtual int32_t GetId() const; virtual bool MatchStringProperty(std::string const& name, std::string const& value) const; virtual bool MatchIntegerProperty(std::string const& name, int32_t value) const; virtual bool MatchBooleanProperty(std::string const& name, bool value) const; virtual xpathselect::NodeVector Children() const; private: QVariantMap GetProperties() const; QModelIndex index_; QAbstractItemView* parent_view_; std::string full_path_; DBusNode::Ptr parent_; }; class QTableWidgetItemNode : public DBusNode, public std::enable_shared_from_this { public: QTableWidgetItemNode(QTableWidgetItem *item, DBusNode::Ptr parent); // DBusNode virtual NodeIntrospectionData GetIntrospectionData() const; // xpathselect::Node xpathselect::Node::Ptr GetParent() const; virtual std::string GetName() const; virtual std::string GetPath() const; virtual int32_t GetId() const; virtual bool MatchStringProperty(std::string const& name, std::string const& value) const; virtual bool MatchIntegerProperty(std::string const& name, int32_t value) const; virtual bool MatchBooleanProperty(std::string const& name, bool value) const; virtual xpathselect::NodeVector Children() const; private: QVariantMap GetProperties() const; QTableWidgetItem *item_; std::string full_path_; DBusNode::Ptr parent_; }; class QTreeWidgetItemNode : public DBusNode, public std::enable_shared_from_this { public: QTreeWidgetItemNode(QTreeWidgetItem *item, DBusNode::Ptr parent); // DBusNode virtual NodeIntrospectionData GetIntrospectionData() const; // xpathselect::Node xpathselect::Node::Ptr GetParent() const; virtual std::string GetName() const; virtual std::string GetPath() const; virtual int32_t GetId() const; virtual bool MatchStringProperty(std::string const& name, std::string const& value) const; virtual bool MatchIntegerProperty(std::string const& name, int32_t value) const; virtual bool MatchBooleanProperty(std::string const& name, bool value) const; virtual xpathselect::NodeVector Children() const; private: QVariantMap GetProperties() const; QTreeWidgetItem *item_; std::string full_path_; DBusNode::Ptr parent_; }; #endif // QTNODE_H autopilot-qt-1.4+15.10.20150825/driver/dbus_adaptor.cpp0000644000015300001610000000266312567021612023033 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #include "dbus_adaptor.h" #include #include #include #include #include #include #include #include QString AutopilotAdaptor::WIRE_PROTO_VERSION("1.4"); /* * Implementation of adaptor class AutopilotAdaptor */ AutopilotAdaptor::AutopilotAdaptor(QObject *parent) : QDBusAbstractAdaptor(parent) { // constructor setAutoRelaySignals(true); } AutopilotAdaptor::~AutopilotAdaptor() { // destructor } void AutopilotAdaptor::GetState(const QString &piece, const QDBusMessage &message) { message.setDelayedReply(true); QDBusMessage reply = message.createReply(); // handle method call com.canonical.Unity.Debug.Introspection.GetState QMetaObject::invokeMethod( parent(), "GetState", Qt::QueuedConnection, Q_ARG(QString, piece), Q_ARG(QDBusMessage, reply) ); } void AutopilotAdaptor::GetVersion(const QDBusMessage &message) { QDBusMessage reply = message.createReply(); reply << QVariant(AutopilotAdaptor::WIRE_PROTO_VERSION); QDBusConnection::sessionBus().send(reply); } autopilot-qt-1.4+15.10.20150825/driver/driver.pro0000644000015300001610000000150612567021612021670 0ustar pbuserpbgroup00000000000000TEMPLATE = lib #version check qt contains(QT_VERSION, ^5\\..\\..*) { DEFINES += QT5_SUPPORT TARGET = autopilot_driver_qt5 } else { TARGET = autopilot_driver_qt4 } DESTDIR=.. QT = core gui dbus quick widgets testlib CONFIG += link_pkgconfig PKGCONFIG += xpathselect QMAKE_CXXFLAGS += -std=c++0x -Wl,--no-undefined SOURCES = qttestability.cpp \ dbus_adaptor.cpp \ dbus_object.cpp \ introspection.cpp \ rootnode.cpp \ qtnode.cpp \ dbus_adaptor_qt.cpp HEADERS = qttestability.h \ dbus_adaptor.h \ dbus_object.h \ introspection.h \ rootnode.h \ qtnode.h \ introspection.h \ dbus_adaptor_qt.h \ autopilot_types.h target.file = libtestability* target.path = /usr/lib INSTALLS += target autopilot-qt-1.4+15.10.20150825/driver/autopilot_types.h0000644000015300001610000000115312567021612023266 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #ifndef AUTOPILOT_TYPES_H #define AUTOPILOT_TYPES_H /// IMPORTANT: THese constants are taken from the autopilot XPathSelect protocol document. /// Only add options here if the support has been added for them in autopilot itself. enum autopilot_type_id { TYPE_PLAIN = 0, TYPE_RECT = 1, TYPE_POINT = 2, TYPE_SIZE = 3, TYPE_COLOR = 4, TYPE_DATETIME = 5, TYPE_TIME = 6, }; #endif autopilot-qt-1.4+15.10.20150825/driver/dbus_adaptor.h0000644000015300001610000000236012567021612022472 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #ifndef DBUS_ADAPTOR_H #define DBUS_ADAPTOR_H #include #include class QString; /* * Adaptor class for interface com.canonical.Autopilot.Introspection */ class AutopilotAdaptor: public QDBusAbstractAdaptor { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "com.canonical.Autopilot.Introspection") Q_CLASSINFO("D-Bus Introspection", "" " \n" " " " " " " " " " " " " " " " \n" "") public: AutopilotAdaptor(QObject *parent); virtual ~AutopilotAdaptor(); static QString WIRE_PROTO_VERSION; public: // PROPERTIES public Q_SLOTS: // METHODS void GetState(const QString &piece, const QDBusMessage &message); void GetVersion(const QDBusMessage &message); Q_SIGNALS: // SIGNALS }; #endif autopilot-qt-1.4+15.10.20150825/driver/dbus_adaptor_qt.h0000644000015300001610000000435512567021612023204 0ustar pbuserpbgroup00000000000000#ifndef DBUS_ADAPTOR_QT_H #define DBUS_ADAPTOR_QT_H #include #include class AutopilotQtSpecificAdaptor : public QDBusAbstractAdaptor { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "com.canonical.Autopilot.Qt") Q_CLASSINFO("D-Bus Introspection", "" " \n" " " " " " " " " " " " " " " " " " " " " " " " " " " "" " " " " " " " " " " " " " " " " " " "" " \n" "") public: AutopilotQtSpecificAdaptor(QObject *parent = 0); signals: public slots: void RegisterSignalInterest(int object_id, QString signal_name); void GetSignalEmissions(int object_id, QString signal_name, const QDBusMessage& message); void ListSignals(int object_id, const QDBusMessage& message); void ListMethods(int object_id, const QDBusMessage& message); void InvokeMethod(int object_id, QString method_name, QVariantList args, const QDBusMessage& message); }; #endif // DBUS_ADAPTOR_QT_H autopilot-qt-1.4+15.10.20150825/driver/qttestability.cpp0000644000015300001610000000215012567021612023255 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #include "qttestability.h" #include "dbus_adaptor.h" #include "dbus_adaptor_qt.h" #include "dbus_object.h" #include "qtnode.h" #include #include #include const QString DBUS_OBJECT_PATH("/com/canonical/Autopilot/Introspection"); void qt_testability_init(void) { qDebug().nospace() << "Testability driver loaded. Wire protocol version is " << AutopilotAdaptor::WIRE_PROTO_VERSION << "."; qDBusRegisterMetaType(); qDBusRegisterMetaType >(); DBusObject* obj = new DBusObject; new AutopilotAdaptor(obj); new AutopilotQtSpecificAdaptor(obj); QDBusConnection connection = QDBusConnection::sessionBus(); if (!connection.registerObject(DBUS_OBJECT_PATH, obj)) { qDebug("Unable to register object on D-Bus! Testability interface will not be available."); } } autopilot-qt-1.4+15.10.20150825/lib/0000755000015300001610000000000012567022276017133 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/lib/qttestability.h0000644000015300001610000000047212567021612022202 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #ifndef QTTESTABILITY_H #define QTTESTABILITY_H extern "C" void qt_testability_init(void); #endif autopilot-qt-1.4+15.10.20150825/lib/lib.pro0000644000015300001610000000051112567021612020411 0ustar pbuserpbgroup00000000000000TEMPLATE = lib TARGET = qttestability DESTDIR=.. # disable qt includes and linkage (core and gui are enabled per default with Qt4) QT -= core gui QMAKE_CXXFLAGS += -std=c++0x -Wl,--no-undefined QMAKE_CXXFLAGS -= -pedantic SOURCES = qttestability.cpp HEADERS = qttestability.h target.file = libtestability* INSTALLS += target autopilot-qt-1.4+15.10.20150825/lib/qttestability.cpp0000644000015300001610000000443412567021612022537 0ustar pbuserpbgroup00000000000000/* Copyright 2012 Canonical This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. */ #include "qttestability.h" #include #include #include typedef enum { QT_VERSION_4, QT_VERSION_5, QT_VERSION_UNKNOWN } QtVersion; static int callback(struct dl_phdr_info *info, size_t size, void *data) { (void) size; QtVersion *v = (QtVersion*) data; if (*v == QT_VERSION_UNKNOWN) { std::string lib_path(info->dlpi_name); if (lib_path.rfind("libQtCore.so.4") != std::string::npos) { *v = QT_VERSION_4; } else if (lib_path.rfind("libQtCore.so.5") != std::string::npos || lib_path.rfind("libQt5Core.so.5") != std::string::npos) { *v = QT_VERSION_5; } } return 0; } void qt_testability_init(void) { QtVersion version = QT_VERSION_UNKNOWN; dl_iterate_phdr(callback, &version); std::string driver_name; if (version == QT_VERSION_4) { driver_name = "libautopilot_driver_qt4.so.1"; } else if (version == QT_VERSION_5) { driver_name = "libautopilot_driver_qt5.so.1"; } else { std::cerr << "We don't seem to link to version 4 or 5 of QtCore." << std::endl << "Unable to determine which autopilot driver to load." << std::endl << "Autopilot introspection will not be available for this process." << std::endl; return; } void* driver = dlopen(driver_name.c_str(), RTLD_LAZY); if (!driver) { std::cerr << "Cannot load library: " << dlerror() << std::endl << "Autopilot introspection will not be available for this process." << std::endl; return; } // load the entry point function for the actual driver: typedef void (*entry_t)(); // clear errors: dlerror(); entry_t entry_point = (entry_t) dlsym(driver, "qt_testability_init"); const char* err = dlerror(); if (err) { std::cerr << "Cannot load library entry point symbol: " << err << std::endl << "Autopilot introspection will not be available for this process." << std::endl; return; } entry_point(); } autopilot-qt-1.4+15.10.20150825/COPYING0000644000015300001610000010451312567021612017415 0ustar pbuserpbgroup00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . autopilot-qt-1.4+15.10.20150825/tests/0000755000015300001610000000000012567022276017527 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/tests/tests.pro0000644000015300001610000000006212567021612021402 0ustar pbuserpbgroup00000000000000TEMPLATE = subdirs SUBDIRS += autopilot unittests autopilot-qt-1.4+15.10.20150825/tests/unittests/0000755000015300001610000000000012567022276021571 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/tests/unittests/tst_introspection.cpp0000644000015300001610000003246012567021617026072 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013-2014 Canonical, Ltd. * * Authors: * Michael Zanetti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include #include #include #include #include #include #include "tst_introspection.h" #include "introspection.h" #include "qtnode.h" QVariant IntrospectNode(QObject* obj); void tst_Introspection::initTestCase() { QApplication::setApplicationName("tst_introspection"); m_object = new QMainWindow(); QWidget *centralWidget = new QWidget(); centralWidget->setObjectName("centralTestWidget"); m_object->setCentralWidget(centralWidget); QGridLayout *layout = new QGridLayout(); layout->setObjectName("myTestLayout"); centralWidget->setLayout(layout); QPushButton *button = new QPushButton("MyButton1"); button->setObjectName("myButton1"); layout->addWidget(button); button = new QPushButton("MyButton2"); button->setObjectName("myButton2"); layout->addWidget(button); m_object->setObjectName("testWindow"); m_object->setProperty("dynamicTestProperty", "testValue"); m_object->setProperty("dynamicStringProperty", QString("testValue")); m_object->setProperty("myUInt", QVariant(quint8(5))); m_object->setProperty("myStringList", QVariant(QStringList() << "string1" << "string2" << "string3")); m_object->setProperty("myColor", QColor("red")); m_object->setProperty("myByteArray", QByteArray("0xDEADBEEF")); m_object->setProperty("myUrl", QUrl("http://www.ubuntu.com")); m_object->setProperty("myDateTime", QDateTime::currentDateTime()); m_object->setProperty("myDate", QDateTime::currentDateTime().date()); m_object->setProperty("myTime", QTime::currentTime()); m_object->setMaximumSize(1234, 4321); m_object->resize(123, 321); m_object->move(333, 444); m_object->setVisible(false); m_object->setWindowOpacity(0.12345); m_object->show(); } void tst_Introspection::cleanupTestCase() { m_object->close(); delete m_object; } void tst_Introspection::test_introspect_data() { // some query QTest::addColumn("xpath"); // number of expected results QTest::addColumn("resultCount"); // first result object type. Empty string if 0 results expected QTest::addColumn("firstResultType"); // Choose a property from the first result object to be compared, empty QString/QVariant if 0 results expected QTest::addColumn("firstResultPropertyName"); QTest::addColumn("firstResultPropertyValue"); #ifdef QT5_SUPPORT QTest::newRow("/") << "/" << 1 << "/tst_introspection" << "Children" << QVariant( QVariantList() << 0 << QVariant( QStringList() << "QMainWindow" << "QWidgetWindow" << "QWidgetWindow" << "QWidgetWindow" ) ); QTest::newRow("//QWidget[id=8]") << "//QWidget[id=8]" << 1 << "/tst_introspection/QMainWindow/QWidget" << "objectName" << QVariant( QVariantList() << 0 << "centralTestWidget" ); QTest::newRow("//QPushButton[id=11]") << "//QPushButton[id=11]" << 1 << "/tst_introspection/QMainWindow/QWidget/QPushButton" << "objectName" << QVariant( QVariantList() << 0 << "myButton2" ); #else QTest::newRow("/") << "/" << 1 << "/tst_introspection" << "Children" << QVariant( QVariantList() << 0 << "QMainWindow" ); QTest::newRow("//QWidget[id=5]") << "//QWidget[id=5]" << 1 << "/tst_introspection/QMainWindow/QWidget" << "objectName" << QVariant( QVariantList() << 0 << "centralTestWidget" ); // Depending on the environment, Qt4 could add a second QWidget at position 6. That moves other items down by one. if (Introspect("//QWidget[id=6]").count() > 0) { QTest::newRow("//QPushButton[id=9]") << "//QPushButton[id=9]" << 1 << "/tst_introspection/QMainWindow/QWidget/QPushButton" << "objectName" << QVariant( QVariantList() << 0 << "myButton2" ); } else { QTest::newRow("//QPushButton[id=8]") << "//QPushButton[id=8]" << 1 << "/tst_introspection/QMainWindow/QWidget/QPushButton" << "objectName" << QVariant( QVariantList() << 0 << "myButton2" ); } #endif QTest::newRow("/tst_introspection/QMainWindow/QWidget/QGridLayout") << "//QGridLayout" << 1 << "/tst_introspection/QMainWindow/QWidget/QGridLayout" << "objectName" << QVariant( QVariantList() << 0 << "myTestLayout" ); QTest::newRow("parent of leaf node") << "/tst_introspection/QMainWindow/QWidget/QGridLayout/.." << 1 << "/tst_introspection/QMainWindow/QWidget" << "objectName" << QVariant( QVariantList() << 0 << "centralTestWidget" ); QTest::newRow("parent of root node") << "/tst_introspection/.." << 1 << "/tst_introspection" << "id" << QVariant( QVariantList() << 0 << 1 ); QTest::newRow("//QPushButton") << "//QPushButton" << 2 << "/tst_introspection/QMainWindow/QWidget/QPushButton" << "objectName" << QVariant( QVariantList() << 0 << "myButton1" ); QTest::newRow("//QWidget/*") << "//QWidget/*" << 5 << "/tst_introspection/QMainWindow/QWidget/QGridLayout" << "objectName" << QVariant( QVariantList() << 0 << "myTestLayout" ); QTest::newRow("broken query") << "broken query" << 0 << QString() << QString() << QVariant(); } void tst_Introspection::test_introspect() { QFETCH(QString, xpath); QFETCH(int, resultCount); QFETCH(QString, firstResultType); QFETCH(QString, firstResultPropertyName); QFETCH(QVariant, firstResultPropertyValue); QList resultList = Introspect(xpath); QCOMPARE(resultList.count(), resultCount); if (resultCount > 0) { NodeIntrospectionData first_object = resultList.first(); QCOMPARE(first_object.object_path, firstResultType); QCOMPARE(first_object.state.value(firstResultPropertyName), firstResultPropertyValue); } } void tst_Introspection::test_application_names_data() { QTest::addColumn("app_name"); QTest::newRow("Unset") << "untitled1"; QTest::newRow("Tech") << "autopilot-qt"; QTest::newRow("Userfriendly") << "Autopilot Qt Driver"; QTest::newRow("Fqdn name") << "com.canonical.Autopilot.Qt"; } void tst_Introspection::test_application_names() { QFETCH(QString, app_name); qApp->setApplicationName(app_name); #ifdef QT5_SUPPORT QList result = Introspect("//QWidgetWindow"); #else QList result = Introspect("//QMainWindow"); #endif QVERIFY(!result.isEmpty()); } void tst_Introspection::test_properties_data() { QTest::addColumn("propertyName"); QTest::addColumn("propertyValue"); QTest::addColumn("fuzzyCompare"); QTest::newRow("static property") << "objectName" << QVariant( QVariantList() << 0 << m_object->objectName() ) << false; QTest::newRow("dynamic property") << "dynamicTestProperty" << QVariant( QVariantList() << 0 << m_object->property("dynamicTestProperty") ) << false; QTest::newRow("int") << "width" << QVariant( QVariantList() << 0 << m_object->width() ) << false; QTest::newRow("uint") << "myUInt" << QVariant( QVariantList() << 0 << m_object->property("myUInt") ) << false; QTest::newRow("bool") << "visible" << QVariant( QVariantList() << 0 << m_object->isVisible() ) << false; QTest::newRow("double") << "windowOpacity" << QVariant( QVariantList() << 0 << m_object->windowOpacity() ) << true; QTest::newRow("QString") << "objectName" << QVariant( QVariantList() << 0 << m_object->objectName() ) << false; QTest::newRow("QStringList") << "myStringList" << QVariant( QVariantList() << 0 << m_object->property("myStringList") ) << false; QTest::newRow("QSize") << "maximumSize" << QVariant( QVariantList() << 3 << m_object->maximumWidth() << m_object->maximumHeight() ) << false; QTest::newRow("QPoint") << "pos" << QVariant( QVariantList() << 2 << m_object->x() << m_object->y() ) << false; QTest::newRow("QRect") << "geometry" << QVariant( QVariantList() << 1 << m_object->geometry().x() << m_object->geometry().y() << m_object->geometry().width() << m_object->geometry().height() ) << false; QTest::newRow("QColor") << "myColor" << QVariant( QVariantList() << 4 << qvariant_cast(m_object->property("myColor")).red() << qvariant_cast(m_object->property("myColor")).green() << qvariant_cast(m_object->property("myColor")).blue() << qvariant_cast(m_object->property("myColor")).alpha() ) << false; QTest::newRow("QByteArray") << "myByteArray" << QVariant( QVariantList() << 0 << m_object->property("myByteArray") ) << false; QTest::newRow("QUrl") << "myUrl" << QVariant( QVariantList() << 0 << m_object->property("myUrl") ) << false; QTest::newRow("QDateTime") << "myDateTime" << QVariant( QVariantList() << 5 << m_object->property("myDateTime").toDateTime().toTime_t() ) << false; QTest::newRow("QDate") << "myDate" << QVariant( QVariantList() << 5 << m_object->property("myDate").toDateTime().toTime_t() ) << false; QTest::newRow("QTime") << "myTime" << QVariant( QVariantList() << 6 << m_object->property("myTime").toTime().hour() << m_object->property("myTime").toTime().minute() << m_object->property("myTime").toTime().second() << m_object->property("myTime").toTime().msec() ) << false; } void tst_Introspection::test_properties() { QFETCH(QString, propertyName); QFETCH(QVariant, propertyValue); QFETCH(bool, fuzzyCompare); QVariant result = IntrospectNode(m_object); QCOMPARE(result.toList().count(), 2); QVariantMap properties = result.toList().at(1).toMap(); if (fuzzyCompare) { qFuzzyCompare(properties.value(propertyName).toDouble(), propertyValue.toDouble()); } else { QCOMPARE(properties.value(propertyName), propertyValue); } } void tst_Introspection::test_property_matching() { QObjectNode n(m_object); QVERIFY(n.MatchStringProperty("dynamicStringProperty", "testValue") == true); QVERIFY(n.MatchStringProperty("dynamicTestProperty", "testValue") == true); QVERIFY(n.MatchIntegerProperty("myUInt", 5) == true); QVERIFY(n.MatchBooleanProperty("visible", true) == true); } autopilot-qt-1.4+15.10.20150825/tests/unittests/unittests.pro0000644000015300001610000000117012567021612024345 0ustar pbuserpbgroup00000000000000#include(../../coverage.pri) CONFIG += testcase TARGET = tst_libautopilot-qt QT += testlib dbus widgets quick CONFIG += link_pkgconfig debug PKGCONFIG += xpathselect QMAKE_CXXFLAGS += -std=c++0x -Wl,--no-undefined contains(QT_VERSION, ^5\\..\\..*) { DEFINES += QT5_SUPPORT } INCLUDEPATH += ../../driver SOURCES += \ tst_main.cpp \ tst_qtnode.cpp \ tst_introspection.cpp \ ../../driver/introspection.cpp \ ../../driver/rootnode.cpp \ ../../driver/qtnode.cpp HEADERS += \ tst_qtnode.h \ tst_introspection.h \ ../../driver/introspection.h \ ../../driver/rootnode.h \ ../../driver/qtnode.h autopilot-qt-1.4+15.10.20150825/tests/unittests/tst_main.cpp0000644000015300001610000000165612567021612024114 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include #include "tst_qtnode.h" #include "tst_introspection.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); tst_Introspection introspection_tc; tst_qtnode qtnode_tc; return QTest::qExec(&introspection_tc, argc, argv) || QTest::qExec(&qtnode_tc, argc, argv); } autopilot-qt-1.4+15.10.20150825/tests/unittests/tst_qtnode.cpp0000644000015300001610000002437712567021612024467 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical, Ltd. * * Authors: * Christopher Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include #include #include #include #include #include #include #include "tst_qtnode.h" #include "introspection.h" #include "qtnode.h" int32_t calculate_ap_id(quint64 big_id); void CollectSpecialChildren(QObject* object, xpathselect::NodeVector& children, DBusNode::Ptr parent); void CollectAllIndices(QModelIndex index, QAbstractItemModel *model, QModelIndexList &collection); bool MatchProperty(const QVariantMap& packed_properties, const std::string& name, QVariant value); void GetDataElementChildren(QTableWidget* table, xpathselect::NodeVector& children, DBusNode::Ptr parent); void GetDataElementChildren(QTreeView* tree_view, xpathselect::NodeVector& children, DBusNode::Ptr parent); void GetDataElementChildren(QTreeWidget* tree_widget, xpathselect::NodeVector& children, DBusNode::Ptr parent); void GetDataElementChildren(QListView* list_view, xpathselect::NodeVector& children, DBusNode::Ptr parent); void tst_qtnode::initTestCase() { QApplication::setApplicationName("tst_qtnode"); } void tst_qtnode::test_calculate_ap_id_data() { QTest::addColumn("id"); QTest::addColumn("expected_result"); QTest::newRow("1") << Q_UINT64_C(0xFFFFFFFF) << int(0xFFFFFFFF); QTest::newRow("2") << Q_UINT64_C(0x00000000FFFFFFFF) << int(0xFFFFFFFF); QTest::newRow("3") << Q_UINT64_C(0xFFFFFFFFFFFFFFFF) << int(0x0); QTest::newRow("4") << Q_UINT64_C(0x0F0F0F0F0F0F0F0F) << int(0x0); QTest::newRow("5") << Q_UINT64_C(0xF0F0F0FF0F0F0F0) << int(0xFFFFFFFF); QTest::newRow("6") << Q_UINT64_C(0xF0F0F0F0FFFFFFFF) << int(0xF0F0F0F); } void tst_qtnode::test_calculate_ap_id() { QFETCH(quint64, id); QFETCH(int32_t, expected_result); QCOMPARE(calculate_ap_id(id), expected_result); } void tst_qtnode::test_CollectAllIndices_collects_all_table_data() { int row_count = 2; int col_count = 2; testModel = std::make_shared(row_count, col_count); for (int row = 0; row < row_count; ++row) { for (int column = 0; column < col_count; ++column) { QStandardItem *item = new QStandardItem( QString("row %0, column %1").arg(row).arg(column)); testModel->setItem(row, column, item); } } } void tst_qtnode::test_CollectAllIndices_collects_all_table() { QModelIndexList collection; QStandardItem *root_item = testModel->invisibleRootItem(); CollectAllIndices(root_item->index(), testModel.get(), collection); QCOMPARE(collection.size(), 4); } void tst_qtnode::test_CollectAllIndices_collects_all_list_data() { int listitem_count = 4; testModel = std::make_shared(); QStandardItem *parentItem = testModel->invisibleRootItem(); for (int i = 0; i < listitem_count; ++i) { QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); parentItem->appendRow(item); parentItem = item; } } void tst_qtnode::test_CollectAllIndices_collects_all_list() { QModelIndexList collection; QStandardItem *root_item = testModel->invisibleRootItem(); CollectAllIndices(root_item->index(), testModel.get(), collection); QCOMPARE(collection.size(), 4); } Q_DECLARE_METATYPE(std::string) void tst_qtnode::test_MatchProperty_data() { QTest::addColumn("packedProperties"); QTest::addColumn("name"); QTest::addColumn("value"); QTest::addColumn("expectedResult"); QVariantMap p; p["string"] = PackProperty(QVariant("string")); p["int"] = PackProperty(QVariant(1)); p["bool"] = PackProperty(QVariant(true)); QTest::newRow("Matches string") << p << std::string("string") << QVariant("string") << true; QTest::newRow("Matches int") << p << std::string("int") << QVariant(1) << true; QTest::newRow("Matches bool") << p << std::string("bool") << QVariant(true) << true; QTest::newRow("Fails not present") << p << std::string("notpresent") << QVariant("string") << false; QTest::newRow("Fails values do not match") << p << std::string("string") << QVariant("notstring") << false; } void tst_qtnode::test_MatchProperty() { QFETCH(QVariantMap, packedProperties); QFETCH(std::string, name); QFETCH(QVariant, value); QFETCH(bool, expectedResult); QCOMPARE(MatchProperty(packedProperties, name, value), expectedResult); } void tst_qtnode::populate_QTreeView_with_data() { testModel = std::make_shared(); testModel->setColumnCount(1); testModel->setRowCount(5); testModel->setData(testModel->index(0, 0), "test0"); testModel->setData(testModel->index(1, 0), "test1"); testModel->setData(testModel->index(2, 0), "test2"); testModel->setData(testModel->index(3, 0), "test3"); testModel->setData(testModel->index(4, 0), "test4"); treeView = std::make_shared(); treeView->setModel(testModel.get()); } void tst_qtnode::populate_QTreeWidget_with_data() { treeWidget = std::make_shared(); treeWidget->setColumnCount(1); QList items; for (int i = 0; i < 5; ++i) items.append(new QTreeWidgetItem()); treeWidget->insertTopLevelItems(0, items); } void tst_qtnode::populate_QListView_with_data() { testModel = std::make_shared(); testModel->setColumnCount(1); testModel->setRowCount(5); testModel->setData(testModel->index(0, 0), "test0"); testModel->setData(testModel->index(1, 0), "test1"); testModel->setData(testModel->index(2, 0), "test2"); testModel->setData(testModel->index(3, 0), "test3"); testModel->setData(testModel->index(4, 0), "test4"); listView = std::make_shared(); listView->setModel(testModel.get()); } void tst_qtnode::populate_QTableWidget_with_data() { tableWidget = std::make_shared(); tableWidget->setRowCount(4); tableWidget->setColumnCount(2); for (int row = 0; row < 4; ++row) { for (int column = 0; column < 2; ++column) { tableWidget->setItem(row, column, new QTableWidgetItem()); } } } void tst_qtnode::test_GetDataElementChildren_QTreeView_collects_all_data() { populate_QTreeView_with_data(); } void tst_qtnode::test_GetDataElementChildren_QTreeView_collects_all() { xpathselect::NodeVector children; DBusNode::Ptr parent; GetDataElementChildren(treeView.get(), children, parent); QCOMPARE((int)children.size(), 5); auto node_parent = children[0]->GetParent(); QVERIFY(node_parent == parent); } void tst_qtnode::test_GetDataElementChildren_QTreeWidget_collects_all_data() { populate_QTreeWidget_with_data(); } void tst_qtnode::test_GetDataElementChildren_QTreeWidget_collects_all() { xpathselect::NodeVector children; DBusNode::Ptr parent; GetDataElementChildren(treeWidget.get(), children, parent); QCOMPARE((int)children.size(), 5); auto node_parent = children[0]->GetParent(); QVERIFY(node_parent == parent); } void tst_qtnode::test_GetDataElementChildren_QListView_collects_all_data() { populate_QListView_with_data(); } void tst_qtnode::test_GetDataElementChildren_QListView_collects_all() { xpathselect::NodeVector children; DBusNode::Ptr parent; GetDataElementChildren(listView.get(), children, parent); QCOMPARE((int)children.size(), 5); auto node_parent = children[0]->GetParent(); QVERIFY(node_parent == parent); } void tst_qtnode::test_GetDataElementChildren_QTableWidget_collects_all_data() { populate_QTableWidget_with_data(); } void tst_qtnode::test_GetDataElementChildren_QTableWidget_collects_all() { xpathselect::NodeVector children; DBusNode::Ptr parent; GetDataElementChildren(tableWidget.get(), children, parent); QCOMPARE((int)children.size(), 8); auto node_parent = children[0]->GetParent(); QVERIFY(node_parent == parent); } void tst_qtnode::test_CollectSpecialChildren_QTreeView_collects_all_data() { populate_QTreeView_with_data(); } void tst_qtnode::test_CollectSpecialChildren_QTreeView_collects_all() { xpathselect::NodeVector children; DBusNode::Ptr parent; CollectSpecialChildren(treeView.get(), children, parent); QCOMPARE((int)children.size(), 5); } void tst_qtnode::test_CollectSpecialChildren_QTreeWidget_collects_all_data() { populate_QTreeWidget_with_data(); } void tst_qtnode::test_CollectSpecialChildren_QTreeWidget_collects_all() { xpathselect::NodeVector children; DBusNode::Ptr parent; CollectSpecialChildren(treeWidget.get(), children, parent); QCOMPARE((int)children.size(), 5); } void tst_qtnode::test_CollectSpecialChildren_QListView_collects_all_data() { populate_QListView_with_data(); } void tst_qtnode::test_CollectSpecialChildren_QListView_collects_all() { xpathselect::NodeVector children; DBusNode::Ptr parent; CollectSpecialChildren(listView.get(), children, parent); QCOMPARE((int)children.size(), 5); } void tst_qtnode::test_CollectSpecialChildren_QTableWidget_collects_all_data() { populate_QTableWidget_with_data(); } void tst_qtnode::test_CollectSpecialChildren_QTableWidget_collects_all() { xpathselect::NodeVector children; DBusNode::Ptr parent; CollectSpecialChildren(tableWidget.get(), children, parent); QCOMPARE((int)children.size(), 8); } void tst_qtnode::test_CollectSpecialChildren_QObject_collects_nothing() { xpathselect::NodeVector children; DBusNode::Ptr parent; std::shared_ptr testObject = std::make_shared(); CollectSpecialChildren(testObject.get(), children, parent); QCOMPARE((int)children.size(), 0); } autopilot-qt-1.4+15.10.20150825/tests/unittests/tst_qtnode.h0000644000015300001610000000544712567021612024131 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical, Ltd. * * Authors: * Christopher Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include #include class QStandardItemModel; class QStandardItemModel; class QTreeWidget; class QListView; class QTreeView; class QTableWidget; class tst_qtnode: public QObject { Q_OBJECT private slots: void initTestCase(); void test_calculate_ap_id_data(); void test_calculate_ap_id(); void test_CollectAllIndices_collects_all_table_data(); void test_CollectAllIndices_collects_all_table(); void test_CollectAllIndices_collects_all_list_data(); void test_CollectAllIndices_collects_all_list(); void test_MatchProperty_data(); void test_MatchProperty(); void populate_QTreeView_with_data(); void populate_QTreeWidget_with_data(); void populate_QListView_with_data(); void populate_QTableWidget_with_data(); void test_GetDataElementChildren_QTreeView_collects_all_data(); void test_GetDataElementChildren_QTreeView_collects_all(); void test_GetDataElementChildren_QTreeWidget_collects_all_data(); void test_GetDataElementChildren_QTreeWidget_collects_all(); void test_GetDataElementChildren_QListView_collects_all_data(); void test_GetDataElementChildren_QListView_collects_all(); void test_GetDataElementChildren_QTableWidget_collects_all_data(); void test_GetDataElementChildren_QTableWidget_collects_all(); void test_CollectSpecialChildren_QTreeView_collects_all_data(); void test_CollectSpecialChildren_QTreeView_collects_all(); void test_CollectSpecialChildren_QTreeWidget_collects_all_data(); void test_CollectSpecialChildren_QTreeWidget_collects_all(); void test_CollectSpecialChildren_QListView_collects_all_data(); void test_CollectSpecialChildren_QListView_collects_all(); void test_CollectSpecialChildren_QTableWidget_collects_all_data(); void test_CollectSpecialChildren_QTableWidget_collects_all(); void test_CollectSpecialChildren_QObject_collects_nothing(); private: std::shared_ptr testModel; std::shared_ptr treeWidget; std::shared_ptr listView; std::shared_ptr treeView; std::shared_ptr tableWidget; }; autopilot-qt-1.4+15.10.20150825/tests/unittests/tst_introspection.h0000644000015300001610000000214012567021612025522 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical, Ltd. * * Authors: * Christopher Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include class tst_Introspection : public QObject { Q_OBJECT private slots: void initTestCase(); void cleanupTestCase(); void test_introspect_data(); void test_introspect(); void test_application_names_data(); void test_application_names(); void test_properties_data(); void test_properties(); void test_property_matching(); private: QMainWindow *m_object; }; autopilot-qt-1.4+15.10.20150825/tests/autopilot/0000755000015300001610000000000012567022276021547 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/tests/autopilot/testapp/0000755000015300001610000000000012567022276023227 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/tests/autopilot/testapp/testapp.pro0000644000015300001610000000067012567021612025425 0ustar pbuserpbgroup00000000000000TEMPLATE = app contains(QT_VERSION, ^5\\..\\..*) { TARGET = qt5testapp QT += widgets quick qmlfile.file = qt5.qml DEFINES += QT5_SUPPORT } else { TARGET = qt4testapp QT += declarative qmlfile.file = qt4.qml } SOURCES += testapp.cpp qmlfile.path=/usr/share/libautopilot-qt/ target.path=/usr/share/libautopilot-qt/ target.file = $TARGET INSTALLS += target qmlfile OTHER_FILES += \ $$system(ls ./*.qml) autopilot-qt-1.4+15.10.20150825/tests/autopilot/testapp/testapp.cpp0000644000015300001610000000244712567021612025413 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * Authors: * Michael Zanetti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include #include #ifdef QT5_SUPPORT #include #else #include #endif int main(int argc, char *argv[]) { QApplication app(argc, argv); QStringList args = QApplication::arguments(); QString sourceFile = args.last(); int appNameIndex = args.indexOf("--appname"); if(appNameIndex > 0 && args.count() >= appNameIndex) { app.setApplicationName(args.at(appNameIndex+1)); } #ifdef QT5_SUPPORT QQuickView view; #else QDeclarativeView view; #endif view.setSource(QUrl(sourceFile)); view.show(); app.exec(); } autopilot-qt-1.4+15.10.20150825/tests/autopilot/testapp/qt5.qml0000644000015300001610000000274112567021612024450 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * Authors: * Michael Zanetti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ import QtQuick 2.0 Item { id: root objectName: "rootItem" width: 500 height: 500 function testSlot(data) { testItem.stringProperty = data } Item { id: testItem objectName: "testItem" property string stringProperty: "Testing rocks, debugging sucks!" property int intProperty: 42 property bool boolProperty: false property real realProperty: 0.42 property double doubleProperty: 0.42 } Rectangle { id: rect objectName: "testRectangle" anchors.fill: parent color: "blue" } MouseArea { objectName: "testMouseArea" width: root.width / 2 height: root.height / 2 anchors.centerIn: root onClicked: rect.color = "red" } } autopilot-qt-1.4+15.10.20150825/tests/autopilot/testapp/qt4.qml0000644000015300001610000000274112567021612024447 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * Authors: * Michael Zanetti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ import QtQuick 1.0 Item { id: root objectName: "rootItem" width: 500 height: 500 function testSlot(data) { testItem.stringProperty = data } Item { id: testItem objectName: "testItem" property string stringProperty: "Testing rocks, debugging sucks!" property int intProperty: 42 property bool boolProperty: false property real realProperty: 0.42 property double doubleProperty: 0.42 } Rectangle { id: rect objectName: "testRectangle" anchors.fill: parent color: "blue" } MouseArea { objectName: "testMouseArea" width: root.width / 2 height: root.height / 2 anchors.centerIn: root onClicked: rect.color = "red" } } autopilot-qt-1.4+15.10.20150825/tests/autopilot/libautopilot_qt/0000755000015300001610000000000012567022276024762 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/tests/autopilot/libautopilot_qt/emulators/0000755000015300001610000000000012567022276026775 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/tests/autopilot/libautopilot_qt/emulators/main_window_qt4.py0000644000015300001610000000425312567021612032447 0ustar pbuserpbgroup00000000000000# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Copyright 2013 Canonical # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. import logging logger = logging.getLogger(__name__) class MainWindowQt4(object): def __init__(self, app): self.app = app def get_qml_view(self): qml_view = self.app.select_single("QDeclarativeView") if qml_view is None: logger.error("*** select_single(\"QDeclarativeView\") failed ***") return qml_view def get_root_item(self): root_item = self.app.select_single("QDeclarativeItem", objectName="rootItem") if root_item is None: logger.error("*** select_single(\"QDeclarativeItem\", objectName=\rootItem\") failed ***") return root_item def get_test_item(self): test_item = self.app.select_single("QDeclarativeItem", objectName="testItem") if test_item is None: logger.error("*** select_single(\"QDeclarativeItem\", objectName=\"testItem\") failed ***") return test_item def get_test_item_by_objectname(self): test_item = self.app.select_single(objectName="testItem") if test_item is None: logger.error("*** select_single(objectName=\"testItem\") failed ***") return test_item def get_test_rectangle(self): rectangle = self.app.select_single("QDeclarativeRectangle") if rectangle is None: logger.error("*** select_single(\"QDeclarativeRectangle\") failed ***") return rectangle def get_test_rectangle_by_child_search(self): rectangle = self.get_root_item().get_children_by_type("QDeclarativeRectangle")[0] if rectangle is None: logger.error("*** get_children_by_type(\"QDeclarativeRectangle\")[0] failed ***") return rectangle def get_test_mousearea(self): mousearea = self.app.select_single("QDeclarativeMouseArea") if mousearea is None: logger.error("*** select_single(\"QDeclarativeMouseArea\") failed ***") return mousearea autopilot-qt-1.4+15.10.20150825/tests/autopilot/libautopilot_qt/emulators/__init__.py0000644000015300001610000000044112567021612031076 0ustar pbuserpbgroup00000000000000# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Copyright 2013 Canonical # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. autopilot-qt-1.4+15.10.20150825/tests/autopilot/libautopilot_qt/emulators/main_window_qt5.py0000644000015300001610000000414312567021612032446 0ustar pbuserpbgroup00000000000000# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Copyright 2013 Canonical # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. import logging logger = logging.getLogger(__name__) class MainWindowQt5(object): def __init__(self, app): self.app = app def get_qml_view(self): qml_view = self.app.select_single("QQuickView") if qml_view is None: logger.error("*** select_single(\"QQuickView\") failed ***") return qml_view def get_root_item(self): root_item = self.app.select_single("QQuickItem", objectName="rootItem") if root_item is None: logger.error("*** select_single(\"QQuickItem\", objectName=\rootItem\") failed ***") return root_item def get_test_item(self): test_item = self.app.select_single("QQuickItem", objectName="testItem") if test_item is None: logger.error("*** select_single(\"QQuickItem\", objectName=\"testItem\") failed ***") return test_item def get_test_item_by_objectname(self): test_item = self.app.select_single(objectName="testItem") if test_item is None: logger.error("*** select_single(objectName=\"testItem\") failed ***") return test_item def get_test_rectangle(self): rectangle = self.app.select_single("QQuickRectangle") if rectangle is None: logger.error("*** select_single(\"QQuickRectangle\") failed ***") return rectangle def get_test_rectangle_by_child_search(self): rectangle = self.get_root_item().get_children_by_type("QQuickRectangle")[0] if rectangle is None: logger.error("*** get_children_by_type(\"QQuickRectangle\")[0] failed ***") return rectangle def get_test_mousearea(self): mousearea = self.app.select_single("QQuickMouseArea") if mousearea is None: logger.error("*** select_single(\"QQuickMouseArea\") failed ***") return mousearea autopilot-qt-1.4+15.10.20150825/tests/autopilot/libautopilot_qt/tests/0000755000015300001610000000000012567022276026124 5ustar pbuserpbgroup00000000000000autopilot-qt-1.4+15.10.20150825/tests/autopilot/libautopilot_qt/tests/__init__.py0000644000015300001610000000413012567021612030224 0ustar pbuserpbgroup00000000000000# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Copyright 2013 Canonical # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. """libautopilot-qt autopilot tests.""" import os from autopilot.testcase import AutopilotTestCase from libautopilot_qt.emulators.main_window_qt4 import MainWindowQt4 from libautopilot_qt.emulators.main_window_qt5 import MainWindowQt5 import logging logger = logging.getLogger(__name__) class AutopilotQtTestCase(AutopilotTestCase): qt_version = 0 def setUp(self, *app_args): super(AutopilotQtTestCase, self).setUp() self.launch_test_app(app_args) def launch_test_app(self, *app_args): # Lets assume we are installed system wide if this file is somewhere in /usr if os.path.realpath(__file__).startswith("/usr/"): path = "/usr/share/libautopilot-qt/" else: # Load library from local build dir os.environ['LD_LIBRARY_PATH'] = "../../" path = "testapp/" app_name_qt4 = path + "qt4testapp" app_name_qt5 = path + "qt5testapp" qt_select = os.environ.get('QT_SELECT') if os.path.isfile(app_name_qt5) and not qt_select == "qt4": logger.info("Found Qt5 test app") app_name = app_name_qt5 qml_file = path + "qt5.qml" self.qt_version = 5 elif os.path.isfile(app_name_qt4) and not qt_select == "qt5": logger.info("Found Qt4 test app") app_name = app_name_qt4 qml_file = path + "qt4.qml" self.qt_version = 4 else: logger.error("Could not find test app.") args = [app_name] args.extend(*app_args) args.append(qml_file) self.app = self.launch_test_application(*args) @property def main_window(self): if self.qt_version == 4: return MainWindowQt4(self.app) if self.qt_version == 5: return MainWindowQt5(self.app) autopilot-qt-1.4+15.10.20150825/tests/autopilot/libautopilot_qt/tests/test_main.py0000644000015300001610000000756612567021612030470 0ustar pbuserpbgroup00000000000000# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Copyright 2013 Canonical # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. from __future__ import absolute_import from testtools.matchers import Equals, NotEquals from autopilot.matchers import Eventually from libautopilot_qt.tests import AutopilotQtTestCase class TestQueries(AutopilotQtTestCase): def setUp(self): super(TestQueries, self).setUp() self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) def tearDown(self): super(TestQueries, self).tearDown() def test_find_select_single(self): root_item = self.main_window.get_root_item() self.assertThat(root_item, NotEquals(None)) def test_find_by_objectname(self): test_item = self.main_window.get_test_item_by_objectname() self.assertThat(test_item, NotEquals(None)) def test_find_by_child_search(self): rectangle = self.main_window.get_test_rectangle_by_child_search() self.assertThat(rectangle, NotEquals(None)) class TestProperties(AutopilotQtTestCase): def setUp(self): super(TestProperties, self).setUp() self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) def tearDown(self): super(TestProperties, self).tearDown() def test_basic_properties(self): test_item = self.main_window.get_test_item() self.assertThat(test_item.stringProperty, Equals("Testing rocks, debugging sucks!")) self.assertThat(test_item.intProperty, Equals(42)) self.assertThat(test_item.boolProperty, Equals(False)) self.assertThat(test_item.realProperty, Equals(0.42)) self.assertThat(test_item.doubleProperty, Equals(0.42)) rectangle = self.main_window.get_test_rectangle() self.assertThat(rectangle.color, Equals([0, 0, 255, 255])) def test_mouse_interaction(self): rectangle = self.main_window.get_test_rectangle() self.assertThat(rectangle.color, Equals([0, 0, 255, 255])) mousearea = self.main_window.get_test_mousearea() self.pointing_device.move_to_object(mousearea) self.pointing_device.click() self.assertThat(rectangle.color, Eventually(Equals([255, 0, 0, 255]))) class TestAppNameQtDefault(AutopilotQtTestCase): def setUp(self): super(TestAppNameQtDefault, self).setUp("--appname", "untitled1") def test_connection(self): self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) class TestAppNameTech(AutopilotQtTestCase): def setUp(self): super(TestAppNameTech, self).setUp("--appname", "qt-test-app") def test_connection(self): self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) class TestAppNameUserfriendly(AutopilotQtTestCase): def setUp(self): super(TestAppNameUserfriendly, self).setUp("--appname", "Qt Test App") def test_connection(self): self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) class TestAppNameFqdn(AutopilotQtTestCase): def setUp(self): super(TestAppNameFqdn, self).setUp("--appname", "com.ubuntu.qttestapp") def test_connection(self): self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) class TestSlots(AutopilotQtTestCase): def setUp(self): super(TestSlots, self).setUp() def test_callSlot(self): TEST_DATA = "testdata for test_callSlot" root_item = self.main_window.get_root_item() self.assertThat(len(root_item.get_slots()), NotEquals(0)) root_item.slots.testSlot(TEST_DATA) self.assertThat(self.main_window.get_test_item().stringProperty, Equals(TEST_DATA)) autopilot-qt-1.4+15.10.20150825/tests/autopilot/libautopilot_qt/__init__.py0000644000015300001610000000053512567021612027067 0ustar pbuserpbgroup00000000000000# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Copyright 2013 Canonical # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. """libautopilot-qt autopilot tests - top level package.""" autopilot-qt-1.4+15.10.20150825/tests/autopilot/autopilot.pro0000644000015300001610000000004612567021612024302 0ustar pbuserpbgroup00000000000000TEMPLATE = subdirs SUBDIRS += testapp autopilot-qt-1.4+15.10.20150825/autopilot-qt.pro0000644000015300001610000000023212567021612021537 0ustar pbuserpbgroup00000000000000TEMPLATE = subdirs # only build the main lib once, with the qt5 driver contains(QT_VERSION, ^5\\..\\..*) { SUBDIRS += lib } SUBDIRS += driver tests autopilot-qt-1.4+15.10.20150825/README0000644000015300001610000000474512567021612017250 0ustar pbuserpbgroup00000000000000Autopilot Qt Driver ################### What is this? ============= This is the Qt driver for autopilot. It allows autopilot to inspect the internals of Qt4, Qt5, and QMl-based applications. How does it work? ================= Qt loads a 'qt_testability' library, if *either* the ``-testability`` command line argument is passed to ``QCoreApplication``, *or* if the ``QT_LOAD_TESTABILITY`` environment variable is set. This codebase provides that library, along with several others. Upon being loaded, it connects to the system bus, and exposes an interface that the autopilot test runner knows how to interact with. How do I build it? ================== First, make sure you have all the build dependencies installed:: $ sudo mk-build-deps -i Then build the library:: $ # Make the shadow build directory: $ mkdir build $ cd build $ # Build the qt4 libraries. These steps can be skipped if you only care about Qt5 $ qmake -qt=qt4 ../autopilot-qt.pro $ make $ # Build Qt5. This is required, even if you don't care about Qt5: $ qmake -qt=qt5 ../autopilot-qt.pro $ make To use the library you just built, make sure your 'build' directory is in your ``LD_LIBRARY_PATH`` environment varaible:: $ export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH How do I run the unit tests? ============================ After completing the build instructions above, make sure you are still in the 'build' directory and run:: $ ./tests/unittests/tst_introspection How do I run the autopilot tests? ================================= After completing the build instructions above, make sure you are still in the 'build' directory and run:: $ cd tests/autopilot $ PYTHONPATH=../../../tests/autopilot python3 -m autopilot.run run libautopilot_qt How do I install autopilot-qt from source to the system? ======================================================== The only sensible way to do this is to build the debian packages:: $ bzr bd If the package signing fails (probably because you haven't added to debian/changelog) then you can install the built (but unsigned) packages like so:: $ sudo dpkg -i ../build-area/libautopilot-qt*.deb Otherwise the packages will be in the parent directory, and can be installed like so:: $ sudo dpkg -i ../libautopilot-qt*.deb Note that the unit test suite is run during a package buid, but the autopilot tests are not. Who should I ask for more information? ====================================== Autopilot developers all hang out on #ubuntu-autopilot on irc.freenode.net.