on xenial help sign in
fix tests and add one
commitd6de6bc473755e527a94582fc335e345668e5b86 authorMichael Terry <michael.terry@canonical.com> dateFri 3 Oct 2014, 21:22 (12 years ago) parent38f3ead
5 files changed+34−1
qml/Panel/Indicators.qml+1 tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp+13−1 tests/mocks/Unity/Indicators/fakeindicatorsmodel.h+6 tests/qmltests/tst_Shell.qml+13 tests/qmltests/tst_ShellWithPin.qml+1
qml/Panel/Indicators.qml+1
@@ -170,6 +170,7 @@ Showable {
170170
171171 VisibleIndicators {
172172 id: visibleIndicators
173+ objectName: "visibleIndicators"
173174 }
174175
175176 MenuContent {
tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp+13−1
@@ -21,7 +21,8 @@
2121#include "indicators.h"
2222
2323FakeIndicatorsModel::FakeIndicatorsModel(QObject *parent)
24− : QAbstractListModel(parent)
24+ : QAbstractListModel(parent),
25+ m_profile("phone")
2526{
2627 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
2728 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
@@ -39,6 +40,17 @@ int FakeIndicatorsModel::count() const
3940 return rowCount();
4041}
4142
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+
4254void FakeIndicatorsModel::load(const QString&)
4355{
4456}
tests/mocks/Unity/Indicators/fakeindicatorsmodel.h+6
@@ -27,6 +27,7 @@ class FakeIndicatorsModel : public QAbstractListModel
2727 Q_OBJECT
2828 Q_ENUMS(Roles)
2929 Q_PROPERTY(int count READ count NOTIFY countChanged)
30+ Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
3031public:
3132
3233 FakeIndicatorsModel(QObject *parent=0);
@@ -39,6 +40,9 @@ public:
3940
4041 Q_INVOKABLE QVariant data(int row, int role) const;
4142
43+ QString profile() const;
44+ void setProfile(const QString& profile);
45+
4246 /* QAbstractItemModel */
4347 QHash<int, QByteArray> roleNames() const;
4448 int columnCount(const QModelIndex &parent = QModelIndex()) const;
@@ -48,12 +52,14 @@ public:
4852
4953Q_SIGNALS:
5054 void countChanged();
55+ void profileChanged();
5156
5257private:
5358 int count() const;
5459
5560 typedef QHash<int, QVariant> Indicator;
5661 QList<Indicator*> m_indicators;
62+ QString m_profile;
5763};
5864
5965#endif // FAKE_INDICATORSMODEL_H
tests/qmltests/tst_Shell.qml+13
@@ -65,6 +65,7 @@ Row {
6565 property bool itemDestroyed: false
6666 sourceComponent: Component {
6767 Shell {
68+ property string indicatorProfile: "phone"
6869 Component.onDestruction: {
6970 shellLoader.itemDestroyed = true;
7071 }
@@ -442,6 +443,18 @@ Row {
442443 && itemRectInShell.y + itemRectInShell.height <= shell.height;
443444 }
444445
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+
445458 function test_focusRequestedHidesGreeter() {
446459 var greeter = findChild(shell, "greeter");
447460
tests/qmltests/tst_ShellWithPin.qml+1
@@ -51,6 +51,7 @@ Item {
5151 Shell {
5252 id: shell
5353 maxFailedLogins: maxRetriesTextField.text
54+ property string indicatorProfile: "phone"
5455 }
5556 Column {
5657 anchors { top: parent.top; right: parent.right; bottom: parent.bottom; margins:units.gu(1) }