OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 ## Include utility functions. |
| 4 . "$XDG_TEST_DIR/include/testassertions.sh" |
| 5 . "$XDG_TEST_DIR/include/testcontrol.sh" |
| 6 |
| 7 ## Test function |
| 8 test_user_mime_install() { |
| 9 |
| 10 ## Begin the test. |
| 11 test_start "$FUNCNAME: install user mime type" |
| 12 test_purpose "Verify that new mime types get installed into the user space corre
ctly" |
| 13 |
| 14 # Dependencies section |
| 15 test_init |
| 16 |
| 17 require_notroot |
| 18 |
| 19 use_file "$XDG_TEST_DIR/xdg-mime/data/testmime.xml" INPUT_FILE |
| 20 edit_file "$INPUT_FILE" "x-xdg-testpattern" TEST_MIME "x-$XDG_TEST_ID" |
| 21 assert_file "$INPUT_FILE" |
| 22 echo "text/$TEST_MIME" >testmime.expected |
| 23 |
| 24 echo "Some text." >testfile.xdgtest |
| 25 assert_file testfile.xdgtest |
| 26 |
| 27 |
| 28 # Verify the test type is not installed already. |
| 29 assert_exit 0 xdg-mime query filetype testfile.xdgtest |
| 30 assert_stdout |
| 31 mv out.stdout out.save1 |
| 32 assert_exit 1 diff out.save1 testmime.expected |
| 33 |
| 34 # Test steps section |
| 35 test_procedure |
| 36 |
| 37 assert_exit 0 xdg-mime install --mode user "$INPUT_FILE" |
| 38 assert_nostdout |
| 39 assert_nostderr |
| 40 |
| 41 sleep 1 |
| 42 |
| 43 assert_exit 0 xdg-mime query filetype testfile.xdgtest |
| 44 assert_stdout testmime.expected |
| 45 assert_nostderr |
| 46 |
| 47 # TODO: this is a cleanup step |
| 48 xdg-mime uninstall --mode user "$INPUT_FILE" |
| 49 |
| 50 test_result |
| 51 } |
| 52 run_test test_user_mime_install |
OLD | NEW |