on xenial help sign in
Fill the fake UbuntuKeyboardInfo with correct values
9b0b65dDaniel d'Andrada
tests/mocks/Unity/Application/UbuntuKeyboardInfo.cpp+33−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2015 Canonical, Ltd.
3 *
3 *
4 * This program is free software: you can redistribute it and/or modify it under
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
5 * the terms of the GNU Lesser General Public License version 3, as published by
@@ -26,3 +26,35 @@ UbuntuKeyboardInfo::UbuntuKeyboardInfo(QObject *parent)
26 m_height(200)
26 m_height(200)
27{
27{
28}
28}
29+
30+void UbuntuKeyboardInfo::setX(qreal value)
31+{
32+ if (value != m_x) {
33+ m_x = value;
34+ Q_EMIT xChanged(m_x);
35+ }
36+}
37+
38+void UbuntuKeyboardInfo::setY(qreal value)
39+{
40+ if (value != m_y) {
41+ m_y = value;
42+ Q_EMIT yChanged(m_y);
43+ }
44+}
45+
46+void UbuntuKeyboardInfo::setWidth(qreal value)
47+{
48+ if (value != m_width) {
49+ m_width = value;
50+ Q_EMIT widthChanged(m_width);
51+ }
52+}
53+
54+void UbuntuKeyboardInfo::setHeight(qreal value)
55+{
56+ if (value != m_height) {
57+ m_height = value;
58+ Q_EMIT heightChanged(m_height);
59+ }
60+}
tests/mocks/Unity/Application/UbuntuKeyboardInfo.h+11−5
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2015 Canonical, Ltd.
3 *
3 *
4 * This program is free software: you can redistribute it and/or modify it under
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
5 * the terms of the GNU Lesser General Public License version 3, as published by
@@ -22,10 +22,10 @@
22
22
23class UbuntuKeyboardInfo : public QObject {
23class UbuntuKeyboardInfo : public QObject {
24 Q_OBJECT
24 Q_OBJECT
25− Q_PROPERTY(qreal x READ x NOTIFY xChanged)
25+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
26− Q_PROPERTY(qreal y READ y NOTIFY yChanged)
26+ Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
27− Q_PROPERTY(qreal width READ width NOTIFY widthChanged)
27+ Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged)
28− Q_PROPERTY(qreal height READ height NOTIFY heightChanged)
28+ Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged)
29public:
29public:
30 UbuntuKeyboardInfo(QObject *parent = 0);
30 UbuntuKeyboardInfo(QObject *parent = 0);
31 virtual ~UbuntuKeyboardInfo() {}
31 virtual ~UbuntuKeyboardInfo() {}
@@ -34,6 +34,12 @@ public:
34 qreal width() const { return m_width; }
34 qreal width() const { return m_width; }
35 qreal height() const { return m_height; }
35 qreal height() const { return m_height; }
36
36
37+ // Just in the fake implementation
38+ void setX(qreal value);
39+ void setY(qreal value);
40+ void setWidth(qreal value);
41+ void setHeight(qreal value);
42+
37 static UbuntuKeyboardInfo *singleton() {
43 static UbuntuKeyboardInfo *singleton() {
38 if (!m_instance) {
44 if (!m_instance) {
39 m_instance = new UbuntuKeyboardInfo;
45 m_instance = new UbuntuKeyboardInfo;
tests/mocks/Unity/Application/VirtualKeyboard.qml+7−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2014-2015 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
5 * it under the terms of the GNU Lesser General Public License as published by
@@ -15,6 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18+import Unity.Application 0.1
18
19
19Item {
20Item {
20 implicitWidth: units.gu(40)
21 implicitWidth: units.gu(40)
@@ -37,4 +38,9 @@ Item {
37 anchors.fill: parent
38 anchors.fill: parent
38 }
39 }
39 }
40 }
41+
42+ Binding { target: UbuntuKeyboardInfo; property: "x"; value: screenshotImage.x}
43+ Binding { target: UbuntuKeyboardInfo; property: "y"; value: screenshotImage.y}
44+ Binding { target: UbuntuKeyboardInfo; property: "width"; value: screenshotImage.width}
45+ Binding { target: UbuntuKeyboardInfo; property: "height"; value: screenshotImage.height}
40}
46}