Merge lp:~ted/ubuntu-app-launch/icon-basepath into lp:ubuntu-app-launch/16.10

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 261
Merged at revision: 258
Proposed branch: lp:~ted/ubuntu-app-launch/icon-basepath
Merge into: lp:ubuntu-app-launch/16.10
Prerequisite: lp:~ci-train-bot/ubuntu-app-launch/ubuntu-app-launch-ubuntu-yakkety-landing-1944
Diff against target: 445 lines (+106/-51)
8 files modified
libubuntu-app-launch/application-impl-click.cpp (+2/-1)
libubuntu-app-launch/application-impl-legacy.cpp (+10/-2)
libubuntu-app-launch/application-impl-libertine.cpp (+16/-8)
libubuntu-app-launch/application-impl-libertine.h (+4/-1)
libubuntu-app-launch/application-impl-snap.cpp (+1/-0)
libubuntu-app-launch/application-info-desktop.cpp (+24/-7)
libubuntu-app-launch/application-info-desktop.h (+2/-0)
tests/application-info-desktop.cpp (+47/-32)
To merge this branch: bzr merge lp:~ted/ubuntu-app-launch/icon-basepath
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration Approve
Larry Price Approve
Unity API Team Pending
Review via email: mp+305724@code.launchpad.net

This proposal supersedes a proposal from 2016-09-13.

Commit message

Set a base directory for icons that have a full path specified in their desktop file

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:259
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/96/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/643
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/649
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/465
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/465/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/465
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/465/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/465
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/465/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/465
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/465/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/465
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/465/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/465
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/465/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/465
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/465/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/465
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/465/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/465
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/465/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/96/rebuild

review: Approve (continuous-integration)
260. By Ted Gould

Make it so that we use filename on full filenames even if we have a registry

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:260
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/98/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/645
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/651
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/467
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/467/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/467
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/467/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/467
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/467/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/467
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/467/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/467
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/467/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/467
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/467/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/467
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/467/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/467
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/467/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/467
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/467/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/98/rebuild

review: Approve (continuous-integration)
Revision history for this message
Larry Price (larryprice) wrote :

looks good to me - verified addresses some of those troublesome libertine apps such as supertuxkart on vivid.

review: Approve
261. By Ted Gould

