on xenial help sign in
enable mocked previews
commit65323c5d1b2dbc33780a830541db6b6b2697f826 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 31 Oct 2013, 13:02 (13 years ago) parentea02059
4 files changed+19−7
tests/mocks/Unity/fake_preview.cpp+4 tests/mocks/Unity/fake_scope.cpp+10−3 tests/mocks/Unity/fake_unity_plugin.cpp+1 tests/qmltests/Dash/tst_GenericScopeView.qml+4−4
tests/mocks/Unity/fake_preview.cpp+4
@@ -16,6 +16,10 @@
1616
1717#include "fake_preview.h"
1818
19+Preview::Preview(QObject *parent): QObject(parent)
20+{
21+}
22+
1923QString Preview::rendererName() const
2024{
2125 return "foo";
tests/mocks/Unity/fake_scope.cpp+10−3
@@ -14,13 +14,13 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−// Self
1817#include "fake_scope.h"
18+#include "fake_preview.h"
19+#include "paths.h"
1920
2021#include <dee.h>
21−#include "paths.h"
2222
23−#include "fake_preview.h"
23+#include <QDebug>
2424
2525static DeeModel* create_categories_model(unsigned category_count);
2626static DeeModel* create_results_model(unsigned category_count, unsigned result_count);
@@ -168,6 +168,10 @@ void Scope::activate(const QVariant &uri, const QVariant &icon_hint, const QVari
168168 Q_UNUSED(comment);
169169 Q_UNUSED(dnd_uri);
170170 Q_UNUSED(metadata);
171+ qDebug() << "foooooooooooooo activating" << uri;
172+
173+ Preview *p = new Preview();
174+ Q_EMIT previewReady(p);
171175}
172176
173177void Scope::preview(const QVariant &uri, const QVariant &icon_hint, const QVariant &category,
@@ -183,6 +187,9 @@ void Scope::preview(const QVariant &uri, const QVariant &icon_hint, const QVaria
183187 Q_UNUSED(comment);
184188 Q_UNUSED(dnd_uri);
185189 Q_UNUSED(metadata);
190+
191+ Preview *p = new Preview();
192+ Q_EMIT previewReady(p);
186193}
187194
188195static const gchar * categories_model_schema[] = {
tests/mocks/Unity/fake_unity_plugin.cpp+1
@@ -41,4 +41,5 @@ void FakeUnityPlugin::registerTypes(const char *uri)
4141 qmlRegisterType<Scope>(uri, 0, 1, "Scope");
4242 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
4343 qmlRegisterUncreatableType<CategoryResults>(uri, 0, 1, "CategoryResults", "Can't create");
44+ qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
4445}
tests/qmltests/Dash/tst_GenericScopeView.qml+4−4
@@ -28,6 +28,10 @@ Item {
2828
2929 Scopes {
3030 id: scopes
31+
32+ onLoadedChanged: {
33+ genericScopeView.scope = scopes.get(0)
34+ }
3135 }
3236
3337 GenericScopeView {
@@ -38,10 +42,6 @@ Item {
3842 name: "GenericScopeView"
3943 when: scopes.loaded
4044
41− function init() {
42− genericScopeView.scope = scopes.get(0)
43− }
44−
4545 function test_isCurrent() {
4646 var pageHeader = findChild(genericScopeView, "pageHeader");
4747 var previewLoader = findChild(genericScopeView, "previewLoader");