18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 19:57:06 +01:00
Files
maszyna/application/editormodeselftest.cpp
T
maj00r cd20d8ec94 feat(editor): the first steps in the inspector, one way to start, the line laid summed up
The first steps of the editor, after the first-run pass at 1920x1080 and 1366x768 (P1 of the plan of the
editor's interface):

- The tutorial no longer opens by itself as a window over the middle of the view (at 1366x768 over all
  of it, its close button under the tool row). With nothing selected, the inspector shows a compact
  "First steps" card: the lesson of the tool in use, its steps to try ticked as they're reached, the
  links "Show the lesson", "The camera" (the first lesson) and "Hide" (the setting first_steps, which
  the checkbox of the window now names "Show the first steps in the inspector"). Opened, the window of
  the lesson goes into the corner of the view by the inspector, below the rows of the menu and the
  tools; moved, it stays between them and the status line, as high as that room at most, the lesson
  scrolled inside. Its close button is always within reach.
- The lesson follows the tool: the select tool of Tracks opens "Laying track" until its steps are done,
  so a new scenery opened in Tracks starts there, not with the camera, which stays the first page and a
  link of the card.
- An empty scenery in Tracks with nothing selected: "The scenery has no tracks yet" and one highlighted
  button, "Lay the first track (L)"; the tutorial is the card under it, a "Tutorial" link when the card
  is hidden. With tracks, the select tool keeps its hints and a plain "Lay a track (L)".
- "Without terrain", the answer to the question of the terrain at the first L, turns off the terrain
  made of the terrain model by itself: under the tracks as they're laid (the checkbox of the layers) and
  around the camera within the download area (the checkbox of the terrain panel), stops putting the
  squares of the area into the cache, a square on its way giving way at once, and drops the squares
  waiting. Kept on, the model went on being asked for, and offline the log filled with "NMT square ...
  not fetched: WinHTTP error"; now nothing is asked for after the answer.
  "Load the terrain" turns both on again. The squares of the area go to the cache, and the aerial photos
  ask for the model to lie on, only while some terrain is made of the model by itself. The question
  stands in the middle of the view, the window of the lesson waiting meanwhile. The warning of no ground
  under the mouse shows only while the pointer is over the view and the terrain is to be there.
- The tooltip of the line being laid names the panel the rest of its warnings are in ("listed in the
  tool options"): the translation of the text before said "in the panel on the right", the panel is on
  the left.
- While the pointer is over a panel, the line being laid stays as it was: the point of the cursor, the
  free end it snaps to and its height aren't taken from where the pointer is under the panel, which
  added a leg there with curves and warnings of its own. A drag begun in the view goes on over a panel.
- After Enter the inspector sums up the line laid: its tracks, length and curves, those below the norms
  in orange, and what comes next, "A switch (T)" and "Save (Ctrl+S)". It stays while the last track is
  the selection the laying left; a click on a track shows the sheet of that track. The switch tool with
  nothing clicked shows the same, not the sheet of the last track laid.
- A switch the switch tool refuses is told in its panel and by the cursor, no longer in the status line
  and the layers window as well, where it stayed after the next switch was laid. Why a branch couldn't
  lead into a free end goes into the panel with the rest; a switch laid takes the note by the cursor
  away.
- The panel of the lay tool fits one screen at 1366x768: what the tool is for is the tooltip of the
  title of its card, the paragraph of the radius at the bends the tooltip of its "?" (which still opens
  the lesson), "This speed also on from a track with a speed of its own" is under More settings; the
  mode, the speed and the height stay up front.
- The layout made on the first start: the side columns 22% of the width, at least 300 px, at most the
  400 and 460 px they had and 30%; at 1366 px the view has about 766 px instead of 557. The tool options
  take 60% of the left column, and in a window under 800 px high the layers are a tab beside them, the
  tool options shown, so the panel of a tool has the whole column. The line of the keys of the
  surroundings goes on under itself at the edge of the panel. Layouts kept in imgui.ini are left as they
  are.
- The names of the period of the day, the season and the weather in Weather and time, and the type of a
  node in the inspector of the surroundings, go through the translations ("(day)", "(autumn)",
  "(scattered)", "Typ: track" before). The degree sign of the air temperature is written as its UTF-8
  bytes: CMakeLists.txt sets COMPILE_OPTIONS of eu07 and eu07_core after add_compile_options("/utf-8"),
  which drops /utf-8, so MSVC writes the "°" of a literal as the single byte 0xB0 of the ANSI code page,
  not UTF-8, and ImGui drew '?'.
- Self-tests: the expectations statuslacks, refusal, statusline, laycursor and terrain, the command
  nmtquestion, and the cases fs_1_preview_over_panel, fs_2_switch_refusal_cleared and
  fs_3_without_terrain.

lang/editor_pl.po: the Polish of the new texts (the card of the first steps, the summary of the line laid,
"Lay the first track", the names of the periods, seasons and weathers and of the node types), the entries
of the texts replaced given their new English ("Show the first steps in the inspector", "and %zu more,
listed in the tool options", "Lay the first track  (L)" in place of "Or start with:"), and "(do
transmisji)" in place of the English "(stream)" of the drawn cursor.
2026-11-23 12:09:59 +01:00

330 lines
26 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "application/editormode.h"
#include "editor/editorSettings.hpp"
#include "editor/editorGeometry.hpp"
#include "application/application.h"
#include "application/editoruilayer.h"
#include "application/editorprojection.h"
#include "application/editorgestures.h"
#include "imgui/imgui.h"
#include "simulation/simulation.h"
#include "simulation/simulationtime.h"
#include "scene/scenelayers.h"
#include "utilities/Globals.h"
#include "utilities/Logs.h"
#include "world/Track.h"
#include "world/TrackRails.h"
#include "world/MemCell.h"
#include "world/Event.h"
#include "vehicle/DynObj.h"
#include "model/AnimModel.h"
#include "model/Model3d.h"
#include "rendering/renderer.h"
#include "world/Sweep.h"
#include "input/keyboardinput.h"
#include "launcher/textures_scanner.h"
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <algorithm>
#include "editor/editorFormat.hpp"
#include "editor/editorAlignmentStore.hpp"
#include "editor/editorSwitchStore.hpp"
#include "scene/sceneterrain.h"
#include "editor/editorSpeed.hpp"
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <fstream>
#include <map>
#include <sstream>
#include "application/editormodeselftest.h"
editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &command, std::istringstream &words)
{
for (auto const group : {&editor_mode::selftest_scene, &editor_mode::selftest_sleepers, &editor_mode::selftest_sweep, &editor_mode::selftest_track, &editor_mode::selftest_switch, &editor_mode::selftest_rails, &editor_mode::selftest_join, &editor_mode::selftest_signal, &editor_mode::selftest_terrain, &editor_mode::selftest_props, &editor_mode::selftest_monkey, &editor_mode::selftest_expect})
if (auto const result{(this->*group)(command, words)}; result != selftest_result::unhandled)
return result;
for (auto *tool : m_tools)
if (auto const result{tool->selftest(command, words)}; result != selftest_result::unhandled)
return result;
return selftest_result::unhandled;
}
// the script is a text file, one action a line:
// wait <frames>
// camera <x> <y> <z> <x> <y> <z> from the first point, looking at the second
// select <track name>
// selectat <x> <z> the path nearest the point, within 3 m, as a click on it
// trackends <name> logs the ends of the first path of the track against the ground under them
// kbreak <x> <z> K on the track nearest the point: split there, a break of the grade at the height of the ground
// blade [name] logs the blades of each switch cut from the rails: tip, 50 mm head, full head, heel, drop of the head, open flangeway, the gauge lines apart against x^2/2R, vertices in both positions
// frog [name] logs where the inner rails of each switch cross: distance on both paths, 1:n, throat, nose, check rails
// guards [name] logs each guard rail and what each of its ends and breaks is cut along; a fault when a cut is not along a rail or a glued end not on the guard rail of the other track
// railtime lays out the rails of every track, as when its geometry is made, and logs how long it took
// throw <0|1> sets every switch to the path and moves its blades there at once
// crossings [name] logs where rails of tracks cross rails of other tracks and of what kind (acute, obtuse, middle acute or obtuse, wide), checks that each acute crossing has one partner and one nose
// switchtimbers <model|none> the model of the timbers set on all the switches and crossings, as the buttons of the switch tool do it
// frogkey name [on|off] sets or clears the frogs key of a switch (one undo step); logs the key, whether it is written, the frog and the crossings
// geomhash [name] logs the number of vertices and a hash of the drawn geometry of each rail track (rails, trackbed, cut faces), to compare builds; exact: the bits of every value, userdata and tread materials too
// sweep <key>=<value>... model, params (separated by commas), lateral, height, side (origin, near, far,
// centre), top (origin, bottom, top, edge), mode (bend, repeat), step,
// length (original, all, or metres), from, to, widen (0, 1), face (0, 1), tilt (0, 1)
// selectmodel <x> <z> the model instance nearest the point
// bend <key>=<value>... the selected model bent along a track: track (index on the list), axis (auto, z, x),
// turned (0, 1), along (start, origin, middle, end, point), side (origin, near, far,
// middle, point), height (origin, bottom, top, edge, point), point=<x>,<y>,<z>,
// pick=<x>,<y>,<z> (a point of the scene picked as the reference point), go (0, 1)
// selectinclude <x> <z> the include placed nearest the point
// addmodel <x> <z> the model instance nearest the point added to the selection, or taken out (Shift+LMB)
// selection logs the selected models, with the models of their groups
// moveselection <x> <y> <z> the selection moved by the offset, as the gizmo moves it
// turnselection <degrees> the selection turned around the model with the gizmo
// copy, paste <x> <y> <z>, group, ungroup, drop, delete as the keys of the selection do them
// bendset <key>=<value>... the bent model being edited: length, lateral, height, along, side, height
// bendprobe logs the bent model being edited
// undo, redo
// key <S|W|CTRL|RMB> <press|release> [ctrl] a key or right button event, as the window gives it
// lineside <vehicle|hekto|fouling|parallel> the tab of the objects along the track in the track window
// event <name> queues the event
// memcell <name> logs the memory cell
// bendpanel unfolds the bend section of the toolset
// openscenerypopup the window of File / Open scenery, its list searched for zz_
// openscenery <scenery file> the editor starts again with the scenery
// checkspans logs whether the text the scenery files hold at each node's place starts and ends it
// spread <track> <stop 0..2> <reach> logs the paths the spread from the track takes
// newscenery the editor starts again with the wizard of a new scenery
// mapstate logs the orthophoto, the top view and the //$o line of the scenery
// trainset <track> <vehicle path> <skin> <facing> [km/h] the trainset tool puts the vehicle in the middle of the track
// vehicles logs each vehicle: its head, facing, and what its couplers hold
// terrainmode the terrain field of work, with its texture browser
// terrainsculpt <x> <z> <radius> <metres>, terrainpaint <x> <z> <radius> <palette entry>,
// terrainlevel <x> <z> <radius> <target height> [mode] as a stroke of the brush
// terrainadd <count> <spacing> chunks made around the camera, count x count, as the button of the chunks panel does it
// terrainprobe <x> <z> logs the height of the heightmap terrain and the materials of the chunk
// terrainconvert converts every material of the terrain files of the scenery
// terrainmodifier <name> <x0> <z0> <x1> <z1> <formation> <half width> a straight modifier, as the vertical profile makes them
// terraintouchup <0|1> the brushes touch up over the modifiers, or shape the ground under them
// terrainrestore <x> <z> <radius> a stroke of the restore brush
// terrainbake <name> the modifier baked into the ground
// terrainselect <cx> <cz> [add] the chunk selected with the spacing tool (add: Ctrl)
// terrainresolution <spacing> [paint 0|1] the selected chunks converted, as the button of the resolution panel does it
// terrainfill <palette entry> <blur> <rotation> <x> <z> <x> <z> <x> <z>... the area outlined filled, as the fill tool does it
// terrainturn <palette entry> <degrees> the textures of the palette entry turned
// terrainwater <index> <material> [size] material and repeat of a body of water; terrainwaterdefault <material>
// orthophoto <north> <east> <radius> <fit 0|1> [in scene 0|1] the imagery layer on, placed and fitted as given
// orthoarea <x> <z>... | clear the download area through the points of the world, as drawn on the map; orthoareapause 0|1
// orthohires 0|1 the 4K tiles on or off; orthostats logs the tiles, the area and the requests made
// orthosettings [on|radius|opacity|lift|height|year|hires|drape|scene <value>]... the settings of the orthophoto changed as its
// panel and its checkbox change them, kept with the editor, and logged with the origin of the scenery
// nmtsettings [band|around|shape|common|follow|grow|offset|fitted <value>]... the settings of the terrain model changed as the terrain
// panel changes them, and logged with the offset of the model to the scenery
// join <x> <z> <x> <z> [radius] [variant] [transitions 0|1] the free ends at the points joined, as a drag from one to the other
// layto <x> <z> <x> <z> <layout 0..3> <radius> from the free end at the first point towards the second, as a drag in the layout
// layclicks <layout 0..3> <radius> <x> <z>... clicks of the lay tool at the points, a free end within 3 m joined
// laymonkey <seed> <count> [case] random lines laid to and from the free ends of the scenery, as the preview shows them: gaps and
// angles at the joints, loops, the turning wasted and the sharpest curve logged; case: that one alone
// layspeed <km/h> <own 0|1> the speed set for the laying, and whether it goes also on from a track with its own
// laymode <straights|curve>, laytrace <radii 0..3> <straights between 0|1> as the panel of the laying sets them
// endcurves logs every free end of the rails: where, the way out and the curvature its track goes on with
// curvejoint <x> <z> logs the paths meeting at the end nearest the point, the curvature of each and its jump from the ones before to the ones after
// cantcheck <label> logs each jump of the cant at a joint of plain tracks, and the steepest ramp of the cant on a path
// fitcheck <label> logs the steps and grade breaks at the joints, the switches off their plane, the rails against the ground
// laywalk <from|into> <x> <z> <spacing> <noise> <k0> <k1> <L>... a line of known curves on from the free end nearest the point,
// the points along it clicked in the mode of a curve, from the end or towards it (see the command)
// laybends <x> <z> <distance> <degrees> ... <distance> the bends of straights clicked from the free end nearest the point
// layp <x> <z>... the points clicked in the mode set, on the ground, a free end within 3 m reached
// layreport <label> logs the line the points clicked make, as Enter would lay it: its bends and curves, warnings, traces
// layenter, layback, laycancel as Enter, Backspace and Esc while laying
// laysample <x> <z> <heading> <spacing> <noise> <deflection> <R> [<from the first vertex to the second, m> <deflection> <R>]
// a line of known curves, the points along them clicked as a curve traced, the line they make logged
// laychain <layout> <R> <x> <z> | b | u | r | e | t | p... the points clicked, Backspace, undo, redo, Enter, Tab, the line logged
// joints <x> <z>... the joints check over the scenery, the issues around the points logged, every issue with free ends without points
// normsreport <file> [scope 0|1] [plk|tsi|en|ch] [km/h] the tracks checked against the norms of the profile, the line through the
// selected path (0) or the whole scenery (1), the speed of the line class where the tracks have none:
// the report written to the file, its counts logged
// route <x> <z> <single 0|1> the route design of the path nearest the point, a curve or the whole line
// routevertex <i> <R> <L in> <L out> <cant>, routearc <i> <R> <L> <share>, routeshare <i> <share>, routekm <km>
// routeapply, routetake as the buttons of the route design do it
// alignments logs the alignments kept in the scenery and the element under each path
// digitizeall every line not digitized yet kept in the scenery, as the button of the route design does it
// splitkind <kind>, nudgekind <kind> <dx> <dz> the first path over an element of the kind split in two, or moved
// switchplace <template> <x> <z> <direction> <side> the catalogue template whose label starts so put into the straight
// nearest the point, or into the curve (switchcurve); slipplace <template> <x> <z>
// switchslide <name|selected> <metres|back|ahead> the switch moved along its straight or the curve it's bent into, as dragged
// switchreplace <name|selected> <template> the switch given the catalogue template whose label starts so, as the inspector gives it
// switchpieces <R> <n> [name] logs the diverging path made of pieces of each switch: length, the arc R of 1:n against the axis
// switchbreak [name] the first piece of the diverging path moved off its neighbour, the switch committed
// switches logs the switches kept in the scenery and the speed of each diverging track
// deletetrack <name>, deletekind <kind> the path deleted as Del does it, or the first path over an element of the kind
// tracksel <name>... the tracks selected together, as Shift+clicks select them; none: nothing selected
// trackprop <key> [value] the value given to the selected tracks, as typed into the inspector; trackprops logs their values,
// the lines shown under the rows and how many tracks aren't saved
// trackstyle copy [name] | groups <n>... | tick <key> <0|1> | paste | panel | list the properties of a track taken, the groups ticked
// or a property by itself, set on the selected tracks; list logs what they'd change
// tracksimilar <key> the tracks of the scenery with the value of the property of the selected ones selected
// btfcheck <terrain file> the .txtf converted to .btf, the editor lines the binary file keeps logged
// mouse <x> <y>, mouseat <x> <y> <z> the cursor moved to the point of the window, or to where the point of the scene is seen, as the mouse moves it
// glide <x> <y> <z> <steps> <frames> [shot] the cursor led to where the point is seen in steps, frames apart, a screenshot after each step with shot
// button <left|right|middle> <press|release>, wheel <offset> the buttons and the wheel of the mouse, with the keys held
// press <key>, release <key>, tap <key> a key held, let go, or both (ctrl, shift, alt, esc, enter, backspace, del, space, tab, a..z, 0..9, f1..f12)
// softcursor <0|1> the cursor drawn into the picture, for screenshots
// type <text> the characters typed into the text field with the focus
// screenshot
// save
// layermerge <file> <file> the layer of the first file merged into the layer of the second, as the layers panel does
// log <text>
// perf <label> the frames drawn since the last perf and the time per frame logged, the longest frame and those over 33 ms,
// with the timings and counts of the renderer
// fittime <metres>... the grade line of a straight over rolling ground of each length fitted, as at a click, and the time the
// frame waits for it while the track is laid, the line fitted on the thread of the fitter
// nmtauto [unfitted] the tracks put onto the terrain model, all or the ones whose grade line isn't fitted yet
// turntables the height of each turntable and of the model in its pit, and the heights of the tracks running up
// to it out along their lines from the rim, against the model there
// nmtstate logs how far the tracks going onto the terrain model are
// nmtquestion <open|flat|restore> the question of the terrain of a new scenery opened, or answered without terrain as its card does;
// restore: the settings of the terrain made by itself put back as they were before that answer
// gradelines <file> the grade line each track shares written to the file, for a map of them
// fitreport <file> to the file: the tracks off the terrain model, the switches off their plane, the rails on common timbers apart in height
// gradeline <lift m|off|on|whole 0/1|state> the common grade line of the route open in the profile tool: its design lifted and applied, the route taken off it and back
// trackheights <file> the heights of the ends of all the paths and how each track stands to the terrain model
// profiledump <file> the route open in the profile tool to the file: its heights and the points of its grade line
// fittedstate [reload] logs how many tracks have their grade line fitted, and which; reload: read again from the //$t lines
// trackterrain <pull|restore> <track>... the terrain drawn to the tracks, or their formations taken out of it, as the panel of the tracks
// terrainhash a hash of the heights of the terrain chunks in memory, to compare the ground two builds made
// rebuildall the geometry of every path in the sections made already laid anew, the time it took logged,
// and the 3d sleepers of all the tracks laid anew, timed apart
// sleepercheck the 3d sleepers of all the tracks checked for beams over each other and rails without enough under them
// beams <track> <z from> <z to> the beams the track lays with their middles between the two z
// sharedzones <track> where the timbers shared with other tracks reach along the paths of the track and past its ends
// ride <track> [path] [s] the camera riding along the track from the distance on the path, looking towards the growing distance
// ridewalk <metres> [choice] the ride moved ahead (negative: back) as far, the switches from their blades left by the path of the
// choice (0 straighter, 1 the other); logs the place and whether any switch was thrown on the way
// ridejump <-1|1> the ride over to the track alongside on the left or the right of the way ahead
// rideahead, rideprobe, rideleave logs the switch ahead from its blades / logs the place of the ride / ends the ride
// minimap <0|1|2>, stations the minimap shown or hidden (2: the whole scenery in it) / logs the stations the W4 name with their stops
// station <text>, minimapclick <x> <z> the camera to the next stop of the station whose name holds the text / as a click on the map there
// trackcant <track> <path> <start mm> <end mm> the cant typed into the field of the inspector: the tracks joined at the ends follow,
// in the same undo step
// routegauge <mm> [track] the rail axes distance of the norms set as the route tool sets it, the line of the track opened in
// it first unless it's open already
// tracksetdelete <name>... the tracks made the set, one too, and deleted as Del deletes the set
// mark <label> <track> <start|end> the height of the end of the first path kept, for expect lift
// expect cant <track> <start|end> <mm> <tolerance mm> the cant at the end of the first path, as the inspector shows it
// expect joint <track> <start|end> <gap m> <angle deg> <cant step mm> the end of the first path against the end of another track
// nearest to it within 1 m: the gap, the kink and the step of the cant between them, each at most
// expect records <name> <count> [kind] the records of the switch store of the name, with the connections having the switch among theirs
// expect speed <track> <km/h> [tolerance], expect gauge <track> <m> [tolerance] as editor_track::velocity gives it / the gauge
// expect track <name> <present|removed>
// expect route <track> <in|out> the track is a part of the line open in the route tool, or not
// expect norms gauge <mm> [tolerance] the rail axes distance of the norms the tracks are laid to
// expect findings <note|warning|block|any> <least> <most> how many of the tier the last check of the norms found (normsreport)
// expect height <track> <start|end> <m> <tolerance> the height of the end of the first path
// expect lift <track> <start|end> <label> <m> <tolerance> how far the end of the first path is above the height marked
// expect includes <track> <count> the includes whose parameters name the track: the model and the events of a turntable
// expect status <text> the status of the switch tool, as its panel shows it, holds the text (the rest of the line)
// expect statuslacks <text> the status of the switch tool doesn't hold the text
// expect refusal <holds|lacks> <text> what the cursor tells while it's shown holds the text, or doesn't
// expect statusline <holds|lacks> <text> the status line of the editor holds the text, or doesn't
// expect laycursor <x> <z> <tolerance> the point the line of the lay tool goes to from its last point, in the plan
// expect terrain <grow|area|prompt> <0|1> the terrain model made under the tracks as they're laid / around the camera within the
// download area / the question of the terrain open
// expect steps <count> the steps of the history Ctrl+Z takes back, the ones made together counted once
// each expect logs SELFTEST PASS or SELFTEST FAIL; a failed one, or a command no group takes,
// makes the run end with editor_selftest::failed_exit_code
// quit logs SELFTEST result: <failed> failed of <expectations>, the editor closes
void editor_mode::selftest_step()
{
auto &test{m_selftest};
if (false == test.loaded)
{
test.loaded = true;
auto const *file{selftest_script("EU07_EDITOR_SELFTEST")};
if (file == nullptr)
return;
std::ifstream stream(file);
std::string line;
while (std::getline(stream, line))
if (false == line.empty() && line.front() != '#')
test.lines.push_back(line);
WriteLog("SELFTEST: " + std::to_string(test.lines.size()) + " steps from " + file);
}
++editor_selftest::frames();
// how long each frame took, for the longest one perf tells
{
static auto last{std::chrono::steady_clock::now()};
auto const now{std::chrono::steady_clock::now()};
auto const frame{std::chrono::duration<double, std::milli>(now - last).count()};
last = now;
editor_selftest::frame_longest() = std::max(editor_selftest::frame_longest(), frame);
if (frame > 33.0)
++editor_selftest::frames_slow();
}
// the gesture of the clip being recorded, its bottom left corner where the clip has it
if (false == test.badge.empty())
{
auto const words{gesture_picture(test.badge)};
auto const height{std::round(ImGui::GetTextLineHeight() * 1.6f)};
auto const pad{std::round(height * 0.25f)};
ImVec2 const at{test.badge_at.x + pad, test.badge_at.y - pad - height};
auto &list{*ImGui::GetForegroundDrawList(ImGui::GetMainViewport())};
list.AddRectFilled(ImVec2(at.x - pad, at.y - pad), ImVec2(at.x + gesture_width(height, words) + pad, at.y + height + pad), IM_COL32(16, 20, 26, 225), pad);
gesture_draw(list, at, height, words, IM_COL32(235, 235, 235, 255));
}
if (test.wait > 0)
{
--test.wait;
return;
}
while (test.next < test.lines.size())
{
std::istringstream words(test.lines[test.next++]);
std::string command;
words >> command;
if (command == "wait")
{
words >> test.wait;
return;
}
auto const result{selftest_dispatch(command, words)};
if (result == selftest_result::pause || result == selftest_result::again)
{
if (result == selftest_result::again)
--test.next;
return;
}
if (command == "quit")
{
if (false == test.quitting)
{
WriteLog(format("SELFTEST result: %zu failed of %zu", editor_selftest::failures(), editor_selftest::expectations()));
WriteLog("SELFTEST done");
test.quitting = true;
test.wait = 30;
--test.next;
return;
}
Application.queue_quit(true);
return;
}
// a command no group took does nothing: a script mistyped, whose expectations after it would pass for nothing
if (result == selftest_result::unhandled)
{
++editor_selftest::expectations();
++editor_selftest::failures();
WriteLog("SELFTEST FAIL " + command + ": no group took the command");
}
}
}