Make sure that we are using a root that makes sense

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:261
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/101/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/649
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/655
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/471
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/471/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/471
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/471/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/471
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/471/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/471
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/471/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/471
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/471/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/471
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/471/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/471
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/471/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/471
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/471/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/471
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/471/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/101/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libubuntu-app-launch/application-impl-click.cpp'
2--- libubuntu-app-launch/application-impl-click.cpp 2016-09-14 22:21:42 +0000
3+++ libubuntu-app-launch/application-impl-click.cpp 2016-09-14 22:21:43 +0000
4@@ -171,7 +171,8 @@
5 {
6 if (!_info)
7 {
8- _info = std::make_shared<app_info::Desktop>(_keyfile, _clickDir, app_info::DesktopFlags::NONE, nullptr);
9+ _info =
10+ std::make_shared<app_info::Desktop>(_keyfile, _clickDir, _clickDir, app_info::DesktopFlags::NONE, nullptr);
11 }
12
13 return _info;
14
15=== modified file 'libubuntu-app-launch/application-impl-legacy.cpp'
16--- libubuntu-app-launch/application-impl-legacy.cpp 2016-09-14 22:21:42 +0000
17+++ libubuntu-app-launch/application-impl-legacy.cpp 2016-09-14 22:21:43 +0000
18@@ -54,8 +54,16 @@
19 {
20 std::tie(_basedir, _keyfile, desktopPath_) = keyfileForApp(appname);
21
22- appinfo_ =
23- std::make_shared<app_info::Desktop>(_keyfile, _basedir, app_info::DesktopFlags::ALLOW_NO_DISPLAY, _registry);
24+ std::string rootDir = "";
25+ auto rootenv = g_getenv("UBUNTU_APP_LAUNCH_LEGACY_ROOT");
26+ if (rootenv != nullptr && /* Check that we have an alternate root available */
27+ g_str_has_prefix(_basedir.c_str(), rootenv))
28+ { /* And check that we found this in that root */
29+ rootDir = rootenv;
30+ }
31+
32+ appinfo_ = std::make_shared<app_info::Desktop>(_keyfile, _basedir, rootDir,
33+ app_info::DesktopFlags::ALLOW_NO_DISPLAY, _registry);
34
35 if (!_keyfile)
36 {
37
38=== modified file 'libubuntu-app-launch/application-impl-libertine.cpp'
39--- libubuntu-app-launch/application-impl-libertine.cpp 2016-09-14 22:21:42 +0000
40+++ libubuntu-app-launch/application-impl-libertine.cpp 2016-09-14 22:21:43 +0000
41@@ -27,7 +27,7 @@
42 {
43 namespace app_impls
44 {
45-
46+
47 Libertine::Libertine(const AppID::Package& container,
48 const AppID::AppName& appname,
49 const std::shared_ptr<Registry>& registry)
50@@ -35,13 +35,18 @@
51 , _container(container)
52 , _appname(appname)
53 {
54+ auto gcontainer_path = libertine_container_path(container.value().c_str());
55+ if (gcontainer_path != nullptr)
56+ {
57+ _container_path = gcontainer_path;
58+ g_free(gcontainer_path);
59+ }
60+
61 if (!_keyfile)
62 {
63- auto container_path = libertine_container_path(container.value().c_str());
64- auto system_app_path = g_build_filename(container_path, "usr", "share", nullptr);
65+ auto system_app_path = g_build_filename(_container_path.c_str(), "usr", "share", nullptr);
66 _basedir = system_app_path;
67 g_free(system_app_path);
68- g_free(container_path);
69
70 _keyfile = findDesktopFile(_basedir, "applications", appname.value() + ".desktop");
71 }
72@@ -83,7 +88,9 @@
73 return keyfile;
74 }
75
76-std::shared_ptr<GKeyFile> Libertine::findDesktopFile(const std::string& basepath, const std::string& subpath, const std::string& filename)
77+std::shared_ptr<GKeyFile> Libertine::findDesktopFile(const std::string& basepath,
78+ const std::string& subpath,
79+ const std::string& filename)
80 {
81 auto fullpath = g_build_filename(basepath.c_str(), subpath.c_str(), filename.c_str(), nullptr);
82 std::string sfullpath(fullpath);
83@@ -97,7 +104,8 @@
84 GError* error = nullptr;
85 auto dirpath = g_build_filename(basepath.c_str(), subpath.c_str(), nullptr);
86 GDir* dir = g_dir_open(dirpath, 0, &error);
87- if (error != NULL) {
88+ if (error != nullptr)
89+ {
90 g_error_free(error);
91 g_free(dirpath);
92 return {};
93@@ -252,8 +260,8 @@
94 {
95 if (!appinfo_)
96 {
97- appinfo_ =
98- std::make_shared<app_info::Desktop>(_keyfile, _basedir, app_info::DesktopFlags::XMIR_DEFAULT, _registry);
99+ appinfo_ = std::make_shared<app_info::Desktop>(_keyfile, _basedir, _container_path,
100+ app_info::DesktopFlags::XMIR_DEFAULT, _registry);
101 }
102 return appinfo_;
103 }
104
105=== modified file 'libubuntu-app-launch/application-impl-libertine.h'
106--- libubuntu-app-launch/application-impl-libertine.h 2016-09-14 22:21:42 +0000
107+++ libubuntu-app-launch/application-impl-libertine.h 2016-09-14 22:21:43 +0000
108@@ -84,13 +84,16 @@
109 private:
110 AppID::Package _container;
111 AppID::AppName _appname;
112+ std::string _container_path;
113 std::shared_ptr<GKeyFile> _keyfile;
114 std::string _basedir;
115 std::shared_ptr<app_info::Desktop> appinfo_;
116
117 std::list<std::pair<std::string, std::string>> launchEnv();
118 static std::shared_ptr<GKeyFile> keyfileFromPath(const std::string& pathname);
119- static std::shared_ptr<GKeyFile> findDesktopFile(const std::string& basepath, const std::string& subpath, const std::string& filename);
120+ static std::shared_ptr<GKeyFile> findDesktopFile(const std::string& basepath,
121+ const std::string& subpath,
122+ const std::string& filename);
123 };
124
125 } // namespace app_impls
126
127=== modified file 'libubuntu-app-launch/application-impl-snap.cpp'
128--- libubuntu-app-launch/application-impl-snap.cpp 2016-09-14 22:21:42 +0000
129+++ libubuntu-app-launch/application-impl-snap.cpp 2016-09-14 22:21:43 +0000
130@@ -80,6 +80,7 @@
131 return keyfile;
132 }(),
133 snapDir,
134+ snapDir,
135 app_info::DesktopFlags::NONE,
136 registry)
137 , interface_(interface)
138
139=== modified file 'libubuntu-app-launch/application-info-desktop.cpp'
140--- libubuntu-app-launch/application-info-desktop.cpp 2016-09-14 22:21:42 +0000
141+++ libubuntu-app-launch/application-info-desktop.cpp 2016-09-14 22:21:43 +0000
142@@ -67,7 +67,8 @@
143
144 template <typename T>
145 auto fileFromKeyfile(std::shared_ptr<GKeyFile> keyfile,
146- const std::string basePath,
147+ const std::string& basePath,
148+ const std::string& rootDir,
149 const std::string& key,
150 const std::string& exceptionText = {}) -> T
151 {
152@@ -89,6 +90,14 @@
153 if (keyval[0] == '/')
154 {
155 T retval = T::from_raw(keyval);
156+
157+ if (!rootDir.empty())
158+ {
159+ auto fullpath = g_build_filename(rootDir.c_str(), keyval, nullptr);
160+ retval = T::from_raw(fullpath);
161+ g_free(fullpath);
162+ }
163+
164 g_free(keyval);
165 return retval;
166 }
167@@ -187,6 +196,7 @@
168
169 Desktop::Desktop(std::shared_ptr<GKeyFile> keyfile,
170 const std::string& basePath,
171+ const std::string& rootDir,
172 std::bitset<2> flags,
173 std::shared_ptr<Registry> registry)
174 : _keyfile([keyfile, flags]() {
175@@ -222,26 +232,33 @@
176 return keyfile;
177 }())
178 , _basePath(basePath)
179+ , _rootDir(rootDir)
180 , _name(stringFromKeyfile<Application::Info::Name>(keyfile, "Name", "Unable to get name from keyfile"))
181 , _description(stringFromKeyfile<Application::Info::Description>(keyfile, "Comment"))
182- , _iconPath([keyfile, basePath, registry]() {
183+ , _iconPath([keyfile, basePath, rootDir, registry]() {
184 if (registry != nullptr)
185 {
186 auto iconName =
187 stringFromKeyfile<Application::Info::IconPath>(keyfile, "Icon", "Missing icon for desktop file");
188- return registry->impl->getIconFinder(basePath)->find(iconName);
189+
190+ if (!iconName.value().empty() && iconName.value()[0] != '/')
191+ {
192+ /* If it is not a direct filename look it up */
193+ return registry->impl->getIconFinder(basePath)->find(iconName);
194+ }
195 }
196- return fileFromKeyfile<Application::Info::IconPath>(keyfile, basePath, "Icon", "Missing icon for desktop file");
197+ return fileFromKeyfile<Application::Info::IconPath>(keyfile, basePath, rootDir, "Icon",
198+ "Missing icon for desktop file");
199 }())
200 , _defaultDepartment(
201 stringFromKeyfile<Application::Info::DefaultDepartment>(keyfile, "X-Ubuntu-Default-Department-ID"))
202- , _screenshotPath([keyfile, basePath]() {
203- return fileFromKeyfile<Application::Info::IconPath>(keyfile, basePath, "X-Screenshot");
204+ , _screenshotPath([keyfile, basePath, rootDir]() {
205+ return fileFromKeyfile<Application::Info::IconPath>(keyfile, basePath, rootDir, "X-Screenshot");
206 }())
207 , _keywords(stringlistFromKeyfile<Application::Info::Keywords>(keyfile, "Keywords"))
208 , _splashInfo(
209 {stringFromKeyfile<Application::Info::Splash::Title>(keyfile, "X-Ubuntu-Splash-Title"),
210- fileFromKeyfile<Application::Info::Splash::Image>(keyfile, basePath, "X-Ubuntu-Splash-Image"),
211+ fileFromKeyfile<Application::Info::Splash::Image>(keyfile, basePath, rootDir, "X-Ubuntu-Splash-Image"),
212 stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color"),
213 stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color-Header"),
214 stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color-Footer"),
215
216=== modified file 'libubuntu-app-launch/application-info-desktop.h'
217--- libubuntu-app-launch/application-info-desktop.h 2016-09-14 22:21:42 +0000
218+++ libubuntu-app-launch/application-info-desktop.h 2016-09-14 22:21:43 +0000
219@@ -43,6 +43,7 @@
220 public:
221 Desktop(std::shared_ptr<GKeyFile> keyfile,
222 const std::string& basePath,
223+ const std::string& rootDir,
224 std::bitset<2> flags,
225 std::shared_ptr<Registry> registry);
226
227@@ -108,6 +109,7 @@
228 protected:
229 std::shared_ptr<GKeyFile> _keyfile;
230 std::string _basePath;
231+ std::string _rootDir;
232
233 Application::Info::Name _name;
234 Application::Info::Description _description;
235
236=== modified file 'tests/application-info-desktop.cpp'
237--- tests/application-info-desktop.cpp 2016-09-14 22:21:42 +0000
238+++ tests/application-info-desktop.cpp 2016-09-14 22:21:43 +0000
239@@ -59,7 +59,7 @@
240
241 TEST_F(ApplicationInfoDesktop, DefaultState)
242 {
243- auto appinfo = ubuntu::app_launch::app_info::Desktop(defaultKeyfile(), "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr);
244+ auto appinfo = ubuntu::app_launch::app_info::Desktop(defaultKeyfile(), "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr);
245
246 EXPECT_EQ("Foo App", appinfo.name().value());
247 EXPECT_EQ("", appinfo.description().value());
248@@ -86,33 +86,33 @@
249 TEST_F(ApplicationInfoDesktop, KeyfileErrors)
250 {
251 // empty
252- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop({}, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
253+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop({}, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
254
255 // empty name
256 auto noname = defaultKeyfile();
257 g_key_file_remove_key(noname.get(), DESKTOP, "Name", nullptr);
258- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(noname, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
259+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(noname, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
260
261 // empty icon
262 auto noicon = defaultKeyfile();
263 g_key_file_remove_key(noicon.get(), DESKTOP, "Icon", nullptr);
264- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(noicon, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
265+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(noicon, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
266
267 // wrong type
268 auto wrongtype = defaultKeyfile();
269 g_key_file_set_string(wrongtype.get(), DESKTOP, "Type", "MimeType");
270- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(wrongtype, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
271+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(wrongtype, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
272
273 // not displayable
274 auto nodisplay = defaultKeyfile();
275 g_key_file_set_boolean(nodisplay.get(), DESKTOP, "NoDisplay", TRUE);
276- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(nodisplay, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
277- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(nodisplay, "/", ubuntu::app_launch::app_info::DesktopFlags::ALLOW_NO_DISPLAY, nullptr));
278+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(nodisplay, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
279+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(nodisplay, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::ALLOW_NO_DISPLAY, nullptr));
280
281 // hidden
282 auto hidden = defaultKeyfile();
283 g_key_file_set_string(hidden.get(), DESKTOP, "Hidden", "true");
284- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(hidden, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
285+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(hidden, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
286
287 /* Disabling for OTA11 */
288 #if 0
289@@ -128,18 +128,33 @@
290 #endif
291 }
292
293+TEST_F(ApplicationInfoDesktop, KeyfileIconPatterns)
294+{
295+ auto defkeyfile = defaultKeyfile();
296+ std::string datadir = "/foo/usr/share";
297+ std::string basedir = "/foo";
298+
299+ auto defappinfo = ubuntu::app_launch::app_info::Desktop(defkeyfile, datadir, basedir, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr);
300+ EXPECT_EQ("/foo/usr/share/foo.png", defappinfo.iconPath().value());
301+
302+ auto rootkeyfile = defaultKeyfile();
303+ g_key_file_set_string(rootkeyfile.get(), DESKTOP, "Icon", "/bar/foo.png");
304+ auto rootappinfo = ubuntu::app_launch::app_info::Desktop(rootkeyfile, datadir, basedir, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr);
305+ EXPECT_EQ("/foo/bar/foo.png", rootappinfo.iconPath().value());
306+}
307+
308 TEST_F(ApplicationInfoDesktop, KeyfileDefaultDepartment)
309 {
310 auto keyfile = defaultKeyfile();
311 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Default-Department-ID", "foo");
312- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
313+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
314 }
315
316 TEST_F(ApplicationInfoDesktop, KeyfileScreenshotPath)
317 {
318 auto keyfile = defaultKeyfile();
319 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Screenshot", "foo.png");
320- EXPECT_EQ("/foo.png", ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).screenshotPath().value());
321+ EXPECT_EQ("/foo.png", ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).screenshotPath().value());
322 }
323
324 TEST_F(ApplicationInfoDesktop, KeyfileKeywords)
325@@ -148,7 +163,7 @@
326
327 auto keyfile = defaultKeyfile();
328 g_key_file_set_string(keyfile.get(), DESKTOP, "Keywords", "foo;bar;baz;");
329- EXPECT_EQ(expectedKeywords, ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).keywords().value());
330+ EXPECT_EQ(expectedKeywords, ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).keywords().value());
331 }
332
333 TEST_F(ApplicationInfoDesktop, KeyfileShowListEdgeCases)
334@@ -156,17 +171,17 @@
335 // Not appearing in not show list
336 auto notshowin = defaultKeyfile();
337 g_key_file_set_string(notshowin.get(), DESKTOP, "NotShowIn", "Gnome;KDE;");
338- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(notshowin, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
339+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(notshowin, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
340
341 // Appearing explicitly in only show list
342 auto onlyshowin = defaultKeyfile();
343 g_key_file_set_string(onlyshowin.get(), DESKTOP, "OnlyShowIn", (test_dekstop_env + ";Gnome;").c_str());
344- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(onlyshowin, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
345+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(onlyshowin, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
346
347 // Appearing explicitly in only show list not first
348 auto onlyshowinmiddle = defaultKeyfile();
349 g_key_file_set_string(onlyshowinmiddle.get(), DESKTOP, "OnlyShowIn", ("Gnome;" + test_dekstop_env + ";KDE;").c_str());
350- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(onlyshowinmiddle, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
351+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(onlyshowinmiddle, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
352 }
353
354 TEST_F(ApplicationInfoDesktop, Orientations)
355@@ -185,72 +200,72 @@
356
357 auto keyfile = defaultKeyfile();
358
359- EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
360+ EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
361
362 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "this should not parse");
363- EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
364+ EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
365
366 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "this;should;not;parse;");
367- EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
368+ EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
369
370 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "portrait;");
371 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: false, invertedPortrait: false, invertedLandscape: false}),
372- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
373+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
374
375 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "landscape;portrait;");
376 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: false, invertedLandscape: false}),
377- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
378+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
379
380 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "landscape ; portrait; invertedPortrait");
381 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: true, invertedLandscape: false}),
382- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
383+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
384
385 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "portrait;landscape;");
386 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: false, invertedLandscape: false}),
387- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
388+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
389
390 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "portrait;landscape;invertedportrait;invertedlandscape;");
391 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: true, invertedLandscape: true}),
392- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
393+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
394
395 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "PORTRAIT;");
396 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: false, invertedPortrait: false, invertedLandscape: false}),
397- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
398+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
399
400 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "pOrTraIt;lANDscApE;inVErtEDpORtrAit;iNVErtEDLAnDsCapE;");
401 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: true, invertedLandscape: true}),
402- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
403+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
404
405 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "primary;");
406 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: false, landscape: false, invertedPortrait: false, invertedLandscape: false}),
407- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
408+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
409
410 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "foobar;primary;");
411 EXPECT_EQ(defaultOrientations,
412- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
413+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
414 }
415
416 TEST_F(ApplicationInfoDesktop, XMirCases)
417 {
418 auto xmirunset = defaultKeyfile();
419 EXPECT_FALSE(
420- ubuntu::app_launch::app_info::Desktop(xmirunset, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
421+ ubuntu::app_launch::app_info::Desktop(xmirunset, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
422 EXPECT_TRUE(
423- ubuntu::app_launch::app_info::Desktop(xmirunset, "/", ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
424+ ubuntu::app_launch::app_info::Desktop(xmirunset, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
425
426 auto xmirtrue = defaultKeyfile();
427 g_key_file_set_boolean(xmirtrue.get(), DESKTOP, "X-Ubuntu-XMir-Enable", TRUE);
428 EXPECT_TRUE(
429- ubuntu::app_launch::app_info::Desktop(xmirtrue, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
430+ ubuntu::app_launch::app_info::Desktop(xmirtrue, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
431 EXPECT_TRUE(
432- ubuntu::app_launch::app_info::Desktop(xmirtrue, "/", ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
433+ ubuntu::app_launch::app_info::Desktop(xmirtrue, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
434
435 auto xmirfalse = defaultKeyfile();
436 g_key_file_set_boolean(xmirfalse.get(), DESKTOP, "X-Ubuntu-XMir-Enable", FALSE);
437 EXPECT_FALSE(
438- ubuntu::app_launch::app_info::Desktop(xmirfalse, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
439+ ubuntu::app_launch::app_info::Desktop(xmirfalse, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
440 EXPECT_FALSE(
441- ubuntu::app_launch::app_info::Desktop(xmirfalse, "/", ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
442+ ubuntu::app_launch::app_info::Desktop(xmirfalse, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
443 }
444
445 } //anonymous namespace

Subscribers

People subscribed via source and target branches