#!/bin/bash ## Include utility functions. . "$XDG_TEST_DIR/include/testassertions.sh" . "$XDG_TEST_DIR/include/testcontrol.sh" ## Test function test_user_mime_install() { ## Begin the test. test_start "$FUNCNAME: install user mime type" test_purpose "Verify that new mime types get installed into the user space correctly" # Dependencies section test_init require_notroot use_file "$XDG_TEST_DIR/xdg-mime/data/testmime.xml" INPUT_FILE edit_file "$INPUT_FILE" "x-xdg-testpattern" TEST_MIME "x-$XDG_TEST_ID" assert_file "$INPUT_FILE" echo "text/$TEST_MIME" >testmime.expected echo "Some text." >testfile.xdgtest assert_file testfile.xdgtest # Verify the test type is not installed already. assert_exit 0 xdg-mime query filetype testfile.xdgtest assert_stdout mv out.stdout out.save1 assert_exit 1 diff out.save1 testmime.expected # Test steps section test_procedure assert_exit 0 xdg-mime install --mode user "$INPUT_FILE" assert_nostdout assert_nostderr sleep 1 assert_exit 0 xdg-mime query filetype testfile.xdgtest assert_stdout testmime.expected assert_nostderr # TODO: this is a cleanup step xdg-mime uninstall --mode user "$INPUT_FILE" test_result } run_test test_user_mime_install