End Test Text instead of End Game for Stress Tests

This commit is contained in:
Vishal 2022-09-24 21:52:24 +05:30 committed by GitHub
parent 7abe73b1dc
commit 7e56e94299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 5 deletions

View File

@ -60,7 +60,7 @@ def run_stress_test(playlist_type: str = 'Random',
from ba._generated.enums import TimeType
_ba.screenmessage(
'Beginning stress test.. use '
"'End Game' to stop testing.",
"'End Test' to stop testing.",
color=(1, 1, 0))
with _ba.Context('ui'):
start_stress_test({
@ -138,7 +138,8 @@ def _reset_stress_test(args: dict[str, Any]) -> None:
def run_gpu_benchmark() -> None:
"""Kick off a benchmark to test gpu speeds."""
_ba.screenmessage('FIXME: Not wired up yet.', color=(1, 0, 0))
# FIXME: Not wired up yet.
_ba.screenmessage('Not wired up yet.', color=(1, 0, 0))
def run_media_reload_benchmark() -> None:

View File

@ -552,7 +552,7 @@ class AccountSettingsWindow(ba.Window):
position=((self._sub_width - button_width) * 0.5, v + 30),
autoselect=True,
size=(button_width, 60),
label=ba.Lstr(resource=self._r + '.manageAccount'),
label=ba.Lstr(resource=self._r + '.manageAccountText'),
color=(0.55, 0.5, 0.6),
icon=ba.gettexture('settingsIcon'),
textcolor=(0.75, 0.7, 0.8),

View File

@ -250,8 +250,12 @@ class MainMenuWindow(ba.Window):
scale=scale,
size=(self._button_width, self._button_height),
autoselect=self._use_autoselect,
label=ba.Lstr(resource=self._r + '.endGameText'),
on_activate_call=self._confirm_end_game)
label=ba.Lstr(resource=self._r +
('.endTestText' if self._is_benchmark()
else '.endGameText')),
on_activate_call=(self._confirm_end_test
if self._is_benchmark()
else self._confirm_end_game))
# Assume we're in a client-session.
else:
ba.buttonwidget(
@ -863,6 +867,11 @@ class MainMenuWindow(ba.Window):
StoreBrowserWindow(
origin_widget=self._store_button).get_root_widget())
def _is_benchmark(self) -> bool:
session = ba.internal.get_foreground_host_session()
return (getattr(session, 'benchmark_type', None) == 'cpu'
or ba.app.stress_test_reset_timer is not None)
def _confirm_end_game(self) -> None:
# pylint: disable=cyclic-import
from bastd.ui.confirm import ConfirmWindow
@ -874,6 +883,16 @@ class MainMenuWindow(ba.Window):
self._end_game,
cancel_is_selected=True)
def _confirm_end_test(self) -> None:
# pylint: disable=cyclic-import
from bastd.ui.confirm import ConfirmWindow
# Select cancel by default; this occasionally gets called by accident
# in a fit of button mashing and this will help reduce damage.
ConfirmWindow(ba.Lstr(resource=self._r + '.exitToMenuText'),
self._end_game,
cancel_is_selected=True)
def _confirm_end_replay(self) -> None:
# pylint: disable=cyclic-import
from bastd.ui.confirm import ConfirmWindow