on xenial help sign in
fix tests and add one
d6de6bcMichael Terry
qml/Panel/Indicators.qml+1
@@ -170,6 +170,7 @@ Showable {
170
170
171 VisibleIndicators {
171 VisibleIndicators {
172 id: visibleIndicators
172 id: visibleIndicators
173+ objectName: "visibleIndicators"
173 }
174 }
174
175
175 MenuContent {
176 MenuContent {
tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp+13−1
@@ -21,7 +21,8 @@
21#include "indicators.h"
21#include "indicators.h"
22
22
23FakeIndicatorsModel::FakeIndicatorsModel(QObject *parent)
23FakeIndicatorsModel::FakeIndicatorsModel(QObject *parent)
24− : QAbstractListModel(parent)
24+ : QAbstractListModel(parent),
25+ m_profile("phone")
25{
26{
26 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
27 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
27 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
28 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
@@ -39,6 +40,17 @@ int FakeIndicatorsModel::count() const
39 return rowCount();
40 return rowCount();
40}
41}
41
42
43+QString FakeIndicatorsModel::profile() const
44+{
45+ return m_profile;
46+}
47+
48+void FakeIndicatorsModel::setProfile(const QString& profile)
49+{
50+ m_profile = profile;
51+ Q_EMIT profileChanged();
52+}
53+
42void FakeIndicatorsModel::load(const QString&)
54void FakeIndicatorsModel::load(const QString&)
43{
55{
44}
56}
tests/mocks/Unity/Indicators/fakeindicatorsmodel.h+6
@@ -27,6 +27,7 @@ class FakeIndicatorsModel : public QAbstractListModel
27 Q_OBJECT
27 Q_OBJECT
28 Q_ENUMS(Roles)
28 Q_ENUMS(Roles)
29 Q_PROPERTY(int count READ count NOTIFY countChanged)
29 Q_PROPERTY(int count READ count NOTIFY countChanged)
30+ Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
30public:
31public:
31
32
32 FakeIndicatorsModel(QObject *parent=0);
33 FakeIndicatorsModel(QObject *parent=0);
@@ -39,6 +40,9 @@ public:
39
40
40 Q_INVOKABLE QVariant data(int row, int role) const;
41 Q_INVOKABLE QVariant data(int row, int role) const;
41
42
43+ QString profile() const;
44+ void setProfile(const QString& profile);
45+
42 /* QAbstractItemModel */
46 /* QAbstractItemModel */
43 QHash<int, QByteArray> roleNames() const;
47 QHash<int, QByteArray> roleNames() const;
44 int columnCount(const QModelIndex &parent = QModelIndex()) const;
48 int columnCount(const QModelIndex &parent = QModelIndex()) const;
@@ -48,12 +52,14 @@ public:
48
52
49Q_SIGNALS:
53Q_SIGNALS:
50 void countChanged();
54 void countChanged();
55+ void profileChanged();
51
56
52private:
57private:
53 int count() const;
58 int count() const;
54
59
55 typedef QHash<int, QVariant> Indicator;
60 typedef QHash<int, QVariant> Indicator;
56 QList<Indicator*> m_indicators;
61 QList<Indicator*> m_indicators;
62+ QString m_profile;
57};
63};
58
64
59#endif // FAKE_INDICATORSMODEL_H
65#endif // FAKE_INDICATORSMODEL_H
tests/qmltests/tst_Shell.qml+13
@@ -65,6 +65,7 @@ Row {
65 property bool itemDestroyed: false
65 property bool itemDestroyed: false
66 sourceComponent: Component {
66 sourceComponent: Component {
67 Shell {
67 Shell {
68+ property string indicatorProfile: "phone"
68 Component.onDestruction: {
69 Component.onDestruction: {
69 shellLoader.itemDestroyed = true;
70 shellLoader.itemDestroyed = true;
70 }
71 }
@@ -442,6 +443,18 @@ Row {
442 && itemRectInShell.y + itemRectInShell.height <= shell.height;
443 && itemRectInShell.y + itemRectInShell.height <= shell.height;
443 }
444 }
444
445
446+ function test_greeterChangesIndicatorProfile() {
447+ var visibleIndicators = findChild(shell, "visibleIndicators")
448+ tryCompare(visibleIndicators, "profile", shell.indicatorProfile)
449+
450+ var greeter = findChild(shell, "greeter")
451+ greeter.show()
452+ tryCompare(visibleIndicators, "profile", shell.indicatorProfile + "_greeter")
453+
454+ greeter.hide()
455+ tryCompare(visibleIndicators, "profile", shell.indicatorProfile)
456+ }
457+
445 function test_focusRequestedHidesGreeter() {
458 function test_focusRequestedHidesGreeter() {
446 var greeter = findChild(shell, "greeter");
459 var greeter = findChild(shell, "greeter");
447
460
tests/qmltests/tst_ShellWithPin.qml+1
@@ -51,6 +51,7 @@ Item {
51 Shell {
51 Shell {
52 id: shell
52 id: shell
53 maxFailedLogins: maxRetriesTextField.text
53 maxFailedLogins: maxRetriesTextField.text
54+ property string indicatorProfile: "phone"
54 }
55 }
55 Column {
56 Column {
56 anchors { top: parent.top; right: parent.right; bottom: parent.bottom; margins:units.gu(1) }
57 anchors { top: parent.top; right: parent.right; bottom: parent.bottom; margins:units.gu(1) }