on xenial help sign in
enable mocked previews
65323c5Michael Zanetti
tests/mocks/Unity/fake_preview.cpp+4
@@ -16,6 +16,10 @@
16
16
17#include "fake_preview.h"
17#include "fake_preview.h"
18
18
19+Preview::Preview(QObject *parent): QObject(parent)
20+{
21+}
22+
19QString Preview::rendererName() const
23QString Preview::rendererName() const
20{
24{
21 return "foo";
25 return "foo";
tests/mocks/Unity/fake_scope.cpp+10−3
@@ -14,13 +14,13 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−// Self
18#include "fake_scope.h"
17#include "fake_scope.h"
18+#include "fake_preview.h"
19+#include "paths.h"
19
20
20#include <dee.h>
21#include <dee.h>
21−#include "paths.h"
22
22
23−#include "fake_preview.h"
23+#include <QDebug>
24
24
25static DeeModel* create_categories_model(unsigned category_count);
25static DeeModel* create_categories_model(unsigned category_count);
26static DeeModel* create_results_model(unsigned category_count, unsigned result_count);
26static 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
168 Q_UNUSED(comment);
168 Q_UNUSED(comment);
169 Q_UNUSED(dnd_uri);
169 Q_UNUSED(dnd_uri);
170 Q_UNUSED(metadata);
170 Q_UNUSED(metadata);
171+ qDebug() << "foooooooooooooo activating" << uri;
172+
173+ Preview *p = new Preview();
174+ Q_EMIT previewReady(p);
171}
175}
172
176
173void Scope::preview(const QVariant &uri, const QVariant &icon_hint, const QVariant &category,
177void 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
183 Q_UNUSED(comment);
187 Q_UNUSED(comment);
184 Q_UNUSED(dnd_uri);
188 Q_UNUSED(dnd_uri);
185 Q_UNUSED(metadata);
189 Q_UNUSED(metadata);
190+
191+ Preview *p = new Preview();
192+ Q_EMIT previewReady(p);
186}
193}
187
194
188static const gchar * categories_model_schema[] = {
195static const gchar * categories_model_schema[] = {
tests/mocks/Unity/fake_unity_plugin.cpp+1
@@ -41,4 +41,5 @@ void FakeUnityPlugin::registerTypes(const char *uri)
41 qmlRegisterType<Scope>(uri, 0, 1, "Scope");
41 qmlRegisterType<Scope>(uri, 0, 1, "Scope");
42 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
42 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
43 qmlRegisterUncreatableType<CategoryResults>(uri, 0, 1, "CategoryResults", "Can't create");
43 qmlRegisterUncreatableType<CategoryResults>(uri, 0, 1, "CategoryResults", "Can't create");
44+ qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
44}
45}
tests/qmltests/Dash/tst_GenericScopeView.qml+4−4
@@ -28,6 +28,10 @@ Item {
28
28
29 Scopes {
29 Scopes {
30 id: scopes
30 id: scopes
31+
32+ onLoadedChanged: {
33+ genericScopeView.scope = scopes.get(0)
34+ }
31 }
35 }
32
36
33 GenericScopeView {
37 GenericScopeView {
@@ -38,10 +42,6 @@ Item {
38 name: "GenericScopeView"
42 name: "GenericScopeView"
39 when: scopes.loaded
43 when: scopes.loaded
40
44
41− function init() {
42− genericScopeView.scope = scopes.get(0)
43− }
44−
45 function test_isCurrent() {
45 function test_isCurrent() {
46 var pageHeader = findChild(genericScopeView, "pageHeader");
46 var pageHeader = findChild(genericScopeView, "pageHeader");
47 var previewLoader = findChild(genericScopeView, "previewLoader");
47 var previewLoader = findChild(genericScopeView, "previewLoader");