Follow the GDScript style guide in every script
- Types on every parameter, return value and variable, and snake_case names (the player name limit is the constant MAX_NAME_LENGTH). - Spelling fixes: *_triggered, character_selected, separator, caught_errors. The server's catched_errors key stays as the server sends it. - Signals are connected with signal.connect() instead of by name. - Code is ordered signals, constants, exported vars, vars, @onready vars, functions, with @onready on one line and two blank lines between functions. - Every script starts with a ## description. Template comments, old LOC notes and commented-out code are gone, apart from the local play code. - Lines are at most 100 characters, apart from the local play path. - The screenshot tour turns off the blinking text cursor so pictures match.
This commit is contained in:
1 parent
674604425f
commit
a0428e3475
45 files changed
+580
-589
No files matched your search
@@ -1,4 +1,5 @@
|
||||
extends GdUnitTestSuite
|
||||
## ListRow: text, alternating backgrounds and wrapping.
|
||||
|
||||
|
||||
func _background(list_row: ListRow) -> Color:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
extends GdUnitTestSuite
|
||||
## How the music player shows a song's time, including the hidden parts.
|
||||
|
||||
var _music_player: MusicPlayer
|
||||
var _hide_beginning: bool
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
extends GdUnitTestSuite
|
||||
## MusicServerClient: which paths it asks for and how it handles the answers.
|
||||
|
||||
var _server: FakeHttpTransport
|
||||
|
||||
@@ -115,7 +116,8 @@ func test_mark_song_played_sends_put() -> void:
|
||||
|
||||
|
||||
func test_character_name_is_url_encoded() -> void:
|
||||
MusicServerClient.fetch_character_image("Paper Mario.png", func(_body: PackedByteArray) -> void: pass)
|
||||
MusicServerClient.fetch_character_image("Paper Mario.png",
|
||||
func(_body: PackedByteArray) -> void: pass)
|
||||
|
||||
assert_array(_server.requested_paths).contains_exactly(["/character?name=Paper%20Mario.png"])
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
extends GdUnitTestSuite
|
||||
## PlayerObject: points, and the first point, match point and winner signals.
|
||||
|
||||
var _winning_score: int
|
||||
var _player: PlayerObject
|
||||
@@ -20,7 +21,7 @@ func test_first_point_triggers_first_point_signal() -> void:
|
||||
_player.add_point()
|
||||
|
||||
assert_int(_player.player_score).is_equal(1)
|
||||
await assert_signal(_player).is_emitted("first_point_triggerd")
|
||||
await assert_signal(_player).is_emitted("first_point_triggered")
|
||||
await assert_signal(_player).is_emitted("player_point_given")
|
||||
|
||||
|
||||
@@ -30,7 +31,7 @@ func test_one_point_from_winning_triggers_match_point() -> void:
|
||||
|
||||
_player.add_point()
|
||||
|
||||
await assert_signal(_player).is_emitted("match_point_triggerd")
|
||||
await assert_signal(_player).is_emitted("match_point_triggered")
|
||||
|
||||
|
||||
func test_reaching_winning_score_triggers_winner() -> void:
|
||||
@@ -41,7 +42,7 @@ func test_reaching_winning_score_triggers_winner() -> void:
|
||||
_player.add_point()
|
||||
|
||||
assert_int(_player.player_score).is_equal(3)
|
||||
await assert_signal(_player).is_emitted("winner_triggerd")
|
||||
await assert_signal(_player).is_emitted("winner_triggered")
|
||||
|
||||
|
||||
func test_score_does_not_go_past_winning_score() -> void:
|
||||
@@ -91,7 +92,7 @@ func test_dropping_back_to_zero_allows_first_point_again() -> void:
|
||||
|
||||
_player.add_point()
|
||||
|
||||
await assert_signal(_player).is_emitted("first_point_triggerd")
|
||||
await assert_signal(_player).is_emitted("first_point_triggered")
|
||||
|
||||
|
||||
func test_reset_points() -> void:
|
||||
@@ -125,7 +126,7 @@ func test_winning_score_of_one_is_won_with_first_point() -> void:
|
||||
|
||||
_player.add_point()
|
||||
|
||||
await assert_signal(_player).is_emitted("winner_triggerd")
|
||||
await assert_signal(_player).is_emitted("winner_triggered")
|
||||
|
||||
|
||||
func test_first_point_is_match_point_when_winning_score_is_two() -> void:
|
||||
@@ -134,5 +135,5 @@ func test_first_point_is_match_point_when_winning_score_is_two() -> void:
|
||||
|
||||
_player.add_point()
|
||||
|
||||
await assert_signal(_player).is_emitted("match_point_triggerd")
|
||||
await assert_signal(_player).is_emitted("match_point_triggered")
|
||||
assert_bool(_player.is_first_point).is_false()
|
||||
@@ -1,4 +1,5 @@
|
||||
extends GdUnitTestSuite
|
||||
## Playlist: moving through the songs, answering them and keeping points.
|
||||
|
||||
var _server: FakeHttpTransport
|
||||
var _add_to_stats: bool
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
extends GdUnitTestSuite
|
||||
## How the search popup finds and orders matching soundtracks.
|
||||
|
||||
const SearchWindowScript: GDScript = preload("res://search_popup.gd")
|
||||
|
||||
@@ -36,7 +37,8 @@ func test_ignores_spaces() -> void:
|
||||
|
||||
|
||||
func test_and_matches_ampersand() -> void:
|
||||
assert_array(_search.find_matches("mario and luigi")).contains(["Mario & Luigi: Superstar Saga"])
|
||||
assert_array(_search.find_matches("mario and luigi")) \
|
||||
.contains(["Mario & Luigi: Superstar Saga"])
|
||||
|
||||
|
||||
func test_accented_letters_match_plain_letters() -> void:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
extends GdUnitTestSuite
|
||||
## Settings: the version number.
|
||||
|
||||
|
||||
func test_version_comes_from_project_settings() -> void:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
extends GdUnitTestSuite
|
||||
## SongObject: what it shows before and after the answer, and its points.
|
||||
|
||||
var _is_debug: bool
|
||||
var _song: SongObject
|
||||
|
||||
Reference in new issue
Block a user