Debian Codegraph @

test/resources.py

raw
1 # coding: utf-8
2 """This file contains sample data for the test suite - these are
3 written out to temporary files for the relevant tests.
4 """
5 from __future__ import unicode_literals
6
7 import sys
8
9 # With additions from firefox.desktop, to test locale & unicode support
10 gedit_desktop = """[Desktop Entry]
11 Name=gedit
12 Name[ar]=متصفح الوِب فَيَرفُكْس
13 GenericName=Text Editor
14 Comment= Edit text files
15 Keywords=Plaintext;Write;
16 Keywords[ja]=Internet;WWW;Web;インターネット;ブラウザ;ウェブ;エクスプローラ
17 Exec=gedit %U
18 Terminal=false
19 Type=Application
20 StartupNotify=true
21 MimeType=text/plain;
22 Icon=accessories-text-editor
23 Categories=GNOME;GTK;Utility;TextEditor;
24 X-GNOME-DocPath=gedit/gedit.xml
25 X-GNOME-FullName=Text Editor
26 X-GNOME-Bugzilla-Bugzilla=GNOME
27 X-GNOME-Bugzilla-Product=gedit
28 X-GNOME-Bugzilla-Component=general
29 X-GNOME-Bugzilla-Version=3.4.1
30 X-GNOME-Bugzilla-ExtraInfoScript=/usr/share/gedit/gedit-bugreport
31 Actions=Window;Document;
32 X-Ubuntu-Gettext-Domain=gedit
33
34 [Desktop Action Window]
35 Name=Open a New Window
36 Exec=gedit --new-window
37 OnlyShowIn=Unity;
38
39 [Desktop Action Document]
40 Name=Open a New Document
41 Exec=gedit --new-window
42 OnlyShowIn=Unity;
43 """
44
45 # Unicode, + TryExec that doesn't exist
46 unicode_desktop = """[Desktop Entry]
47 Name=Abc€þ
48 Type=Application
49 Exec=date
50 TryExec=ewoirjge
51 """
52
53 # Invalid - see the Categories line
54 spout_desktop = """[Desktop Entry]
55 Type=Application
56 Encoding=UTF-8
57 Name=Spout
58 GenericName=
59 Comment=
60 Icon=spout
61 Exec=/usr/games/spout
62 Terminal=false
63 Categories:Application:Game:ArcadeGame
64 """
65
66 # Test with invalid UTF-8
67 gnome_alsamixer_desktop = """[Desktop Entry]
68 Name=GNOME ALSA Mixer
69 Comment=ALSA sound mixer for GNOME
70 Comment[es]=Mezclador de sonido ALSA para GNOME
71 Comment[fr]=Mélangeur de son ALSA pour GNOME
72 Exec=gnome-alsamixer
73 Type=Application
74 """
75
76 # TryExec that should exist
77 python_desktop = """[Desktop Entry]
78 Name=Python
79 Comment=Dynamic programming language
80 Exec=%s
81 TryExec=%s
82 Type=Application
83 """ % (sys.executable, sys.executable)
84
85 recently_used = """<?xml version="1.0"?>
86 <RecentFiles>
87 <RecentItem>
88 <URI>file:///home/thomas/foo/bar.ods</URI>
89 <Mime-Type>application/vnd.oasis.opendocument.spreadsheet</Mime-Type>
90 <Timestamp>1272385187</Timestamp>
91 <Groups>
92 <Group>openoffice.org</Group>
93 <Group>staroffice</Group>
94 <Group>starsuite</Group>
95 </Groups>
96 </RecentItem>
97 <RecentItem>
98 <URI>file:///tmp/2.ppt</URI>
99 <Mime-Type>application/vnd.ms-powerpoint</Mime-Type>
100 <Timestamp>1272378716</Timestamp>
101 <Groups>
102 <Group>openoffice.org</Group>
103 <Group>staroffice</Group>
104 <Group>starsuite</Group>
105 </Groups>
106 </RecentItem>
107 </RecentFiles>
108 """
109
110 applications_menu = """<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
111 "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
112
113 <Menu>
114
115 <Name>Applications</Name>
116 <Directory>X-GNOME-Menu-Applications.directory</Directory>
117
118 <!-- Scan legacy dirs first, as later items take priority -->
119 <LegacyDir>/etc/X11/applnk</LegacyDir>
120 <LegacyDir>/usr/share/gnome/apps</LegacyDir>
121
122 <!-- Read standard .directory and .desktop file locations -->
123 <DefaultAppDirs/>
124 <DefaultDirectoryDirs/>
125
126 <!-- Read in overrides and child menus from applications-merged/ -->
127 <DefaultMergeDirs/>
128
129 <!-- Accessories submenu -->
130 <Menu>
131 <Name>Accessories</Name>
132 <Directory>Utility.directory</Directory>
133 <Include>
134 <And>
135 <Category>Utility</Category>
136 <!-- Accessibility spec must have either the Utility or Settings
137 category, and we display an accessibility submenu already for
138 the ones that do not have Settings, so don't display accessibility
139 applications here -->
140 <Not><Category>Accessibility</Category></Not>
141 <Not><Category>System</Category></Not>
142 </And>
143 </Include>
144 </Menu> <!-- End Accessories -->
145
146 <!-- Accessibility submenu -->
147 <Menu>
148 <Name>Universal Access</Name>
149 <Directory>Utility-Accessibility.directory</Directory>
150 <Include>
151 <And>
152 <Category>Accessibility</Category>
153 <Not><Category>Settings</Category></Not>
154 </And>
155 </Include>
156 </Menu> <!-- End Accessibility -->
157
158 <!-- Development Tools -->
159 <Menu>
160 <Name>Development</Name>
161 <Directory>Development.directory</Directory>
162 <Include>
163 <And>
164 <Category>Development</Category>
165 </And>
166 <Filename>emacs.desktop</Filename>
167 </Include>
168 </Menu> <!-- End Development Tools -->
169
170 <!-- Education -->
171 <Menu>
172 <Name>Education</Name>
173 <Directory>Education.directory</Directory>
174 <Include>
175 <And>
176 <Category>Education</Category>
177 <Not><Category>Science</Category></Not>
178 </And>
179 </Include>
180 </Menu> <!-- End Education -->
181
182 <!-- Science -->
183 <Menu>
184 <Name>Science</Name>
185 <Directory>GnomeScience.directory</Directory>
186 <Include>
187 <And>
188 <Category>Education</Category>
189 <Category>Science</Category>
190 </And>
191 </Include>
192 </Menu> <!-- End Science -->
193
194 <!-- Games -->
195 <Menu>
196 <Name>Games</Name>
197 <Directory>Game.directory</Directory>
198 <Include>
199 <And>
200 <Category>Game</Category>
201 <Not><Category>ActionGame</Category></Not>
202 <Not><Category>AdventureGame</Category></Not>
203 <Not><Category>ArcadeGame</Category></Not>
204 <Not><Category>BoardGame</Category></Not>
205 <Not><Category>BlocksGame</Category></Not>
206 <Not><Category>CardGame</Category></Not>
207 <Not><Category>KidsGame</Category></Not>
208 <Not><Category>LogicGame</Category></Not>
209 <Not><Category>Simulation</Category></Not>
210 <Not><Category>SportsGame</Category></Not>
211 <Not><Category>StrategyGame</Category></Not>
212 </And>
213 </Include>
214 <DefaultLayout inline="true" inline_limit="6" inline_header="false">
215 <Merge type="menus"/>
216 <Merge type="files"/>
217 </DefaultLayout>
218 <Menu>
219 <Name>Action</Name>
220 <Directory>ActionGames.directory</Directory>
221 <Include>
222 <Category>ActionGame</Category>
223 </Include>
224 </Menu>
225 <Menu>
226 <Name>Adventure</Name>
227 <Directory>AdventureGames.directory</Directory>
228 <Include>
229 <Category>AdventureGame</Category>
230 </Include>
231 </Menu>
232 <Menu>
233 <Name>Arcade</Name>
234 <Directory>ArcadeGames.directory</Directory>
235 <Include>
236 <Category>ArcadeGame</Category>
237 </Include>
238 </Menu>
239 <Menu>
240 <Name>Board</Name>
241 <Directory>BoardGames.directory</Directory>
242 <Include>
243 <Category>BoardGame</Category>
244 </Include>
245 </Menu>
246 <Menu>
247 <Name>Blocks</Name>
248 <Directory>BlocksGames.directory</Directory>
249 <Include>
250 <Category>BlocksGame</Category>
251 </Include>
252 </Menu>
253 <Menu>
254 <Name>Cards</Name>
255 <Directory>CardGames.directory</Directory>
256 <Include>
257 <Category>CardGame</Category>
258 </Include>
259 </Menu>
260 <Menu>
261 <Name>Kids</Name>
262 <Directory>KidsGames.directory</Directory>
263 <Include>
264 <Category>KidsGame</Category>
265 </Include>
266 </Menu>
267 <Menu>
268 <Name>Logic</Name>
269 <Directory>LogicGames.directory</Directory>
270 <Include>
271 <Category>LogicGame</Category>
272 </Include>
273 </Menu>
274 <Menu>
275 <Name>Role Playing</Name>
276 <Directory>RolePlayingGames.directory</Directory>
277 <Include>
278 <Category>RolePlaying</Category>
279 </Include>
280 </Menu>
281 <Menu>
282 <Name>Simulation</Name>
283 <Directory>SimulationGames.directory</Directory>
284 <Include>
285 <Category>Simulation</Category>
286 </Include>
287 </Menu>
288 <Menu>
289 <Name>Sports</Name>
290 <Directory>SportsGames.directory</Directory>
291 <Include>
292 <Category>SportsGame</Category>
293 </Include>
294 </Menu>
295 <Menu>
296 <Name>Strategy</Name>
297 <Directory>StrategyGames.directory</Directory>
298 <Include>
299 <Category>StrategyGame</Category>
300 </Include>
301 </Menu>
302 </Menu> <!-- End Games -->
303
304 <!-- Graphics -->
305 <Menu>
306 <Name>Graphics</Name>
307 <Directory>Graphics.directory</Directory>
308 <Include>
309 <And>
310 <Category>Graphics</Category>
311 </And>
312 </Include>
313 </Menu> <!-- End Graphics -->
314
315 <!-- Internet -->
316 <Menu>
317 <Name>Internet</Name>
318 <Directory>Network.directory</Directory>
319 <Include>
320 <And>
321 <Category>Network</Category>
322 </And>
323 </Include>
324 </Menu> <!-- End Internet -->
325
326 <!-- Multimedia -->
327 <Menu>
328 <Name>Multimedia</Name>
329 <Directory>AudioVideo.directory</Directory>
330 <Include>
331 <And>
332 <Category>AudioVideo</Category>
333 </And>
334 </Include>
335 </Menu> <!-- End Multimedia -->
336
337 <!-- Office -->
338 <Menu>
339 <Name>Office</Name>
340 <Directory>Office.directory</Directory>
341 <Include>
342 <And>
343 <Category>Office</Category>
344 </And>
345 </Include>
346 </Menu> <!-- End Office -->
347
348 <!-- System Tools-->
349 <Menu>
350 <Name>System</Name>
351 <Directory>System-Tools.directory</Directory>
352 <Include>
353 <And>
354 <Category>System</Category>
355 <Not><Category>Settings</Category></Not>
356 <Not><Category>Game</Category></Not>
357 </And>
358 </Include>
359 <Menu>
360 <Name>Preferences</Name>
361 <Directory>Settings.directory</Directory>
362 <Include>
363 <And>
364 <Category>Settings</Category>
365 <Not>
366 <Or>
367 <Category>System</Category>
368 <Category>X-GNOME-Settings-Panel</Category>
369 </Or>
370 </Not>
371 </And>
372 </Include>
373 </Menu>
374 <Menu>
375 <Name>Administration</Name>
376 <Directory>Settings-System.directory</Directory>
377 <Include>
378 <And>
379 <Category>Settings</Category>
380 <Category>System</Category>
381 <Not>
382 <Category>X-GNOME-Settings-Panel</Category>
383 </Not>
384 </And>
385 </Include>
386 </Menu>
387 </Menu> <!-- End System Tools -->
388
389 <!-- Other -->
390 <Menu>
391 <Name>Other</Name>
392 <Directory>X-GNOME-Other.directory</Directory>
393 <OnlyUnallocated/>
394 <Include>
395 <And>
396 <Not><Category>Core</Category></Not>
397 <Not><Category>Screensaver</Category></Not>
398 <Not><Category>X-GNOME-Settings-Panel</Category></Not>
399 </And>
400 </Include>
401 </Menu> <!-- End Other -->
402
403 <Layout>
404 <Merge type="menus" />
405 <Menuname>Other</Menuname>
406 <Merge type="files" />
407 </Layout>
408
409 <!-- The Debian menu -->
410 <Menu>
411 <Name>Debian</Name>
412 <MergeFile>debian-menu.menu</MergeFile>
413 <Directory>Debian.directory</Directory>
414 </Menu>
415
416 <Include>
417 <Filename>ubuntu-software-center.desktop</Filename>
418 </Include>
419
420 <!-- Separator between menus and gnome-app-install -->
421 <Layout>
422 <Merge type="menus"/>
423 <Merge type="files"/>
424 <Separator/>
425 <Filename>ubuntu-software-center.desktop</Filename>
426 </Layout>
427
428 </Menu> <!-- End Applications -->
429 """
430
431 legacy_menu = """<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
432 "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
433
434 <Menu>
435
436 <Name>Legacy</Name>
437 <LegacyDir>legacy_dir</LegacyDir>
438
439 </Menu>
440 """
441
442 kde_legacy_menu = """<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
443 "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
444
445 <Menu>
446
447 <Name>KDE Legacy</Name>
448 <KDELegacyDirs/>
449
450 </Menu>
451 """
452
453 layout_menu = """<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
454 "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
455 <Menu>
456
457 <Name>Layout</Name>
458 <DefaultLayout show_empty="true">
459 <Merge type="menus"/>
460 <Merge type="files"/>
461 <Separator/>
462 <Menuname>More</Menuname>
463 </DefaultLayout>
464
465 <Menu>
466 <Name>More</Name>
467 </Menu>
468
469 <Menu>
470 <Name>Games</Name>
471 <Layout>
472 <Menuname>Steam</Menuname>
473 <Separator/>
474 <Merge type="menus"/>
475 </Layout>
476 <Menu>
477 <Name>Action</Name>
478 </Menu>
479 <Menu>
480 <Name>Steam</Name>
481 </Menu>
482 <Menu>
483 <Name>Arcade</Name>
484 </Menu>
485 </Menu>
486
487 <Menu>
488 <Name>Accessories</Name>
489 </Menu>
490 </Menu>
491 """
492
493 mime_globs2_a = """#globs2 MIME data file
494 55:text/x-diff:*.patch
495 50:text/x-c++src:*.C:cs
496 50:text/x-python:*.py
497 10:text/x-readme:readme*
498 """
499
500 mime_globs2_b = """#globs2 MIME data file
501 # Add to existing MIMEtype
502 50:text/x-diff:*.diff
503 # Remove one
504 50:text/x-python:__NOGLOBS__
505 # Replace one
506 40:text/x-readme:__NOGLOBS__
507 20:text/x-readme:RDME:cs
508 """
509
510 mime_magic_db = b"""MIME-Magic\0
511 [50:image/png]
512 >0=\0\x04\x89PNG
513 [50:image/jpeg]
514 >0=\0\x03\xff\xd8\xff
515 >0=\0\x02\xff\xd8
516 [50:image/openraster]
517 >0=\0\x04PK\x03\x04
518 1>30=\0\x08mimetype
519 2>38=\0\x10image/openraster
520 [80:image/svg+xml]
521 >0=\0\x0d<!DOCTYPE svg+257
522 >0=\0\x04<svg+257
523 [50:image/vnd.adobe.photoshop]
524 >0=\0\x0a8BPS \0\0\0\0&\xff\xff\xff\xff\0\0\xff\xff\xff\xff
525 [40:application/x-executable]
526 >0=\0\02\x01\x11~2
527 [10:application/madeup]
528 >0=\0\x05ab
529 cd
530 >10=\0\x05ab de&\xff\xff
531 \xff\xff
532 [10:application/imaginary]
533 >0=\0\x03abc@unhandled_future_field
534 [10:application/toberemoved]
535 >0=\0\x03def
536 [10:application/tobereplaced]
537 >0=\0\x03ghi
538 [10:application/tobeaddedto]
539 >0=\0\x03mno
540 """
541
542 mime_magic_db2 = b"""MIME-Magic\0
543 [10:application/toberemoved]
544 >0=__NOMAGIC__
545 [10:application/tobereplaced]
546 >0=__NOMAGIC__
547 >1=\0\x03jkl
548 [10:application/tobeaddedto]
549 >1=\0\x03pqr
550 """
551
552 png_data = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x06\x00\x00\x00\x1f\x15\xc4\x89\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\x00\rIDAT\x08\x99c\xf8\x7f\x83\xe1?\x00\x07\x88\x02\xd7\xd9\n\xd8\xdc\x00\x00\x00\x00IEND\xaeB`\x82'
553
554 icon_data = """[Icon Data]
555 DisplayName=Mime text/plain
556 EmbeddedTextRectangle=100,100,900,900
557 AttachPoints=200,200|800,200|500,500|200,800|800,800
558 """