on xenial help sign in
Fill the fake UbuntuKeyboardInfo with correct values
commit9b0b65d9507e5b4f833368437a271a5ce31dd56d authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateWed 11 Mar 2015, 16:30 (12 years ago) parent91fdd13
3 files changed+51−7
tests/mocks/Unity/Application/UbuntuKeyboardInfo.cpp+33−1 tests/mocks/Unity/Application/UbuntuKeyboardInfo.h+11−5 tests/mocks/Unity/Application/VirtualKeyboard.qml+7−1
tests/mocks/Unity/Application/UbuntuKeyboardInfo.cpp+33−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2015 Canonical, Ltd.
33 *
44 * This program is free software: you can redistribute it and/or modify it under
55 * the terms of the GNU Lesser General Public License version 3, as published by
@@ -26,3 +26,35 @@ UbuntuKeyboardInfo::UbuntuKeyboardInfo(QObject *parent)
2626 m_height(200)
2727{
2828}
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 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2015 Canonical, Ltd.
33 *
44 * This program is free software: you can redistribute it and/or modify it under
55 * the terms of the GNU Lesser General Public License version 3, as published by
@@ -22,10 +22,10 @@
2222
2323class UbuntuKeyboardInfo : public QObject {
2424 Q_OBJECT
25− Q_PROPERTY(qreal x READ x NOTIFY xChanged)
26− Q_PROPERTY(qreal y READ y NOTIFY yChanged)
27− Q_PROPERTY(qreal width READ width NOTIFY widthChanged)
28− Q_PROPERTY(qreal height READ height NOTIFY heightChanged)
25+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
26+ Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
27+ Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged)
28+ Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged)
2929public:
3030 UbuntuKeyboardInfo(QObject *parent = 0);
3131 virtual ~UbuntuKeyboardInfo() {}
@@ -34,6 +34,12 @@ public:
3434 qreal width() const { return m_width; }
3535 qreal height() const { return m_height; }
3636
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+
3743 static UbuntuKeyboardInfo *singleton() {
3844 if (!m_instance) {
3945 m_instance = new UbuntuKeyboardInfo;
tests/mocks/Unity/Application/VirtualKeyboard.qml+7−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2014-2015 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU Lesser General Public License as published by
@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.0
18+import Unity.Application 0.1
1819
1920Item {
2021 implicitWidth: units.gu(40)
@@ -37,4 +38,9 @@ Item {
3738 anchors.fill: parent
3839 }
3940 }
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}
4046}