18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 05:04:58 +01:00

test: scenario tests that run the simulator and check a vehicle's physicslog

tests/scenarios/run.py builds a test scenery from a game install's scenery
(own trainsets removed, case fragment added), runs eu07 in ghostview with
physicslog on, and checks what the vehicle did: starts, max speed, brakes,
stops. First case: EU07 on td.scn driven by AI on the td/rozklad timetable,
with the Stacja1 exit route set by an event launcher instead of shift+4.

eu07 gets a -ini <file> option: an extra settings file read after eu07.ini,
so a test run can switch to a window and turn on physicslog without touching
the user's config.

Local only: scenery and vehicle data are not in the repo.
This commit is contained in:
jerrrrycho
2026-09-30 19:16:46 +02:00
parent 939e42b611
commit 798fd89dd0
6 changed files with 435 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
{
"description": "EU07 on td.scn, AI driver on the td/rozklad timetable: starts from Stacja1, keeps to the speed limit, brakes to a stop at Przystanek.",
"base_scenery": "td.scn",
"time": "10:34",
"fragment": "eu07_td_timetable.scn",
"vehicle": "autotest_eu07",
"duration": 240,
"timeout": 600,
"checks": [
{ "type": "starts", "min_speed": 20, "within": 150 },
{ "type": "max_speed", "limit": 90, "tolerance": 3 },
{ "type": "brakes", "min_pressure": 0.5 },
{ "type": "stops", "moving_speed": 20, "stop_speed": 0.5, "hold": 5 }
]
}

View File

@@ -0,0 +1,11 @@
// added by tests/scenarios/run.py to the base scenery, whose own trainsets were removed:
// the trainset goes after FirstInit, the launcher before it.
// the EU07 stands where td.scn keeps its timetable train and gets the same timetable.
trainset td/rozklad tdo_n1734 0.0 0.1
node -1 0 autotest_eu07 dynamic pkp\4e_v1 4e-004 4e 0 headdriver 0 0 enddynamic
endtrainset
// td.scn sets routes from the keyboard (shift+1..4 run events keyctrl01..04). keyctrl04 is the
// way out of the track the train stands on: switch zwr02 and the exit signal stacja1_j at 40.
// a launcher with a positive time fires once at that hour (HHMM), radius -1 means anywhere.
node -1 0 autotest_route eventlauncher 0 0 0 -1 none 1034 keyctrl04 end