-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The way we were loading location images worked locally but not in the web build. This approach works, though it requires to have the locations listed in the GameMap configuration. The integration test has been updated to check whether the number of pngs in the locations folder matches the registered locations in the GameMap in hopes that this prevents errors later.
- Loading branch information
Showing
4 changed files
with
22 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
extends GutTest | ||
|
||
func test_load() -> void: | ||
const LOCATIONS_PATH := "res://locations/" | ||
|
||
func test_load__all_files_in_folder_are_locations() -> void: | ||
var map := GameMap.new() | ||
map.load("res://test/integration/test_locations/") | ||
|
||
assert_eq(map.size(), 1, "One location should be loaded from the test locations.") | ||
assert_true(map.has_location("test_location"), "The map should have loaded the test location") | ||
assert_not_null(map.get_by_name("test_location"), "The location texture can be loaded by name") | ||
var files_in_directory := 0 | ||
for file_name in DirAccess.get_files_at(LOCATIONS_PATH): | ||
if file_name.ends_with(".png"): | ||
files_in_directory += 1 | ||
|
||
assert_eq(map.size(), files_in_directory, "Number of locations matches number of .png images in %s" % LOCATIONS_PATH) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters