~cimi/ubuntu-system-settings/wizard.privacy

« back to all changes in this revision

Viewing changes to tests/tst_pagelist.cpp

  • Committer: Andrea Cimitan
  • Date: 2014-04-11 12:07:23 UTC
  • mfrom: (662.2.47 wizard.wifi)
  • Revision ID: andrea.cimitan@gmail.com-20140411120723-hzbv5ekjurprc6uw
* Bump version for new package ubuntu-system-settings-wizard
[ Andrea Cimitan ]
* Detect SIM and if negative show no sim page
[ Victor R. Ruiz ]
* Autopilot: Move launch_system_settings to a helper module.
[ Iain Lane ]
* Hide 'Serial' and 'IMEI' entries when the info isn't available
* Don't look for PkgConfig explicitly, breaks with Multi-Arch.
  FindPkgConfig.cmake does this for us anyway.
[ CI bot ]
* Resync trunk
[ Diego Sarmentero ]
* Add click updates support. .

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    void testCollect();
37
37
    void testIterate();
38
38
    void testIgnoreNonNumbered();
 
39
    void testIgnoreNonQml();
39
40
    void testIgnoreDuplicates();
40
41
    void testDisabled();
41
42
 
68
69
{
69
70
    QTemporaryDir root;
70
71
    fillRoot(root);
71
 
    makeFile(root, "a", "3");
72
 
    makeFile(root, "b", "1");
73
 
    makeFile(root, "c", "2");
 
72
    makeFile(root, "a", "3.qml");
 
73
    makeFile(root, "b", "1.qml");
 
74
    makeFile(root, "c", "2.qml");
74
75
 
75
76
    PageList pageList;
76
 
    QCOMPARE(pageList.entries(), QStringList() << "1" << "2" << "3");
77
 
    QCOMPARE(pageList.paths(), QStringList() << root.path() + "/b/" + PAGES_PATH + "/1"
78
 
                                             << root.path() + "/c/" + PAGES_PATH + "/2"
79
 
                                             << root.path() + "/a/" + PAGES_PATH + "/3");
 
77
    QCOMPARE(pageList.entries(), QStringList() << "1.qml" << "2.qml" << "3.qml");
 
78
    QCOMPARE(pageList.paths(), QStringList() << root.path() + "/b/" + PAGES_PATH + "/1.qml"
 
79
                                             << root.path() + "/c/" + PAGES_PATH + "/2.qml"
 
80
                                             << root.path() + "/a/" + PAGES_PATH + "/3.qml");
80
81
}
81
82
 
82
83
void PageListTest::testIterate()
83
84
{
84
85
    QTemporaryDir root;
85
86
    fillRoot(root);
86
 
    makeFile(root, "a", "1");
87
 
    makeFile(root, "a", "2");
88
 
    makeFile(root, "a", "3");
 
87
    makeFile(root, "a", "1.qml");
 
88
    makeFile(root, "a", "2.qml");
 
89
    makeFile(root, "a", "3.qml");
89
90
 
90
91
    PageList pageList;
91
92
    QCOMPARE(pageList.index(), -1);
92
 
    QCOMPARE(pageList.next(), root.path() + "/a/" + PAGES_PATH + "/1");
 
93
    QCOMPARE(pageList.next(), root.path() + "/a/" + PAGES_PATH + "/1.qml");
93
94
    QCOMPARE(pageList.prev(), QString());
94
 
    QCOMPARE(pageList.next(), root.path() + "/a/" + PAGES_PATH + "/2");
95
 
    QCOMPARE(pageList.prev(), root.path() + "/a/" + PAGES_PATH + "/1");
 
95
    QCOMPARE(pageList.next(), root.path() + "/a/" + PAGES_PATH + "/2.qml");
 
96
    QCOMPARE(pageList.prev(), root.path() + "/a/" + PAGES_PATH + "/1.qml");
96
97
    QCOMPARE(pageList.index(), 0);
97
 
    QCOMPARE(pageList.next(), root.path() + "/a/" + PAGES_PATH + "/2");
98
 
    QCOMPARE(pageList.next(), root.path() + "/a/" + PAGES_PATH + "/3");
 
98
    QCOMPARE(pageList.next(), root.path() + "/a/" + PAGES_PATH + "/2.qml");
 
99
    QCOMPARE(pageList.next(), root.path() + "/a/" + PAGES_PATH + "/3.qml");
99
100
    QCOMPARE(pageList.index(), 2);
100
101
    QCOMPARE(pageList.next(), QString());
101
102
    QCOMPARE(pageList.index(), 2);
105
106
{
106
107
    QTemporaryDir root;
107
108
    fillRoot(root);
108
 
    makeFile(root, "a", "1");
109
 
    makeFile(root, "a", "nope");
110
 
 
111
 
    PageList pageList;
112
 
    QCOMPARE(pageList.entries(), QStringList() << "1");
 
109
    makeFile(root, "a", "1.qml");
 
110
    makeFile(root, "a", "nope.qml");
 
111
 
 
112
    PageList pageList;
 
113
    QCOMPARE(pageList.entries(), QStringList() << "1.qml");
 
114
}
 
115
 
 
116
void PageListTest::testIgnoreNonQml()
 
117
{
 
118
    QTemporaryDir root;
 
119
    fillRoot(root);
 
120
    makeFile(root, "a", "1.qml");
 
121
    makeFile(root, "a", "2");
 
122
    makeFile(root, "a", "2.txt");
 
123
 
 
124
    PageList pageList;
 
125
    QCOMPARE(pageList.entries(), QStringList() << "1.qml");
113
126
}
114
127
 
115
128
void PageListTest::testIgnoreDuplicates()
116
129
{
117
130
    QTemporaryDir root;
118
131
    fillRoot(root);
119
 
    makeFile(root, "a", "1");
120
 
    makeFile(root, "b", "1");
 
132
    makeFile(root, "a", "1.qml");
 
133
    makeFile(root, "b", "1.qml");
121
134
 
122
135
    PageList pageList;
123
 
    QCOMPARE(pageList.paths(), QStringList() << root.path() + "/a/" + PAGES_PATH + "/1");
 
136
    QCOMPARE(pageList.paths(), QStringList() << root.path() + "/a/" + PAGES_PATH + "/1.qml");
124
137
}
125
138
 
126
139
void PageListTest::testDisabled()
127
140
{
128
141
    QTemporaryDir root;
129
142
    fillRoot(root);
130
 
    makeFile(root, "a", "1.disabled"); // before the fact
131
 
    makeFile(root, "b", "1");
132
 
    makeFile(root, "b", "2");
133
 
    makeFile(root, "b", "2.disabled"); // same dir
134
 
    makeFile(root, "b", "3");
135
 
    makeFile(root, "b", "4"); // only survivor
136
 
    makeFile(root, "c", "3.disabled"); // after the fact
 
143
    makeFile(root, "a", "1.qml.disabled"); // before the fact
 
144
    makeFile(root, "b", "1.qml");
 
145
    makeFile(root, "b", "2.qml");
 
146
    makeFile(root, "b", "2.qml.disabled"); // same dir
 
147
    makeFile(root, "b", "3.qml");
 
148
    makeFile(root, "b", "4.qml"); // only survivor
 
149
    makeFile(root, "c", "3.qml.disabled"); // after the fact
137
150
 
138
151
    PageList pageList;
139
 
    QCOMPARE(pageList.entries(), QStringList() << "4");
 
152
    QCOMPARE(pageList.entries(), QStringList() << "4.qml");
140
153
}
141
154
 
142
155
QTEST_MAIN(PageListTest)