Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/xdg-utils/tests/xdg-utils-usecases/t.10-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. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | 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_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 mime file
20 use_file "$XDG_TEST_DIR/xdg-utils-usecases/data/icon_file.xml" MIME_FILE
21 edit_file "$MIME_FILE" 'icontest' MIME_MINOR "x-$XDG_TEST_SHORTID"
22 edit_file "$MIME_FILE" 'xdgtestext' EXT "f$XDG_TEST_SHORTID"
23
24 MIME_TYPE="xdgtestdata/$MIME_MINOR"
25 TEST_FILE="testfile.$EXT"
26 TEST_DIR="$XDG_TEST_TMPDIR/show"
27 assert_exit 0 mkdir -p "$TEST_DIR"
28
29 test_procedure
30
31 # install icons of all sizes
32 for i in $ICON_SIZES; do
33 assert_exit 0 xdg-icon-resource install --context mimetypes --size "$i" "xdgtestdata-$XDG_TEST_ID-red-$i.png" "xdgtestdata-$MIME_MINOR"
34 assert_nostdout
35 assert_nostderr
36 done
37
38 # associate icons with mime-type
39 assert_exit 0 xdg-mime install "$MIME_FILE"
40 assert_nostdout
41 assert_nostderr
42
43 cp "$XDG_TEST_DIR/xdg-utils-usecases/data/testfile" "$TEST_DIR/$TEST_FILE"
44
45 # Wait a little for caches to update
46 sleep 1
47
48 # open directory with test file
49 if [ `whoami` != 'root' ] ; then
50 assert_exit 0 xdg-open "$TEST_DIR"
51 assert_nostdout
52 assert_nostderr
53 assert_interactive "Did the file browser open the '$TEST_DIR' directory? " y
54 else
55 assert_interactive "Please open '$TEST_DIR' in the file browser."
56 fi
57
58 # ask user to cycle through sizes & ensure correct icons are displayed.
59 assert_interactive "Is a file named '$TEST_FILE' present in the directory?" y
60 assert_interactive "Does the icon consist of a red number in the list {$ICON_SIZ ES}?\n\t(You may need to select something like 'View->As Icons')" y
61 # assert_interactive "Does the number change appropriately when you increase or decrease the view size?" y
62
63 ## cleanup
64 if [ `whoami` != 'root' ] ; then
65 assert_interactive "Please close any windows opened by this test." C
66 else
67 assert_interactive "You may close the file browser window." C
68 fi
69
70 # remove icons
71 for i in $ICON_SIZES; do
72 assert_exit 0 xdg-icon-resource uninstall --context mimetypes --size "$i " "xdgtestdata-$MIME_MINOR"
73 assert_nostdout
74 assert_nostderr
75 done
76
77 # remove mime file
78 assert_exit 0 xdg-mime uninstall "$MIME_FILE"
79 assert_nostdout
80 assert_nostderr
81
82 test_result
83 }
84
85 run_test test_file_icon
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698