Chromium Code Reviews

Side by Side Diff: third_party/xdg-utils/tests/xdg-utils-usecases/t.11-desktop_file_icon

Issue 151098: Patch from mdm@google.com... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
Property Changes:
Name: svn:executable
+ *
OLDNEW
(Empty)
1 #!/bin/bash
2
3 . "$XDG_TEST_DIR/include/testassertions.sh"
4 . "$XDG_TEST_DIR/include/testcontrol.sh"
5
6 test_desktop_file_icon() {
7
8 test_start "$FUNCNAME: ensure that associations with filetypes is correct."
9
10 ICON_SIZES="16 22 24 32 48 64 128"
11
12 test_init
13
14 # get icon files
15 for i in $ICON_SIZES; do
16 use_file "$XDG_TEST_DIR/icons/red-$i.png" TMP
17 done
18
19 # get & edit desktop file
20 use_file "$XDG_TEST_DIR/xdg-utils-usecases/data/icon_test.desktop" DESKTOP_FILE
21 edit_file "$DESKTOP_FILE" 'red' ICON_NAME
22 TEST_DIR="$XDG_TEST_TMPDIR/show"
23 assert_exit 0 mkdir -p "$TEST_DIR"
24 assert_exit 0 cp "$DESKTOP_FILE" "$TEST_DIR/IconTest.desktop"
25
26 test_procedure
27
28 # install icons of all sizes
29 for i in $ICON_SIZES; do
30 assert_exit 0 xdg-icon-resource install --size "$i" "xdgtestdata-$XDG_TE ST_ID-red-$i.png" "$ICON_NAME"
31 assert_nostdout
32 assert_nostderr
33 done
34
35 # Wait a little for caches to update
36 sleep 1
37
38 # open directory with test file
39 if [ `whoami` != 'root' ] ; then
40 assert_exit 0 xdg-open "$TEST_DIR"
41 assert_nostdout
42 assert_nostderr
43 assert_interactive "Did the file browser open the '$TEST_DIR' directory? " y
44 else
45 assert_interactive "Please open '$TEST_DIR' in the file browser."
46 fi
47
48 # ask user to cycle through sizes & ensure correct icons are displayed.
49 assert_interactive "Is a file named either 'Icon Test' or 'IconTest.desktop' pre sent in the directory?" y
50 assert_interactive "Does the icon consist of a red number?\n\t(You may need to s elect something like 'View->As Icons')" y
51 # assert_interactive "Does the number change appropriately when you increase or decrease the view size?" y
52
53 ## cleanup
54 if [ `whoami` != 'root' ] ; then
55 assert_interactive "Please close any windows opened by this test." C
56 else
57 assert_interactive "You may close the file browser window." C
58 fi
59
60 # remove icons
61 for i in $ICON_SIZES; do
62 xdg-icon-resource uninstall --size "$i" "$ICON_NAME" > /dev/null 2> /dev /null
63 done
64
65 test_result
66 }
67
68 run_test test_desktop_file_icon
OLDNEW

Powered by Google App Engine