OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 ## Include utility functions. |
| 4 . "$XDG_TEST_DIR/include/testassertions.sh" |
| 5 |
| 6 . "$XDG_TEST_DIR/include/testcontrol.sh" |
| 7 |
| 8 ## Test function |
| 9 test_system_mime_install() { |
| 10 |
| 11 ## Begin the test. |
| 12 test_start "$FUNCNAME: install system mime type" |
| 13 test_purpose "Verify that new mime types get installed into the system space cor
rectly" |
| 14 |
| 15 # Dependencies section |
| 16 test_init |
| 17 |
| 18 require_root |
| 19 |
| 20 set_no_display |
| 21 use_file "$XDG_TEST_DIR/xdg-mime/data/testmime.xml" INPUT_FILE |
| 22 edit_file "$INPUT_FILE" "x-xdg-testpattern" TEST_MIME "x-$XDG_TEST_ID" |
| 23 assert_file "$INPUT_FILE" |
| 24 |
| 25 |
| 26 echo "text/$TEST_MIME" >testmime.expected |
| 27 |
| 28 echo "Some text." >testfile.xdgtest |
| 29 assert_file testfile.xdgtest |
| 30 |
| 31 # Test steps section |
| 32 test_procedure |
| 33 |
| 34 assert_exit 0 xdg-mime install --mode system "$INPUT_FILE" |
| 35 assert_nostdout |
| 36 assert_nostderr |
| 37 |
| 38 # TODO: query requires a running desktop |
| 39 #assert_exit 0 xdg-mime query filetype testfile.xdgtest |
| 40 #assert_stdout testmime.expected |
| 41 #assert_nostderr |
| 42 |
| 43 xdg-mime uninstall --mode system "$INPUT_FILE" >/dev/null 2>&1 |
| 44 |
| 45 test_result |
| 46 } |
| 47 run_test test_system_mime_install |
OLD | NEW |