#!/bin/bash

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

## Test function
test_open_basic() {
test_start "$FUNCNAME: verify basic file open test."

test_init

require_notroot

## Require a running X server
assert_display

get_unique_name TARG 'open.txt'
echo "I am open." > $TARG
assert_file "$TARG"


test_procedure

assert_exit 0 xdg-open $TARG
assert_nostdout
assert_nostderr

assert_interactive "Did a text editor open a file containing the string 'I am open.'?" y
assert_interactive "Please close any windows opened by this test." C

test_result
}

run_test test_open_basic
