Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
InternalTestStep.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Single operation used in InternalTests
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
24
25#include "InternalTest.h"
26
27
28// ===========================================================================
29// class definitions
30// ===========================================================================
31
33
34public:
36 enum class Category {
37 META, // Meta step (used for packing set of steps like click or write)
38 INIT, // Setup and start step
39 APP, // send signal to APP (Either GUIAppWindows or GNEApplicationWindow)
40 VIEW, // send signal to view (either GUIView or GNEViewNet)
41 TLS_PHASES, // send signal to TLS Phases module (used for TLS Phases)
42 TLS_PHASETABLE, // send signal to TLSTable (used for TLS Phases)
43 COLOR, // send signal to color dialog
44 };
45
47 class DialogTest {
48
49 public:
51 DialogTest(const FXuint value);
52
54 DialogTest(const std::vector<FXuint>& values);
55
57 DialogTest(const std::string& solution);
58
60 static const FXuint yes = 1;
61
63 static const FXuint no = 2;
64
66 static const FXuint esc = 4;
67
69 static const std::string colorValue;
70
72 const std::vector<FXuint> questionDialogValues;
73
75 const std::string fixSolution;
76
77 private:
79 DialogTest() = delete;
80
82 DialogTest(const DialogTest&) = delete;
83 };
84
87
88 public:
90 TLSTableTest(FXSelector sel_, const int row_);
91
93 TLSTableTest(FXSelector sel_, const int row_, const int column_, const std::string& text_);
94
96 const FXSelector sel = 0;
97
99 const int row = 0;
100
102 const int column = 0;
103
105 const std::string text = "";
106
107 private:
109 TLSTableTest() = delete;
110
112 TLSTableTest(const TLSTableTest&) = delete;
113 };
114
116 InternalTestStep(InternalTest* testSystem, const std::string& step);
117
119 InternalTestStep(InternalTest* testSystem, FXSelector messageType, FXSelector messageID,
120 Category category, const std::string description);
121
123 InternalTestStep(InternalTest* testSystem, FXSelector messageType, Category category,
124 FXEvent* event, const bool updateView, const std::string description);
125
127 InternalTestStep(InternalTestStep* parent, const std::string& solution, const std::string description);
128
130 InternalTestStep(InternalTestStep* parent, FXSelector messageType, FXEvent* event, const std::string description);
131
134
136 FXSelector getMessageType() const;
137
139 FXSelector getMessageID() const;
140
142 DialogTest* getDialogTest() const;
143
146
148 FXSelector getSelector() const;
149
151 bool updateView() const;
152
154 Category getCategory() const;
155
157 void* getEvent() const;
158
160 const std::vector<const InternalTestStep*>& getModalDialogTestSteps() const;
161
163 const std::string& getDescription() const;
164
165private:
168
170 FXSelector myMessageType = SEL_COMMAND;
171
173 FXSelector myMessageID = 0;
174
177
179 bool myUpdateView = false;
180
182 std::string myDescription;
183
185 std::vector<std::string> myArguments;
186
188 FXEvent* myEvent = nullptr;
189
192
195
197 std::vector<const InternalTestStep*> myDialogTestSteps;
198
200 std::string parseStep(const std::string& rowText);
201
203 void parseArguments(const std::string& arguments);
204
206 void setupAndStart();
207
209 void mouseClick(const std::string& button, const std::string& modifier) const;
210
212 void leftClickOffset(const std::string& button) const;
213
215 void moveElementHorizontal() const;
216
218 void moveElementVertical() const;
219
221 void moveElement() const;
222
224 void typeKey() const;
225
227 void contextualMenuOperation() const;
228
230 void protectElements() const;
231
233 void waitDeleteWarning() const;
234
236 void modifyAttribute(const int overlappedTabs) const;
237
239 void modifyBoolAttribute(const int overlappedTabs) const;
240
242 void modifyColorAttribute(const int overlappedTabs) const;
243
245 void modifyVClassDialog_NoDisallowAll(const int overlappedTabs) const;
246
248 void modifyVClassDialog_DisallowAll(const int overlappedTabs) const;
249
251 void modifyVClassDialog_Cancel(const int overlappedTabs) const;
252
254 void modifyVClassDialog_Reset(const int overlappedTabs) const;
255
257 void modifyVTypeDialogAttribute() const;
258
260 void createConnection(const std::string& keyModifier) const;
261
263 void createCrossing() const;
264
266 void modifyCrossingDefaultValue() const;
267
270
272 void crossingClearEdges() const;
273
275 void crossingInvertEdges() const;
276
278 void saveConnectionEdit() const;
279
281 void fixCrossings();
282
284 void fixStoppingPlace();
285
287 void fixRoute();
288
290 void createTLS(const int overlappedTabs) const;
291
293 void copyTLS() const;
294
296 void joinTSL() const;
297
299 void disJoinTLS() const;
300
302 void deleteTLS() const;
303
305 void modifyTLSTable();
306
308 void resetSingleTLSPhases() const;
309
311 void resetAllTLSPhases() const;
312
314 void pressTLSPhaseButton() const;
315
317 void addPhase(const std::string& type);
318
320 void pressTLSButton(const std::string& type);
321
323 void checkParameters(const int overlappedTabs) const;
324
326 void checkDoubleParameters(const int overlappedTabs) const;
327
329 void changeEditMode();
330
333
335 void checkUndoRedo() const;
336
338 void deleteFunction() const;
339
341 void selection() const;
342
344 void selectNetworkItems() const;
345
347 void lockSelection() const;
348
350 void selectionRectangle() const;
351
353 void createDataSet() const;
354
356 void createDataInterval() const;
357
359 void undo() const;
360
362 void redo() const;
363
365 void changeSupermode();
366
368 void changeMode();
369
371 void changeElement() const;
372
374 void changePlan() const;
375
377 void computeJunctions();
378
381
384
387
389 void createSquaredShape();
390
392 void createLineShape();
393
395 void createMeanData();
396
398 void deleteMeanData();
399
401 void copyMeanData();
402
404 void quit();
405
407 bool checkIntArgument(const std::string& argument) const;
408
410 int getIntArgument(const std::string& argument) const;
411
413 bool checkBoolArgument(const std::string& argument) const;
414
416 bool getBoolArgument(const std::string& argument) const;
417
419 bool checkStringArgument(const std::string& argument) const;
420
422 std::string getStringArgument(const std::string& argument) const;
423
425 std::string stripSpaces(const std::string& str) const;
426
428 void writeError(const std::string& function, const int overlapping,
429 const std::string& expected) const;
430
432 void createShape(const InternalTest::ViewPosition& viewPosition,
433 const int sizeX, const int sizeY, const bool close,
434 const bool line) const;
435
438
440 void modifyStringAttribute(const int tabs, const int overlappedTabs, const std::string& value) const;
441
443 void modifyBoolAttribute(const int tabs, const int overlappedTabs) const;
444
446
449
451 void buildUndo(const int number) const;
452
454 void buildRedo(const int number) const;
455
457
460
462 std::pair<FXint, FXString> translateKey(const std::string& key) const;
463
465 FXEvent* buildKeyPressEvent(const std::string& key) const;
466
468 FXEvent* buildKeyReleaseEvent(const std::string& key) const;
469
471 void buildPressKeyEvent(const std::string& key, const bool updateView) const;
472
474 void buildPressKeyEvent(InternalTestStep* parent, const std::string& key) const;
475
477 void buildTwoPressKeyEvent(const std::string& keyA, const std::string& keyB, const bool updateView) const;
478
480 void buildTwoPressKeyEvent(InternalTestStep* parent, const std::string& keyA, const std::string& keyB) const;
481
483
486
488 void buildMouseClick(const InternalTest::ViewPosition& viewPosition,
489 const int offsetX, const int offsetY,
490 const std::string& button, const std::string& keyModifier) const;
491
493 void buildMouseDragDrop(const InternalTest::ViewPosition& viewStartPosition,
494 const int offsetStartX, const int offsetStartY,
495 const InternalTest::ViewPosition& viewEndPosition,
496 const int offsetEndX, const int offsetEndY,
497 const std::string& keyModifier) const;
498
500 FXEvent* buildMouseMoveEvent(const InternalTest::ViewPosition& viewPosition,
501 const int offsetX, const int offsetY, const int clickedButton,
502 const std::string& keyModifier, const int numberOfClicks) const;
503
505 FXEvent* buildMouseClickEvent(FXSelType type, const InternalTest::ViewPosition& viewPosition,
506 const int offsetX, const int offsetY, const std::string& keyModifier,
507 const int numberOfClicks) const;
508
510 void writeClickInfo(const InternalTest::ViewPosition& viewPosition,
511 const int offsetX, const int offsetY,
512 const std::string modifier) const;
513
515
518
521
524};
dialog arguments (used for certain functions that opens modal dialogs)
static const FXuint esc
ESC or cancel value.
DialogTest(const DialogTest &)=delete
invalidated copy constructor
static const FXuint no
no value
DialogTest()=delete
invalidated default constructor
const std::string fixSolution
solution for fix dialogs
static const std::string colorValue
color dialog value
static const FXuint yes
yes value
const std::vector< FXuint > questionDialogValues
used if we have multiple modal dialogs
struct used for test TLS Tables
TLSTableTest(const TLSTableTest &)=delete
invalidated copy constructor
const FXSelector sel
selector
TLSTableTest()=delete
invalidated default constructor
void modifyStringAttribute(const int tabs, const int overlappedTabs, const std::string &value) const
modify attribute
void changeSupermode()
process supermode function
DialogTest * getDialogTest() const
get dialog arguments
const std::string & getDescription() const
get description
void contextualMenuOperation() const
process contextualMenuOperation function
FXEvent * buildKeyPressEvent(const std::string &key) const
build key press event
std::pair< FXint, FXString > translateKey(const std::string &key) const
translate key
void modifyVTypeDialogAttribute() const
process modifyVTypeDialogAttribute function
void createSquaredShape()
process create squared shape function
void * getEvent() const
get event associated with this step
std::string stripSpaces(const std::string &str) const
strip spaces
void fixStoppingPlace()
process fixStoppingPlace function
void modifyVClassDialog_DisallowAll(const int overlappedTabs) const
process modifyVClassDialog_DisallowAll function
Category myCategory
step category
void joinTSL() const
process join TLS function
void modifyCrossingDefaultBoolValue() const
process modifyCrossingDefaultBoolValue function
FXEvent * myEvent
list of events associated with this step
void modifyVClassDialog_Reset(const int overlappedTabs) const
process modifyVClassDialog_Reset function
InternalTestStep()=delete
invalidate default constructor
void buildMouseDragDrop(const InternalTest::ViewPosition &viewStartPosition, const int offsetStartX, const int offsetStartY, const InternalTest::ViewPosition &viewEndPosition, const int offsetEndX, const int offsetEndY, const std::string &keyModifier) const
build mouse dragdrop
void disJoinTLS() const
process disJoin TLS function
void lockSelection() const
process lockSelection function
void modifyTLSTable()
process modifyTLSTable function
std::string getStringArgument(const std::string &argument) const
get string argument
InternalTestStep(const InternalTestStep &)=delete
Invalidated copy constructor.
std::string myDescription
description
void setupAndStart()
process setupAndStart function
void crossingInvertEdges() const
process crossingInvertEdges function
void resetSingleTLSPhases() const
process resetSingleTLSPhases function
DialogTest * myDialogTest
dialog test
void checkParameters(const int overlappedTabs) const
process checkParameters function
void selection() const
process selection function
void pressTLSButton(const std::string &type)
process pressTLSButton function
const std::vector< const InternalTestStep * > & getModalDialogTestSteps() const
get key events used in certain dialogs (allowDialog, etc.)
void resetAllTLSPhases() const
process resetAllTLSPhases function
void selectAdditionalChild()
create rectangle shape
FXSelector getSelector() const
get selector (based in messageType and messageID)
void buildTwoPressKeyEvent(const std::string &keyA, const std::string &keyB, const bool updateView) const
build a two key press and key release (used for tabs, spaces, enter, etc)
void buildRedo(const int number) const
process check redo function
void undo() const
process check undo function
void moveElementVertical() const
process moveElementVertical function
void modifyColorAttribute(const int overlappedTabs) const
process modifyColorAttribute function
bool getBoolArgument(const std::string &argument) const
get bool argument
bool updateView() const
check if update view
void protectElements() const
process protect elements function
void createCrossing() const
process createCrossing function
void checkDoubleParameters(const int overlappedTabs) const
process checkDoubleParameters function
void modifyBoolAttribute(const int overlappedTabs) const
process modifyBoolAttribute function
void addPhase(const std::string &type)
process addPhase function
void mouseClick(const std::string &button, const std::string &modifier) const
process click function
void checkUndoRedo() const
process check undo-redo function
InternalTestStep & operator=(const InternalTestStep &)=delete
Invalidated assignment operator.
void crossingClearEdges() const
process crossingClearEdges function
bool checkBoolArgument(const std::string &argument) const
check bool argument
std::string parseStep(const std::string &rowText)
parse function and arguments
void modifyVClassDialog_NoDisallowAll(const int overlappedTabs) const
process modifyVClassDialog_DisallowAll function
void copyMeanData()
process copyMeanData function
void deleteTLS() const
process delete TLS function
void buildMouseClick(const InternalTest::ViewPosition &viewPosition, const int offsetX, const int offsetY, const std::string &button, const std::string &keyModifier) const
build mouse click event
void buildPressKeyEvent(const std::string &key, const bool updateView) const
build a key press and key release (used for tabs, spaces, enter, etc)
InternalTest * myTestSystem
test system parent
void createShape(const InternalTest::ViewPosition &viewPosition, const int sizeX, const int sizeY, const bool close, const bool line) const
create shape
void saveConnectionEdit() const
process createConnectionEdit function
TLSTableTest * myTLSTableTest
TLS Table test.
void createTLS(const int overlappedTabs) const
process createTLS function
void modifyAttribute(const int overlappedTabs) const
process modifyAttribute function
void selectNetworkItems() const
process selectNetworkItems function
bool checkIntArgument(const std::string &argument) const
check int argument
void copyTLS() const
process Copy TLS function
void writeClickInfo(const InternalTest::ViewPosition &viewPosition, const int offsetX, const int offsetY, const std::string modifier) const
write click info
void changeEditMode()
process changeEditMode function
void createDataSet() const
process createDataSet function
void createMeanData()
process createMeanData function
void waitDeleteWarning() const
process waitDeleteWarning function
void createConnection(const std::string &keyModifier) const
process createConnection function
FXSelector myMessageID
message ID
TLSTableTest * getTLSTableTest() const
get TLS Table test
FXSelector getMessageID() const
get message ID
void createDataInterval() const
process createDataInterval function
void buildUndo(const int number) const
process check undo function
void moveElementHorizontal() const
process moveElementHorizontal function
void computeJunctions()
process compute junctions function
bool myUpdateView
flag to enable or disable view after execute step
void pressTLSPhaseButton() const
process pressTLSPhaseButton function
void parseArguments(const std::string &arguments)
parse arguments
void quit()
process quit function
void changeElement() const
process change element function
std::vector< const InternalTestStep * > myDialogTestSteps
Test steps used in dialog test.
void deleteMeanData()
process deleteMeanData function
void changeMode()
process change mode function
bool checkStringArgument(const std::string &argument) const
check string argument
~InternalTestStep()
destructor
void changePlan() const
@bief process change plan function
void redo() const
process check redo function
void fixCrossings()
process fixCrossings function
FXSelector myMessageType
message type (by default SEL_COMMAND)
void createRectangledShape()
process create rectangle shape function
void createLineShape()
process create line shape function
void saveExistentShortcut()
process save function
void typeKey() const
process typeKey function
std::vector< std::string > myArguments
arguments
void writeError(const std::string &function, const int overlapping, const std::string &expected) const
write error
Category getCategory() const
get category
void fixRoute()
process fixRoutes function
void selectionRectangle() const
process selectionRectangle function
void leftClickOffset(const std::string &button) const
process click function
void computeJunctionsVolatileOptions()
process compute junctions with volatile options function
void modifyVClassDialog_Cancel(const int overlappedTabs) const
process modifyVClassDialog_Cancel function
void moveElement() const
process moveElement function
int getIntArgument(const std::string &argument) const
get int argument
FXEvent * buildKeyReleaseEvent(const std::string &key) const
build key release event
FXSelector getMessageType() const
get message type
void deleteFunction() const
process delete function
FXEvent * buildMouseMoveEvent(const InternalTest::ViewPosition &viewPosition, const int offsetX, const int offsetY, const int clickedButton, const std::string &keyModifier, const int numberOfClicks) const
build mouse move event
void modifyCrossingDefaultValue() const
process modifyCrossingDefaultValue function
FXEvent * buildMouseClickEvent(FXSelType type, const InternalTest::ViewPosition &viewPosition, const int offsetX, const int offsetY, const std::string &keyModifier, const int numberOfClicks) const
build mouse left click press event