Merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-02 into lp:ubuntu-filemanager-app

Proposed by Carlos Jose Mazieri
Status: Merged
Approved by: Arto Jalkanen
Approved revision: 461
Merged at revision: 467
Proposed branch: lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-02
Merge into: lp:ubuntu-filemanager-app
Prerequisite: lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-01
Diff against target: 593 lines (+394/-40)
4 files modified
src/plugin/placesmodel/placesmodel.cpp (+143/-34)
src/plugin/placesmodel/placesmodel.h (+23/-6)
src/plugin/test_placesmodel/placesmodeltest.cpp (+193/-0)
src/plugin/test_placesmodel/test_placesmodel.pro (+35/-0)
To merge this branch: bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-02
Reviewer Review Type Date Requested Status
Arto Jalkanen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
David Planella Pending
Review via email: mp+270335@code.launchpad.net

Commit message

    1. Added Samba Location as Network
    2. Removed default locations from setting files, it allows adding new default locations in source code
    3. Kept user added and removed locations in settings file.
    4. Created a regression test for PlacesModel.

    User can remove a default Location and then add it again.

Description of the change

Added Samba location as Network

Improved settings file content to allow add/remove places without affecting default places which are handled in the source code.

Added a regression testing for PlacesModel.

Added "/media/<user>" as watched directory because "/etc/mtab" was failing to fire changes.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Arto Jalkanen (ajalkane) wrote :

Several inlined comments. The one about removing all keys but the new ones introduced in this change is the one that needs attention, others are more minor.

review: Needs Fixing
Revision history for this message
Carlos Jose Mazieri (carlos-mazieri) wrote :

I agree with your comments and I will modify that according to that.

Thanks.

461. By Carlos Jose Mazieri

PlacesModel::addLocationWithoutStoring() renamed to PlacesModel::addLocationNotRemovedWithoutStoring()
Documented both PlacesModel::addLocation() and PlacesModel::addLocationNotRemovedWithoutStoring()

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Arto Jalkanen (ajalkane) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/plugin/placesmodel/placesmodel.cpp'
2--- src/plugin/placesmodel/placesmodel.cpp 2015-02-11 19:22:08 +0000
3+++ src/plugin/placesmodel/placesmodel.cpp 2015-09-19 22:49:08 +0000
4@@ -15,6 +15,7 @@
5 *
6 * Author : David Planella <david.planella@ubuntu.com>
7 * Arto Jalkanen <ajalkane@gmail.com>
8+ * Carlos Mazieri <carlos.mazieri@gmail.com>
9 */
10
11 #include "placesmodel.h"
12@@ -25,14 +26,20 @@
13 #include <QStandardPaths>
14 #include <QDebug>
15
16+namespace
17+{
18+ const QString userSavedLocationsName("userSavedLocations");
19+ const QString userRemovedLocationsName("userRemovedLocations");
20+}
21+
22 PlacesModel::PlacesModel(QObject *parent) :
23- QAbstractListModel(parent)
24+ QAbstractListModel(parent)
25+ , m_going_to_rescanMtab(false)
26 {
27 m_userMountLocation = "/media/" + qgetenv("USER");
28 // For example /run/user/1000
29 m_runtimeLocations = QStandardPaths::standardLocations(QStandardPaths::RuntimeLocation);
30
31- QStringList defaultLocations;
32 // Set the storage location to a path that works well
33 // with app isolation
34 QString settingsLocation =
35@@ -40,29 +47,41 @@
36 + "/" + QCoreApplication::applicationName() + "/" + "places.conf";
37 m_settings = new QSettings(settingsLocation, QSettings::IniFormat, this);
38
39+ m_userSavedLocations = m_settings->value(userSavedLocationsName).toStringList();
40+ m_userRemovedLocations = m_settings->value(userRemovedLocationsName).toStringList();
41+
42+ //remove old key "storedLocations" which is no longer used
43+ QLatin1String oldStoredLocations("storedLocations");
44+ if (m_settings->contains(oldStoredLocations)) {
45+ m_settings->remove(oldStoredLocations);
46+ }
47+
48 // Prepopulate the model with the user locations
49 // for the first time it's used
50- defaultLocations.append(locationHome());
51- defaultLocations.append(locationDocuments());
52- defaultLocations.append(locationDownloads());
53- defaultLocations.append(locationMusic());
54- defaultLocations.append(locationPictures());
55- defaultLocations.append(locationVideos());
56- // Add root also
57- defaultLocations.append("/");
58-
59- if (!m_settings->contains("storedLocations")) {
60- m_locations.append(defaultLocations);
61- } else {
62- m_locations = m_settings->value("storedLocations").toStringList();
63+ addDefaultLocation(locationHome());
64+ addDefaultLocation(locationDocuments());
65+ addDefaultLocation(locationDownloads());
66+ addDefaultLocation(locationMusic());
67+ addDefaultLocation(locationPictures());
68+ addDefaultLocation(locationVideos());
69+
70+ //Network locations
71+ addDefaultLocation(locationSamba());
72+
73+ //mounted locations
74+ addDefaultLocation("/");
75+ initNewUserMountsWatcher();
76+ rescanMtab();
77+
78+ //other user saved locations
79+ foreach (const QString& userLocation, m_userSavedLocations) {
80+ addLocationNotRemovedWithoutStoring(userLocation);
81 }
82+ m_settings->sync();
83
84 foreach (const QString &location, m_locations) {
85 qDebug() << "Location: " << location;
86 }
87-
88- initNewUserMountsWatcher();
89- rescanMtab();
90 }
91
92 PlacesModel::~PlacesModel() {
93@@ -73,17 +92,29 @@
94 PlacesModel::initNewUserMountsWatcher() {
95 m_newUserMountsWatcher = new QFileSystemWatcher(this);
96
97- qDebug() << Q_FUNC_INFO << "Start watching mtab file for new mounts" << m_mtabParser.path();
98+ connect(m_newUserMountsWatcher, SIGNAL(fileChanged(QString)), this, SLOT(mtabChanged(QString)));
99+ connect(m_newUserMountsWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(mtabChanged(QString)));
100
101 m_newUserMountsWatcher->addPath(m_mtabParser.path());
102+ /*
103+ it looks like QFileSystemWatcher does not work for /etc/mtab sometimes, lets use /media/<user> as well
104+ See:
105+ https://forum.qt.io/topic/8566/qfilesystemwatcher-not-working-with-etc-mtab
106+ https://bugs.launchpad.net/ubuntu-filemanager-app/+bug/1444367
107+ */
108+ m_newUserMountsWatcher->addPath(m_userMountLocation);
109
110- connect(m_newUserMountsWatcher, &QFileSystemWatcher::fileChanged, this, &PlacesModel::mtabChanged);
111+ qDebug() << Q_FUNC_INFO << "Start watching mtab file for new mounts, using:"
112+ << m_newUserMountsWatcher->files() << "and" << m_newUserMountsWatcher->directories();
113 }
114
115 void
116 PlacesModel::mtabChanged(const QString &path) {
117 qDebug() << Q_FUNC_INFO << "file changed in " << path;
118- rescanMtab();
119+ if (!m_going_to_rescanMtab) {
120+ m_going_to_rescanMtab = true;
121+ QTimer::singleShot(100, this, SLOT(rescanMtab()));
122+ }
123 // Since old mtab file is replaced with new contents, must readd filesystem watcher
124 m_newUserMountsWatcher->removePath(path);
125 m_newUserMountsWatcher->addPath(path);
126@@ -91,6 +122,7 @@
127
128 void
129 PlacesModel::rescanMtab() {
130+ m_going_to_rescanMtab = false;
131 const QString& path = m_mtabParser.path();
132 qDebug() << Q_FUNC_INFO << "rescanning mtab" << path;
133
134@@ -113,7 +145,7 @@
135
136 foreach (QString addedMount, addedMounts) {
137 qDebug() << Q_FUNC_INFO << "user mount added: " << addedMount;
138- addLocationWithoutStoring(addedMount);
139+ addLocationNotRemovedWithoutStoring(addedMount);
140 emit userMountAdded(addedMount);
141 }
142
143@@ -203,6 +235,11 @@
144 return standardLocation(QStandardPaths::MoviesLocation);
145 }
146
147+QString PlacesModel::locationSamba() const
148+{
149+ return QLatin1Literal("smb://");
150+}
151+
152 int PlacesModel::rowCount(const QModelIndex &parent) const
153 {
154 Q_UNUSED(parent)
155@@ -227,10 +264,30 @@
156
157 void PlacesModel::removeItem(int indexToRemove)
158 {
159- removeItemWithoutStoring(indexToRemove);
160-
161- // Remove the location permanently
162- m_settings->setValue("storedLocations", m_locations);
163+ if (indexToRemove >= 0 && indexToRemove < m_locations.count())
164+ {
165+ bool sync_settings = false;
166+ const QString & location = m_locations.at(indexToRemove);
167+ //check if the index belongs to a user saved location
168+ int index_user_location = m_userSavedLocations.indexOf(location);
169+ if (index_user_location > -1)
170+ {
171+ // Remove the User saved location permanently
172+ m_userSavedLocations.removeAt(index_user_location);
173+ m_settings->setValue(userSavedLocationsName, m_userSavedLocations);
174+ sync_settings = true;
175+ }
176+ //save it as removed location, even a default location can be removed
177+ if (!m_userRemovedLocations.contains(location)) {
178+ m_userRemovedLocations.append(location);
179+ m_settings->setValue(userRemovedLocationsName, m_userRemovedLocations);
180+ sync_settings = true;
181+ }
182+ removeItemWithoutStoring(indexToRemove);
183+ if (sync_settings) {
184+ m_settings->sync();
185+ }
186+ }
187 }
188
189 void PlacesModel::removeItemWithoutStoring(int indexToRemove)
190@@ -250,18 +307,58 @@
191 endRemoveRows();
192 }
193
194+/*!
195+ * \brief PlacesModel::addLocation()
196+ *
197+ * Adds the location permanently in the settings file.
198+ *
199+ * If the location has already been deleted by the user it is first removed from the removed settings \a m_userRemovedLocations.
200+ *
201+ * The location is saved in settings file in \a m_userSavedLocations
202+ *
203+ * \param location
204+ */
205 void PlacesModel::addLocation(const QString &location)
206-{
207- if (addLocationWithoutStoring(location)) {
208- // Store the location permanently
209- m_settings->setValue("storedLocations", m_locations);
210+{
211+ bool sync_settings = false;
212+ //verify it the user had deleted it before and now is inserting it again
213+ int indexRemoved = m_userRemovedLocations.indexOf(location);
214+ if (indexRemoved > -1) {
215+ m_userRemovedLocations.removeAt(indexRemoved);
216+ m_settings->setValue(userRemovedLocationsName, m_userRemovedLocations);
217+ sync_settings = true;
218+ }
219+ if (addLocationNotRemovedWithoutStoring(location)) {
220+ // Store the location permanently if it is not default location
221+ if (!isDefaultLocation(location) && !m_userSavedLocations.contains(location))
222+ {
223+ m_userSavedLocations.append(location);
224+ m_settings->setValue(userSavedLocationsName, m_userSavedLocations);
225+ sync_settings = true;
226+ }
227+ }
228+ if (sync_settings) {
229+ m_settings->sync();
230 }
231 }
232
233-bool PlacesModel::addLocationWithoutStoring(const QString &location)
234+/*!
235+ * \brief PlacesModel::addLocationNotRemovedWithoutStoring()
236+ *
237+ * Add that location only if it was not removed before by the user.
238+ *
239+ * When the user removes a location from Places using \ref removeItem(int index) it is stored in settings file.
240+ * The user must use \ref addLocation(const QString &location) to add back an already removed location.
241+ *
242+ * \param location
243+ *
244+ * \return true when the location was added (not existent in \a m_locations nor in \a m_userRemovedLocations),
245+ * otherwise false
246+ */
247+bool PlacesModel::addLocationNotRemovedWithoutStoring(const QString &location)
248 {
249- // Do not allow for duplicates
250- if (!m_locations.contains(location)) {
251+ // Do not allow for duplicates and look for removed locations from settings
252+ if (!m_locations.contains(location) && !m_userRemovedLocations.contains(location)) {
253 // Tell Qt that we're going to be changing the model
254 // There's no tree-parent, first new item will be at
255 // m_locations.count(), and the last one too
256@@ -270,7 +367,6 @@
257 // Append the actual location
258 m_locations.append(location);
259
260-
261 // Tell Qt we're done with modifying the model so that
262 // it can update the UI and everything else to reflect
263 // the new state
264@@ -279,3 +375,16 @@
265 }
266 return false;
267 }
268+
269+void PlacesModel::addDefaultLocation(const QString &location)
270+{
271+ // a Default location can be removed by the user
272+ if (addLocationNotRemovedWithoutStoring(location)) {
273+ m_defaultLocations.append(location);
274+ }
275+}
276+
277+void PlacesModel::removeItem(const QString &location)
278+{
279+ removeItem(m_locations.indexOf(location));
280+}
281
282=== modified file 'src/plugin/placesmodel/placesmodel.h'
283--- src/plugin/placesmodel/placesmodel.h 2015-01-28 20:18:07 +0000
284+++ src/plugin/placesmodel/placesmodel.h 2015-09-19 22:49:08 +0000
285@@ -40,6 +40,7 @@
286 Q_PROPERTY(QString locationMusic READ locationMusic CONSTANT)
287 Q_PROPERTY(QString locationPictures READ locationPictures CONSTANT)
288 Q_PROPERTY(QString locationVideos READ locationVideos CONSTANT)
289+ Q_PROPERTY(QString locationSamba READ locationSamba CONSTANT)
290
291 public:
292 explicit PlacesModel(QObject *parent = 0);
293@@ -50,7 +51,8 @@
294 QString locationMusic() const;
295 QString locationPictures() const;
296 QString locationVideos() const;
297- int rowCount(const QModelIndex &parent) const override;
298+ QString locationSamba() const;
299+ int rowCount(const QModelIndex &parent = QModelIndex() ) const override;
300 QVariant data(const QModelIndex &index, int role) const override;
301 QHash<int, QByteArray> roleNames() const override;
302
303@@ -61,20 +63,28 @@
304 public slots:
305 void addLocation(const QString &location);
306 void removeItem(int indexToRemove);
307- inline bool isUserMountDirectory(const QString location) {
308+ inline bool isUserMountDirectory(const QString& location) {
309 return m_userMounts.contains(location);
310 }
311+ bool isDefaultLocation(const QString& location) const {
312+ return m_defaultLocations.contains(location);
313+ }
314+ inline int indexOfLocation(const QString& location) const {
315+ return m_locations.indexOf(location);
316+ }
317
318 private slots:
319 void mtabChanged(const QString &path);
320 void rescanMtab();
321
322 private:
323- void initNewUserMountsWatcher();
324- // Returns true if location was not known before, and false if it was known
325- bool addLocationWithoutStoring(const QString &location);
326+ void initNewUserMountsWatcher();
327+ bool addLocationNotRemovedWithoutStoring(const QString &location);
328 // Returns true if location was not known before, and false if it was known
329 void removeItemWithoutStoring(int itemToRemove);
330+ //just add into m_locations, does not emit any signal
331+ void addDefaultLocation(const QString& location);
332+ void removeItem(const QString& location);
333
334 QMtabParser m_mtabParser;
335 QStringList m_runtimeLocations;
336@@ -82,10 +92,17 @@
337 bool isMtabEntryUserMount(const QMtabEntry &entry) const;
338 bool isSubDirectory(const QString &dir, const QString &path) const;
339 QString standardLocation(QStandardPaths::StandardLocation location) const;
340- QStringList m_locations;
341+ QStringList m_locations; //<! m_locations = m_defaultLocations + m_userSavedLocations - m_userRemovedLocations
342+ QStringList m_defaultLocations;
343+ QStringList m_userSavedLocations;
344+ QStringList m_userRemovedLocations;
345 QSettings *m_settings;
346 QFileSystemWatcher *m_newUserMountsWatcher;
347 QSet<QString> m_userMounts;
348+ bool m_going_to_rescanMtab;
349+#if defined(REGRESSION_TEST_PLACES_MODEL)
350+ friend class PlacesmodelTest;
351+#endif
352 };
353
354 #endif // PLACESMODEL_H
355
356=== added directory 'src/plugin/test_placesmodel'
357=== added file 'src/plugin/test_placesmodel/placesmodeltest.cpp'
358--- src/plugin/test_placesmodel/placesmodeltest.cpp 1970-01-01 00:00:00 +0000
359+++ src/plugin/test_placesmodel/placesmodeltest.cpp 2015-09-19 22:49:08 +0000
360@@ -0,0 +1,193 @@
361+#include "placesmodel.h"
362+
363+#include <QString>
364+#include <QtTest>
365+#include <QSettings>
366+#include <QFile>
367+#include <QFileInfo>
368+#include <QTemporaryFile>
369+#include <QTemporaryDir>
370+
371+
372+class SaveSettings: public QTemporaryFile
373+{
374+public:
375+ SaveSettings(QObject *parent = 0) : QTemporaryFile(parent) {}
376+ bool openReadOnly()
377+ {
378+ return open(QFile::ReadOnly);
379+ }
380+};
381+
382+class PlacesmodelTest : public QObject
383+{
384+ Q_OBJECT
385+
386+public:
387+ PlacesmodelTest();
388+
389+private Q_SLOTS:
390+ void init();
391+ void cleanup();
392+ void cleanupTestCase();
393+ void addUserPlace();
394+ void removeUserPlace();
395+ void addExistentDefaultPlace(); // should fail
396+ void removeDefaultPlace();
397+ void addRemovedDefaultPlace();
398+private:
399+ SaveSettings *m_saved_settings;
400+};
401+
402+
403+PlacesmodelTest::PlacesmodelTest() : m_saved_settings(0)
404+{
405+
406+}
407+
408+void PlacesmodelTest::init()
409+{
410+ PlacesModel places;
411+ QFileInfo saved(places.m_settings->fileName());
412+ if (saved.exists())
413+ {
414+ QFile settings(saved.absoluteFilePath());
415+ QCOMPARE(settings.open(QFile::ReadOnly), true);
416+ m_saved_settings = new SaveSettings(this);
417+ QCOMPARE(m_saved_settings->open(), true);
418+ QByteArray settings_data = settings.readAll();
419+ QCOMPARE(m_saved_settings->write(settings_data), (qint64)settings_data.size());
420+ m_saved_settings->close();
421+ }
422+}
423+
424+void PlacesmodelTest::cleanupTestCase()
425+{
426+ if (m_saved_settings)
427+ {
428+ QCOMPARE(m_saved_settings->openReadOnly(), true);
429+ PlacesModel places;
430+ QFile saved(places.m_settings->fileName());
431+ QCOMPARE(saved.open(QFile::WriteOnly | QFile::Truncate), true);
432+ QByteArray saved_data = m_saved_settings->readAll();
433+ QCOMPARE(saved.write(saved_data), (qint64)saved_data.size());
434+ }
435+}
436+
437+void PlacesmodelTest::cleanup()
438+{
439+ cleanupTestCase();
440+}
441+
442+void PlacesmodelTest::addUserPlace()
443+{
444+ QTemporaryDir tempDir;
445+ PlacesModel places;
446+ int locations_counter = places.rowCount();
447+ QCOMPARE(places.indexOfLocation(tempDir.path()), -1);
448+ places.addLocation(tempDir.path());
449+ QTest::qWait(50);
450+ QCOMPARE(places.rowCount(), locations_counter + 1);
451+ QVERIFY(places.indexOfLocation(tempDir.path()) != -1);
452+
453+ //now try to add it again which must fail
454+ places.addLocation(tempDir.path());
455+ QTest::qWait(50);
456+ QCOMPARE(places.rowCount(), locations_counter + 1);
457+
458+ //another model instance
459+ PlacesModel places2;
460+ QVERIFY(places2.indexOfLocation(tempDir.path()) != -1);
461+ //added item must be in m_userSavedLocations
462+ QVERIFY(places2.m_userSavedLocations.indexOf(tempDir.path()) != -1);
463+ QCOMPARE(places2.rowCount(), locations_counter + 1);
464+}
465+
466+void PlacesmodelTest::removeUserPlace()
467+{
468+ // first add a temporary place
469+ QTemporaryDir tempDir;
470+ PlacesModel places;
471+ int locations_counter = places.rowCount();
472+ QCOMPARE(places.indexOfLocation(tempDir.path()), -1);
473+ places.addLocation(tempDir.path());
474+ QTest::qWait(50);
475+ QCOMPARE(places.rowCount(), locations_counter + 1);
476+ QVERIFY(places.indexOfLocation(tempDir.path()) != -1);
477+ //then remove it
478+ places.removeItem(tempDir.path());
479+ QTest::qWait(50);
480+ QCOMPARE(places.rowCount(), locations_counter);
481+ QCOMPARE(places.indexOfLocation(tempDir.path()), -1);
482+
483+ //another PlacesModel instance
484+ PlacesModel places2;
485+ QCOMPARE(places2.rowCount(), locations_counter);
486+ //item removed is not in the m_locations
487+ QCOMPARE(places2.indexOfLocation(tempDir.path()), -1);
488+ //item removed is in m_userRemovedLocations
489+ QVERIFY(places2.m_userRemovedLocations.indexOf(tempDir.path()) != -1);
490+}
491+
492+void PlacesmodelTest::addExistentDefaultPlace()
493+{
494+ PlacesModel places;
495+ int home_index = places.indexOfLocation(QDir::homePath());
496+ QVERIFY(home_index != -1);
497+ int places_counter = places.rowCount();
498+ places.addLocation(QDir::homePath());
499+ QTest::qWait(50);
500+ //counter must be the same which indicates nothing was added
501+ QCOMPARE(places.rowCount(), places_counter);
502+}
503+
504+void PlacesmodelTest::removeDefaultPlace()
505+{
506+ PlacesModel places;
507+ int home_index = places.indexOfLocation(QDir::homePath());
508+ QVERIFY(home_index != -1);
509+ int places_counter = places.rowCount();
510+ places.removeItem(home_index);
511+ QTest::qWait(50);
512+ QCOMPARE(places.rowCount(), places_counter - 1);
513+ QCOMPARE(places.indexOfLocation(QDir::homePath()), -1);
514+
515+ //use another instance to check
516+ PlacesModel places2;
517+ QCOMPARE(places2.rowCount(), places_counter - 1);
518+ QCOMPARE(places2.indexOfLocation(QDir::homePath()), -1);
519+ //default place is in m_userRemovedLocations
520+ QVERIFY(places2.m_userRemovedLocations.indexOf(QDir::homePath()) != -1);
521+}
522+
523+void PlacesmodelTest::addRemovedDefaultPlace()
524+{
525+ //first remove a default place
526+ PlacesModel places;
527+ int home_index = places.indexOfLocation(QDir::homePath());
528+ QVERIFY(home_index != -1);
529+ int places_counter = places.rowCount();
530+ places.removeItem(home_index);
531+ QTest::qWait(50);
532+ QCOMPARE(places.rowCount(), places_counter - 1);
533+ QCOMPARE(places.indexOfLocation(QDir::homePath()), -1);
534+
535+ //now add the default location back
536+ places.addLocation(QDir::homePath());
537+ QTest::qWait(50);
538+ QCOMPARE(places.rowCount(), places_counter);
539+ QVERIFY(places.indexOfLocation(QDir::homePath()) != -1);
540+ //it must not exist neither on m_userSavedLocations nor m_userRemovedLocations
541+ QCOMPARE(places.m_userSavedLocations.indexOf(QDir::homePath()), -1);
542+ QCOMPARE(places.m_userRemovedLocations.indexOf(QDir::homePath()), -1);
543+
544+ //check on a second instance
545+ PlacesModel places2;
546+ QVERIFY(places2.indexOfLocation(QDir::homePath()) != -1);
547+ QCOMPARE(places2.m_userSavedLocations.indexOf(QDir::homePath()), -1);
548+ QCOMPARE(places2.m_userRemovedLocations.indexOf(QDir::homePath()), -1);
549+}
550+
551+QTEST_MAIN(PlacesmodelTest)
552+
553+#include "placesmodeltest.moc"
554
555=== added file 'src/plugin/test_placesmodel/test_placesmodel.pro'
556--- src/plugin/test_placesmodel/test_placesmodel.pro 1970-01-01 00:00:00 +0000
557+++ src/plugin/test_placesmodel/test_placesmodel.pro 2015-09-19 22:49:08 +0000
558@@ -0,0 +1,35 @@
559+#-------------------------------------------------
560+#
561+# Project created by QtCreator 2015-09-05T17:37:49
562+#
563+#-------------------------------------------------
564+
565+QT += testlib
566+
567+QT -= gui
568+
569+TARGET = tst_placesmodeltest
570+CONFIG += console
571+CONFIG += testcase
572+CONFIG -= app_bundle
573+
574+TEMPLATE = app
575+
576+DEFINES += REGRESSION_TEST_PLACES_MODEL
577+
578+DEFINES += SRCDIR=\\\"$$PWD/\\\"
579+
580+QMAKE_CXXFLAGS += -std=c++11
581+
582+
583+SOURCES += placesmodeltest.cpp \
584+ ../placesmodel/placesmodel.cpp \
585+ ../placesmodel/qmtabparser.cpp
586+
587+
588+HEADERS += \
589+ ../placesmodel/placesmodel.h \
590+ ../placesmodel/qmtabparser.h
591+
592+
593+INCLUDEPATH += ../placesmodel

Subscribers

People subscribed via source and target branches