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_uninstall2in1() { |
| 9 |
| 10 ## Begin the test. |
| 11 test_start "$FUNCNAME: uninstall user mime type" |
| 12 test_purpose "Verify that mime types get removed from the user space correctly." |
| 13 |
| 14 # Dependencies section |
| 15 test_init |
| 16 |
| 17 require_notroot |
| 18 |
| 19 use_file "$XDG_TEST_DIR/xdg-mime/data/test2mime.xml" INPUT_FILE |
| 20 edit_file "$INPUT_FILE" "x-xdg-testpattern" TEST1_MIME "x-xdg-01-$XDG_TEST_ID" |
| 21 edit_file "$INPUT_FILE" "x-xdg-test2pattern" TEST2_MIME "x-xdg-02-$XDG_TEST_ID" |
| 22 |
| 23 assert_file "$INPUT_FILE" |
| 24 echo "text/$TEST1_MIME" >out.expect1 |
| 25 echo "text/$TEST2_MIME" >out.expect2 |
| 26 |
| 27 echo "Some text." >testfile.xdg1test |
| 28 echo "Some text." >testfile.xdg2test |
| 29 assert_file testfile.xdg1test |
| 30 assert_file testfile.xdg2test |
| 31 |
| 32 |
| 33 assert_exit 0 xdg-mime query filetype testfile.xdg1test |
| 34 assert_stdout |
| 35 mv out.stdout out.save1 |
| 36 |
| 37 assert_exit 0 xdg-mime query filetype testfile.xdg2test |
| 38 assert_stdout |
| 39 mv out.stdout out.save2 |
| 40 |
| 41 # Install & verify mime type is installed |
| 42 assert_exit 0 xdg-mime install --mode user "$INPUT_FILE" |
| 43 |
| 44 assert_exit 0 xdg-mime query filetype testfile.xdg1test |
| 45 assert_stdout out.expect1 |
| 46 |
| 47 assert_exit 0 xdg-mime query filetype testfile.xdg2test |
| 48 assert_stdout out.expect2 |
| 49 |
| 50 # Test steps section |
| 51 test_procedure |
| 52 |
| 53 assert_exit 0 xdg-mime uninstall --mode user "$INPUT_FILE" |
| 54 assert_nostdout |
| 55 assert_nostderr |
| 56 |
| 57 ## Verify uninstall |
| 58 assert_exit 0 xdg-mime query filetype testfile.xdg1test |
| 59 assert_stdout out.save1 |
| 60 |
| 61 assert_exit 0 xdg-mime query filetype testfile.xdg2test |
| 62 assert_stdout out.save2 |
| 63 |
| 64 test_result |
| 65 } |
| 66 run_test test_user_mime_uninstall2in1 |
OLD | NEW |