# Copyright (c) 2020 by Peter van der Meer
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.

test-data "Owned Drone Save"
	category "savegame"
	contents
		pilot Bobby Bughunter
		date 16 11 3013
		system Rutilicus
		planet "New Boston"
		clearance
		"map coloring" -6
		"map zoom" 0
		account
			credits 200000000
		ship "Surveillance Drone"
			name "Observer"
			sprite "ship/surveillance drone"
			thumbnail "thumbnail/surveillance drone"
			attributes
				category "Drone"
				"cost" 50000
				"hull" 300
				"automaton" 1
				"mass" 15
				"drag" .53
				"heat dissipation" .9
				"outfit space" 530
				"weapon capacity" 100
				"engine capacity" 280
				weapon
					"blast radius" 3
					"shield damage" 30
					"hull damage" 15
					"hit force" 45
			outfits
				"nGVF-AA Fuel Cell"
				"Surveillance Pod"
				"X1700 Ion Thruster"
				"X1200 Ion Steering"
			hull 300
			position 0 0
			engine -5 29
			engine 5 29
			explode "tiny explosion" 15
			system Rutilicus
			planet "New Boston"
		visited Rutilicus
		"visited planet" "New Boston"



test-data "Owned Remote Save"
	category "savegame"
	contents
		pilot Bobby Bughunter
		date 16 11 3013
		system Rutilicus
		planet "New Boston"
		clearance
		"map coloring" -6
		"map zoom" 0
		account
			credits 200000000
		ship Sparrow
			name "My First Fighter"
			sprite ship/sparrow
			thumbnail thumbnail/sparrow
			attributes
				category Interceptor
				cost 225000
				mass 50
				bunks 2
				"cargo space" 15
				drag 0.9
				"engine capacity" 400
				"fuel capacity" 300
				"gun ports" 2
				"heat dissipation" 0.8
				hull 300
				"outfit space" 1300
				"required crew" 1
				shields 1200
				"weapon capacity" 200
			outfits
				"Beam Laser" 2
				"Chipmunk Plasma Steering"
				"Chipmunk Plasma Thruster"
				"D14-RN Shield Generator"
				Hyperdrive
				"LP036a Battery Pack"
				"nGVF-BB Fuel Cell"
			crew 1
			fuel 300
			shields 1200
			hull 300
			position 0 0
			engine -5 35
				zoom 1
				angle 0
				under
			engine 5 35
				zoom 1
				angle 0
				under
			gun -7 -10 "Beam Laser"
				under
			gun 7 -10 "Beam Laser"
				under
			leak flame 60 80
			explode "small explosion" 5
			explode "tiny explosion" 15
			system Sol
			planet Earth
		visited Sol
		"visited planet" Earth
		visited Rutilicus
		"visited planet" "New Boston"


test "Test-Disowning - Single drone locally"
	# Broken status; testframework does not have mouse/pointer support working yet, and Disown button requires mouse/pointer input.
	status broken
	description "Tests if we can disown a ship that cannot be a flagship."
	sequence
		# Create/inject the savegame and load it.
		inject "Owned Drone Save"
		call "Load First Savegame"
		# Go to playerinfo / ships overview
		input
			key "shift" "I"
		# Select first ship in the list
		input
			key "Down"
		input
			key "Return"
		# Give disown command
		# TODO: Needs to be done using mouse/pointer input.
		input
			key "shift" "D"
		input
			key "Return"
		# Wait one frame for redrawing the UI
		input
		# Done, go to main menu
		input
			key "d"


test "Test-Disowning - Single ship non-local"
	# Broken status; testframework does not have mouse/pointer support working yet, and Disown button requires mouse/pointer input.
	status broken
	description "Tests if we can disown a single ship that is in another system."
	sequence
		# Create/inject the savegame and load it.
		inject "Owned Remote Save"
		call "Load First Savegame"
		# Go to playerinfo / ships overview
		input
			key "shift" "I"
		# Select first ship in the list
		input
			key "Down"
		input
			key "Return"
		# Give disown command
		# TODO: Needs to be done using mouse/pointer input.
		input
			key "shift" "D"
		input
			key "Return"
		# Wait one frame for redrawing the UI
		input
		# Done, go to main menu
		input
			key "d"
