Merge lp:~saviq/qtmir/use-qstandardpaths-cache into lp:qtmir

Proposed by Michał Sawicz on 2016-01-13
Status: Merged
Approved by: Albert Astals Cid on 2016-01-28
Approved revision: 436
Merged at revision: 447
Proposed branch: lp:~saviq/qtmir/use-qstandardpaths-cache
Merge into: lp:qtmir
Diff against target: 60 lines (+15/-4)
2 files modified
src/modules/Unity/Application/application.cpp (+1/-1)
tests/modules/ApplicationManager/application_manager_test.cpp (+14/-3)
To merge this branch: bzr merge lp:~saviq/qtmir/use-qstandardpaths-cache
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) 2016-01-13 Approve on 2016-01-28
PS Jenkins bot continuous-integration Needs Fixing on 2016-01-27
Unity8 CI Bot continuous-integration Approve on 2016-01-27
Review via email: mp+282394@code.launchpad.net

Commit Message

Use QStandardPaths to determine QML cache location

Also use temporary XDG_CACHE_HOME in ApplicationManagerTests so we don't pollute user's $HOME

Description of the Change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
N
 * Did you perform an exploratory manual test run of your code change and any related functionality?
Y
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

To post a comment you must log in.
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:435
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-1-ci/1/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-1-ci/1/rebuild

review: Approve (continuous-integration)
Albert Astals Cid (aacid) wrote :

We actually want GenericCacheLocation and not CacheLocation, no?

review: Needs Fixing
436. By Michał Sawicz on 2016-01-27

Use GenericCacheLocation instead

Michał Sawicz (saviq) wrote :

> We actually want GenericCacheLocation and not CacheLocation, no?

Fixeded.

Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:436
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-1-ci/39/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-1-ci/39/rebuild

review: Approve (continuous-integration)
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
Not the ¿wily? tests

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/application.cpp'
2--- src/modules/Unity/Application/application.cpp 2016-01-22 16:32:39 +0000
3+++ src/modules/Unity/Application/application.cpp 2016-01-27 17:04:51 +0000
4@@ -106,7 +106,7 @@
5
6 void Application::wipeQMLCache()
7 {
8- QString path(QDir::homePath() + QStringLiteral("/.cache/QML/Apps/"));
9+ QString path(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/QML/Apps/"));
10 QDir dir(path);
11 QStringList apps = dir.entryList();
12 for (int i = 0; i < apps.size(); i++) {
13
14=== modified file 'tests/modules/ApplicationManager/application_manager_test.cpp'
15--- tests/modules/ApplicationManager/application_manager_test.cpp 2016-01-22 16:32:39 +0000
16+++ tests/modules/ApplicationManager/application_manager_test.cpp 2016-01-27 17:04:51 +0000
17@@ -67,6 +67,14 @@
18 applicationManager.onProcessSuspended(application->appId());
19 ASSERT_EQ(Application::InternalState::Suspended, application->internalState());
20 }
21+
22+protected:
23+ virtual void SetUp() override {
24+ if (m_tempDir.isValid()) qputenv("XDG_CACHE_HOME", m_tempDir.path().toUtf8());
25+ }
26+
27+private:
28+ const QTemporaryDir m_tempDir;
29 };
30
31 TEST_F(ApplicationManagerTests,bug_case_1240400_second_dialer_app_fails_to_authorize_and_gets_mixed_up_with_first_one)
32@@ -1873,7 +1881,8 @@
33 onSessionStarting(session);
34
35 // Create fake QML cache for this app
36- QString path(QDir::homePath() + QStringLiteral("/.cache/QML/Apps/") + appId);
37+ QString path(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)
38+ + QStringLiteral("/QML/Apps/") + appId);
39 QDir dir(path);
40 dir.mkpath(path);
41
42@@ -1918,7 +1927,8 @@
43 ASSERT_EQ(Application::InternalState::Running, the_app->internalState());
44
45 // Create fake QML cache for this app
46- QString path(QDir::homePath() + QStringLiteral("/.cache/QML/Apps/") + appId);
47+ QString path(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)
48+ + QStringLiteral("/QML/Apps/") + appId);
49 QDir dir(path);
50 dir.mkpath(path);
51
52@@ -1966,7 +1976,8 @@
53 ASSERT_EQ(Application::InternalState::Running, the_app->internalState());
54
55 // Create fake QML cache for this app
56- QString path(QDir::homePath() + QStringLiteral("/.cache/QML/Apps/") + appId);
57+ QString path(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)
58+ + QStringLiteral("/QML/Apps/") + appId);
59 QDir dir(path);
60 dir.mkpath(path);
61

Subscribers

People subscribed via source and target branches