#!/bin/bash ## Include utility functions. . "$XDG_TEST_DIR/include/testassertions.sh" . "$XDG_TEST_DIR/include/testcontrol.sh" ## Test function test_desktop_icon_install() { ## Begin the test. test_start "$FUNCNAME: verify a desktop file installed correctly on the desktop" # Dependencies section test_init # Generate .desktop file use_file "$XDG_TEST_DIR/xdg-desktop-icon/data/desktop_icon_install.desktop" DESK_FILE edit_file "$DESK_FILE" 'xdg-test-desktop-icon-install.tmp' CREATE_FILE edit_file "$DESK_FILE" 'Desktop_Icon' ICON_TEXT "Install $XDG_TEST_SHORTID" assert_file "$DESK_FILE" DESKTOP="$HOME/Desktop" set_no_display # Verify the test icon is not installed already. assert_file_not_in_path "$DESK_FILE" "$DESKTOP" assert_nofile "$HOME/$CREATE_FILE" # Test steps section test_procedure assert_exit 0 xdg-desktop-icon install "$DESK_FILE" assert_nostdout assert_nostderr assert_file_in_path "$DESK_FILE" "$DESKTOP" if [ -z "$XDG_TEST_NO_INTERACTIVE" ] && [ `whoami` != root ] ; then assert_interactive "Is there an icon on the desktop with name '$ICON_TEXT'?" y assert_interactive "Please double click the '$ICON_TEXT' icon." ## Double clicking will result in the command 'touch xdg-test-desktop-icon-install.tmp' to be run assert_file "$HOME/$CREATE_FILE" ## Cleanup rm -f "$HOME/$CREATE_FILE" fi xdg-desktop-icon uninstall "$DESK_FILE" >/dev/null 2>&1 test_result } run_test test_desktop_icon_install