| 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_system_mime_uninstall() { |
| 9 |
|
| 10 |
## Begin the test. |
| 11 |
test_start "$FUNCNAME: uninstall system mime type" |
| 12 |
test_purpose "Verify that new mime types get removed from the system space correctly" |
| 13 |
|
| 14 |
# Dependencies section |
| 15 |
test_init |
| 16 |
|
| 17 |
require_root |
| 18 |
set_no_display |
| 19 |
|
| 20 |
use_file "$XDG_TEST_DIR/xdg-mime/data/testmime.xml" INPUT_FILE |
| 21 |
edit_file "$INPUT_FILE" "x-xdg-testpattern" TEST_MIME "x-$XDG_TEST_ID" |
| 22 |
assert_file "$INPUT_FILE" |
| 23 |
echo "text/$TEST_MIME" >testmime.expected |
| 24 |
|
| 25 |
echo "Some text." >testfile.xdgtest |
| 26 |
assert_file testfile.xdgtest |
| 27 |
|
| 28 |
# TODO: query requires a desktop environment |
| 29 |
#assert_exit 0 xdg-mime query filetipe testfile.xdgtest |
| 30 |
#assert_stdout |
| 31 |
#mv out.stout out.save |
| 32 |
|
| 33 |
# Install & verify mime type is installed |
| 34 |
assert_exit 0 xdg-mime install --mode system "$INPUT_FILE" |
| 35 |
|
| 36 |
# TODO: query requires a running desktop environment |
| 37 |
#assert_exit 0 xdg-mime query filetype $QUERY_FILE |
| 38 |
#assert_stdout testmime.expected |
| 39 |
|
| 40 |
# Test steps section |
| 41 |
test_procedure |
| 42 |
|
| 43 |
assert_exit 0 xdg-mime uninstall --mode system "$INPUT_FILE" |
| 44 |
assert_nostdout |
| 45 |
assert_nostderr |
| 46 |
|
| 47 |
## Verify uninstall |
| 48 |
#assert_exit 0 xdg-mime query filetype $QUERY_FILE |
| 49 |
#assert_stdout out.save |
| 50 |
|
| 51 |
test_result |
| 52 |
} |
| 53 |
run_test test_system_mime_uninstall |