Centre every popup in the window
Most popups sat where they had been placed by hand, up to 328 px off. They are now all centred, and test_popups.gd checks it for every popup.
This commit is contained in:
1 parent
845d08c260
commit
b2d547b650
4 files changed
+3382
-3360
No files matched your search
+20
-20
@@ -42,55 +42,55 @@ layout_mode = 1
|
||||
[node name="SearchPopup" parent="." unique_id=1661250375 instance=ExtResource("9_5ijvr")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 56.0
|
||||
offset_top = 96.0
|
||||
offset_right = 56.0
|
||||
offset_bottom = 96.0
|
||||
offset_left = 384.0
|
||||
offset_top = 100.0
|
||||
offset_right = 384.0
|
||||
offset_bottom = 100.0
|
||||
|
||||
[node name="SyncPopup" parent="." unique_id=182499699 instance=ExtResource("10_yxw0b")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 210.0
|
||||
offset_top = 153.0
|
||||
offset_top = 220.0
|
||||
offset_right = 210.0
|
||||
offset_bottom = 153.0
|
||||
offset_bottom = 220.0
|
||||
|
||||
[node name="QRPopup" parent="." unique_id=589733821 instance=ExtResource("15_qr_window")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 720.0
|
||||
offset_top = 153.0
|
||||
offset_right = 720.0
|
||||
offset_bottom = 153.0
|
||||
offset_left = 735.0
|
||||
offset_top = 280.0
|
||||
offset_right = 735.0
|
||||
offset_bottom = 280.0
|
||||
|
||||
[node name="ShortcutsPopup" parent="." unique_id=1513416242 instance=ExtResource("13_8eebo")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 562.0
|
||||
offset_top = 160.0
|
||||
offset_right = 1262.0
|
||||
offset_bottom = 860.0
|
||||
offset_left = 610.0
|
||||
offset_top = 190.0
|
||||
offset_right = 1310.0
|
||||
offset_bottom = 890.0
|
||||
|
||||
[node name="AboutPopup" parent="." unique_id=141261008 instance=ExtResource("16_about_window")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 360.0
|
||||
offset_top = 153.0
|
||||
offset_top = 220.0
|
||||
offset_right = 360.0
|
||||
offset_bottom = 153.0
|
||||
offset_bottom = 220.0
|
||||
|
||||
[node name="LogPopup" parent="." unique_id=1289881388 instance=ExtResource("14_26rwn")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 562.0
|
||||
offset_top = 132.0
|
||||
offset_right = 1262.0
|
||||
offset_bottom = 832.0
|
||||
offset_left = 610.0
|
||||
offset_top = 190.0
|
||||
offset_right = 1310.0
|
||||
offset_bottom = 890.0
|
||||
|
||||
[node name="SoundtrackStatsPopup" parent="." unique_id=1213999001 instance=ExtResource("soundtrack_stats_popup_scene")]
|
||||
visible = false
|
||||
|
||||
+10
-10
@@ -93,28 +93,28 @@ offset_bottom = 975.0
|
||||
[node name="SettingsPopup" parent="." unique_id=1323246978 instance=ExtResource("11_k62u5")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 720.0
|
||||
offset_top = 153.0
|
||||
offset_right = 720.0
|
||||
offset_bottom = 153.0
|
||||
offset_left = 710.0
|
||||
offset_top = 220.0
|
||||
offset_right = 710.0
|
||||
offset_bottom = 220.0
|
||||
|
||||
[node name="CharacterSelectPopup" parent="." unique_id=1679856322 instance=ExtResource("6_dhrvg")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 405.0
|
||||
offset_top = 165.0
|
||||
offset_right = 1557.0
|
||||
offset_bottom = 805.0
|
||||
offset_left = 315.0
|
||||
offset_top = 208.0
|
||||
offset_right = 1467.0
|
||||
offset_bottom = 848.0
|
||||
|
||||
[node name="WinnerPopup" parent="." unique_id=999999999 instance=ExtResource("17_winner_window")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 160.0
|
||||
offset_top = 100.0
|
||||
offset_top = 80.0
|
||||
offset_right = 160.0
|
||||
offset_bottom = 100.0
|
||||
offset_bottom = 80.0
|
||||
|
||||
[node name="DebugLabel" type="Label" parent="." unique_id=1959221257]
|
||||
visible = false
|
||||
|
||||
+3330
-3330
File diff suppressed because it is too large.
Load diff
@@ -130,3 +130,25 @@ func test_toggle_opens_and_closes() -> void:
|
||||
shortcuts.toggle()
|
||||
assert_bool(shortcuts.visible).is_false()
|
||||
|
||||
|
||||
func test_every_popup_is_centred_in_the_window() -> void:
|
||||
var window_centre: Vector2 = Vector2(1920, 1080) / 2
|
||||
var popups: Array[BasePopup] = [_window.get_node("SoundtrackStatsPopup")]
|
||||
for node_name: String in MAIN_POPUPS + QUIZ_POPUPS:
|
||||
popups.append(_popup(node_name))
|
||||
for popup: BasePopup in popups:
|
||||
match popup.name:
|
||||
"WinnerPopup":
|
||||
popup.show_winner(_add_player("Crono"))
|
||||
"CharacterSelectPopup":
|
||||
popup.show_grid("Crono")
|
||||
"SoundtrackStatsPopup":
|
||||
popup.show_soundtrack(SoundtrackWithSongs.new())
|
||||
_:
|
||||
popup.open()
|
||||
await _runner.simulate_frames(1)
|
||||
|
||||
var centre: Vector2 = popup.panel.get_global_rect().get_center()
|
||||
assert_float(centre.distance_to(window_centre)).override_failure_message(
|
||||
"%s is centred at %s" % [popup.name, centre]).is_less_equal(1.0)
|
||||
popup.close()
|
||||
Reference in new issue
Block a user