#!/bin/bash

## Include utility functions.
. "$XDG_TEST_DIR/include/testassertions.sh"

. "$XDG_TEST_DIR/include/testcontrol.sh"

## Test function
test_plain_file_install() {
## Begin the test.
test_start "$FUNCNAME: verify text file is installed correctly on the desktop"

# Dependencies section
test_init

INSFILE="xdgtestdata-$XDG_TEST_SHORTID.txt"
set_no_display
echo "Some more boring text. $XDG_TEST_ID" > "$INSFILE"
assert_file "$INSFILE" 

DESKTOP="$HOME/Desktop"

# Verify the test icon is not installed already.
assert_file_not_in_path "$INSFILE" "$DESKTOP"

# Test steps section
test_procedure

assert_exit 0 xdg-desktop-icon install "$INSFILE"
assert_nostdout
assert_nostderr

assert_file_in_path "$INSFILE" "$DESKTOP"

assert_interactive_notroot "Is there an icon on the desktop with name '$INSFILE'?" y

## Cleanup
xdg-desktop-icon uninstall "$INSFILE"

test_result
} 

run_test test_plain_file_install
