VT100 Terminal App
Circle VT100 module documentation
Loading...
Searching...
No Matches
VTTest.h
1//------------------------------------------------------------------------------
2// Module: VTTest
3// Description: Simple VT100 test runner for renderer validation.
4// Author: R. Zuehlsdorff
5// Created: 2026-02-09
6// License: MIT License (https://opensource.org/license/mit/)
7//------------------------------------------------------------------------------
8
9#pragma once
10
11#include <circle/types.h>
12
13#include "TConfig.h"
14
15class CTRenderer;
16
18{
19public:
22 {
24 const char *name;
26 const char *sequence;
28 const char *hint;
33 };
34
35 CVTTest(void);
36
38 void Initialize(CTRenderer *pRenderer);
39
42 void Tick(void);
43
47 bool OnKeyPress(const char *pString);
48
50 bool IsActive() const;
51
52 static constexpr unsigned kMaxSteps = 64;
53
54private:
55 void Start(void);
56 void StartSuite(unsigned index);
57 void Stop(void);
58 void RunStep(const TVTTestStep &step);
59 void ShowHint(const TVTTestStep &step, bool pass);
60 void ShowPrompt(void);
61 void ShowIntro(void);
62 void ShowSummary(void);
63 void LogSummary(void);
64 void DrawTestFrame(const TVTTestStep &step);
65 void StartBoundaryAnimation(bool wrapAroundEnabled, bool marginBellMode);
66 void ServiceBoundaryAnimation(unsigned nowTicks);
67
68 enum TTestResult
69 {
70 ResultPending = 0,
71 ResultPass,
72 ResultFail
73 };
74
75 enum TBoundaryTestMode
76 {
77 BoundaryTestNone = 0,
78 BoundaryTestWrapOn,
79 BoundaryTestWrapOff,
80 BoundaryTestMarginBell
81 };
82
83 CTRenderer *m_pRenderer;
84 bool m_bActive;
85 bool m_bCompleted;
86 bool m_bLastEnabled;
87 bool m_bStopRequested = false;
88 unsigned m_nStep;
89 unsigned m_nNextTick;
91 bool m_bWaitForKey;
92 bool m_bKeyPressed = false;
93 bool m_bHoldClearScreen = false;
94 bool m_bSummaryActive = false;
95 bool m_bIntroActive = false;
96 const TVTTestStep *m_pHoldStep = nullptr;
97 bool m_bHoldCursorToggle = false;
98
100 unsigned m_suiteIndex = 0;
101 const char *m_suiteName = nullptr;
102 const TVTTestStep *m_steps = nullptr;
103 unsigned m_stepCount = 0;
104 bool m_bAwaitNextSuite = false;
105 bool m_bShowRulers = true;
106 bool m_bTabLayout = false;
107
109 static constexpr unsigned kMaxAllResults = 128;
110 const char *m_allNames[kMaxAllResults];
111 TTestResult m_allResults[kMaxAllResults];
112 unsigned m_allCount = 0;
113
114 bool m_bScrollTestActive = false;
115 unsigned m_scrollLineIndex = 0;
116 unsigned m_scrollNextTick = 0;
117
118 TBoundaryTestMode m_BoundaryTestMode = BoundaryTestNone;
119 unsigned m_BoundaryRow = 0;
120 unsigned m_BoundaryStartCol = 0;
121 unsigned m_BoundaryCharIndex = 0;
122 unsigned m_BoundaryNextTick = 0;
123 unsigned m_BoundaryBellCol = 0;
124 bool m_BoundaryBellTriggered = false;
125 char m_BoundaryChars[24]{};
126
128 bool m_bSequencePartsActive = false;
129 const char **m_sequenceParts = nullptr;
130 unsigned m_sequencePartCount = 0;
131 unsigned m_sequencePartIndex = 0;
132 unsigned m_sequenceNextTick = 0;
133 bool m_bShowPromptAfterSequence = false;
134
136 bool m_bPendingResult = false;
137 TTestResult m_pendingResult = ResultPending;
138
139 bool m_hasSavedTabStops = false;
140 bool m_savedTabStops[CTConfig::TabStopsMax]{};
141 bool m_hasSavedSmoothScroll = false;
142 boolean m_savedSmoothScroll = TRUE;
143 bool m_hasSavedWrapAround = false;
144 boolean m_savedWrapAround = TRUE;
145
146 TTestResult m_TestResults[kMaxSteps];
147};
Declares the configuration task that persists and exposes VT100 settings.
Combines Circle framebuffer access with a VT100-aware state machine.
Definition TRenderer.h:51
Definition VTTest.h:18
bool IsActive() const
Return whether VTTest is currently active and processing input.
Definition VTTest.cpp:338
void Initialize(CTRenderer *pRenderer)
Attach the renderer used for test output.
Definition VTTest.cpp:243
void Tick(void)
Periodic tick invoked from the kernel periodic task.
Definition VTTest.cpp:414
bool OnKeyPress(const char *pString)
Notify test runner about a key press for manual confirmation.
Definition VTTest.cpp:618
Single test step definition used by suites.
Definition VTTest.h:22
const char * sequence
Escape sequence payload executed for this step (may be empty for multi-part steps).
Definition VTTest.h:26
const char * hint
Guidance text displayed during the step.
Definition VTTest.h:28
int expectedRow
Optional expected row (0-based) for programmatic validation (unused).
Definition VTTest.h:30
const char * name
Human-readable step name shown in the UI/log.
Definition VTTest.h:24
int expectedCol
Optional expected column (0-based) for programmatic validation (unused).
Definition VTTest.h:32