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
25
26#include "InternalTest.h"
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 FINISH, // Write last line
40 APP, // send signal to APP (Either GUIAppWindows or GNEApplicationWindow)
41 VIEW, // send signal to view (either GUIView or GNEViewNet)
42 TLS_PHASES, // send signal to TLS Phases module (used for TLS Phases)
43 TLS_PHASETABLE, // send signal to TLSTable (used for TLS Phases)
44 DIALOG, // send signal to dialog (used for modal dialogs)
45 };
46
49
50 public:
52 enum class Action {
53 ACCEPT, // press accept button
54 CANCEL, // press cancel button
55 RESET, // press reset button
56 ABORT, // abort dialog
57 CUSTOM, // custom action
58 NONE, // no action
59 };
60
62 DialogArgument(DialogType type, Action action);
63
65 DialogArgument(DialogType type, const std::string& customAction);
66
68 DialogArgument(DialogType type, const std::string& customAction, const int index);
69
71 DialogArgument(DialogType type, const std::string& prefixToRemove, const std::string& customAction);
72
74 DialogType getType() const;
75
77 Action getAction() const;
78
80 const std::string& getCustomAction() const;
81
83 int getIndex() const;
84
85 protected:
88
91
93 std::string myCustomAction;
94
96 int myIndex = 0;
97
98 private:
100 DialogArgument() = delete;
101
104 };
105
108
109 public:
111 TLSTableTest(FXSelector sel_, const int row_);
112
114 TLSTableTest(FXSelector sel_, const int row_, const int column_, const std::string& text_);
115
117 const FXSelector sel = 0;
118
120 const int row = 0;
121
123 const int column = 0;
124
126 const std::string text = "";
127
128 private:
130 TLSTableTest() = delete;
131
133 TLSTableTest(const TLSTableTest&) = delete;
134 };
135
137 InternalTestStep(InternalTest* testSystem, const std::string& step);
138
140 InternalTestStep(InternalTest* testSystem, FXSelector messageType, FXSelector messageID,
141 Category category, const std::string& description);
142
144 InternalTestStep(InternalTest* testSystem, FXSelector messageType, Category category,
145 FXEvent* event, const bool updateView, const std::string& description);
146
148 InternalTestStep(InternalTest* testSystem, DialogArgument* dialogArgument,
149 const std::string& description);
150
153
156
159
161 void setNextStep(InternalTestStep* nextStep);
162
164
166 FXSelector getMessageType() const;
167
169 FXSelector getMessageID() const;
170
173
176
178 FXSelector getSelector() const;
179
181 bool updateView() const;
182
184 Category getCategory() const;
185
187 void* getEvent() const;
188
190 const std::string& getDescription() const;
191
192private:
195
198
200 FXSelector myMessageType = SEL_COMMAND;
201
203 FXSelector myMessageID = 0;
204
207
209 bool myUpdateView = false;
210
212 std::string myDescription;
213
215 std::vector<std::string> myArguments;
216
218 FXEvent* myEvent = nullptr;
219
222
225
227 std::string parseStep(const std::string& rowText);
228
230 void parseArguments(const std::string& arguments);
231
233 void setupAndStart();
234
236 void finish();
237
239 void mouseClick(const std::string& button, const std::string& modifier) const;
240
242 void leftClickOffset(const std::string& button) const;
243
245 void moveElementHorizontal() const;
246
248 void moveElementVertical() const;
249
251 void moveElement() const;
252
254 void focusOnFrame() const;
255
257 void typeKey() const;
258
260 void contextualMenuOperation() const;
261
263 void protectElements() const;
264
266 void waitDeleteWarning() const;
267
269 void modifyAttribute(const int overlappedTabs) const;
270
272 void modifyBoolAttribute(const int overlappedTabs) const;
273
275 void modifyColorAttribute(const int overlappedTabs) const;
276
278 void modifyVClassDialog_NoDisallowAll(const int overlappedTabs) const;
279
281 void modifyVClassDialog_DisallowAll(const int overlappedTabs) const;
282
284 void modifyVClassDialog_Cancel(const int overlappedTabs) const;
285
287 void modifyVClassDialog_Reset(const int overlappedTabs) const;
288
290 void modifyVTypeDialogAttribute() const;
291
293 void createConnection(const std::string& keyModifier) const;
294
296 void createCrossing() const;
297
299 void modifyCrossingDefaultValue() const;
300
303
305 void crossingClearEdges() const;
306
308 void crossingInvertEdges() const;
309
311 void saveConnectionEdit() const;
312
314 void fixCrossings();
315
317 void fixStoppingPlace();
318
320 void fixRoute();
321
323 void createTLS(const int overlappedTabs) const;
324
326 void copyTLS() const;
327
329 void joinTSL() const;
330
332 void disJoinTLS() const;
333
335 void deleteTLS() const;
336
338 void modifyTLSTable();
339
341 void resetSingleTLSPhases() const;
342
344 void resetAllTLSPhases() const;
345
347 void pressTLSPhaseButton() const;
348
350 void addPhase(const std::string& type);
351
353 void pressTLSButton(const std::string& type);
354
356 void checkParameters(const int overlappedTabs) const;
357
359 void checkDoubleParameters(const int overlappedTabs) const;
360
362 void changeEditMode();
363
365 void saveExistentFile();
366
368 void checkUndoRedo() const;
369
371 void deleteFunction() const;
372
374 void selection() const;
375
377 void selectNetworkItems() const;
378
380 void lockSelection() const;
381
383 void selectionRectangle() const;
384
386 void createDataSet() const;
387
389 void createDataInterval() const;
390
392 void openAboutDialog();
393
395 void loadFile();
396
398 void saveNewFile();
399
401 void saveFileAs();
402
404 void reloadFile();
405
407 void selectEdgeType();
408
410 void createNewEdgeType();
411
413 void overwritingAccept();
414
416 void overwritingCancel();
417
419 void overwritingAbort();
420
423
425 void undo() const;
426
428 void redo() const;
429
431 void changeSupermode();
432
434 void changeMode();
435
437 void changeElement() const;
438
440 void changePlan() const;
441
443 void computeJunctions();
444
447
450
453
455 void createSquaredShape();
456
458 void createLineShape();
459
461 void createMeanData();
462
464 void deleteMeanData();
465
467 void copyMeanData();
468
470 void quit();
471
473 bool checkIntArgument(const std::string& argument) const;
474
476 int getIntArgument(const std::string& argument) const;
477
479 bool checkBoolArgument(const std::string& argument) const;
480
482 bool getBoolArgument(const std::string& argument) const;
483
485 bool checkStringArgument(const std::string& argument) const;
486
488 std::string getStringArgument(const std::string& argument) const;
489
491 std::string stripSpaces(const std::string& str) const;
492
494 void writeError(const std::string& function, const int overlapping,
495 const std::string& expected) const;
496
498 void createShape(const InternalTest::ViewPosition& viewPosition,
499 const int sizeX, const int sizeY, const bool close,
500 const bool line) const;
501
504
506 void modifyStringAttribute(Category category, const int tabs, const int overlappedTabs, const std::string& value) const;
507
509 void modifyBoolAttribute(Category category, const int tabs, const int overlappedTabs) const;
510
512
515
517 void buildUndo(const int number) const;
518
520 void buildRedo(const int number) const;
521
523
526
528 std::pair<FXint, FXString> translateKey(const std::string& key) const;
529
531 FXEvent* buildKeyPressEvent(const std::string& key) const;
532
534 FXEvent* buildKeyReleaseEvent(const std::string& key) const;
535
537 void buildPressKeyEvent(Category category, const std::string& key, const bool updateView) const;
538
540 void buildTwoPressKeyEvent(Category category, const std::string& keyA, const std::string& keyB, const bool updateView) const;
541
543
546
548 void buildMouseClick(const InternalTest::ViewPosition& viewPosition,
549 const int offsetX, const int offsetY,
550 const std::string& button, const std::string& keyModifier) const;
551
553 void buildMouseDragDrop(const InternalTest::ViewPosition& viewStartPosition,
554 const int offsetStartX, const int offsetStartY,
555 const InternalTest::ViewPosition& viewEndPosition,
556 const int offsetEndX, const int offsetEndY,
557 const std::string& keyModifier) const;
558
560 FXEvent* buildMouseMoveEvent(const InternalTest::ViewPosition& viewPosition,
561 const int offsetX, const int offsetY, const int clickedButton,
562 const std::string& keyModifier, const int numberOfClicks) const;
563
565 FXEvent* buildMouseClickEvent(FXSelType type, const InternalTest::ViewPosition& viewPosition,
566 const int offsetX, const int offsetY, const std::string& keyModifier,
567 const int numberOfClicks) const;
568
570 void writeClickInfo(const InternalTest::ViewPosition& viewPosition,
571 const int offsetX, const int offsetY,
572 const std::string modifier) const;
573
575
578
581
584};
DialogType
dialog arguments, used for certain modal dialogs that can not be edited using tab
const std::string & getCustomAction() const
get custom action
Action getAction() const
get basic action
DialogArgument(const DialogArgument &)=delete
invalidated copy constructor
DialogType getType() const
get type
DialogArgument()=delete
invalidated default constructor
std::string myCustomAction
action to be carried out in the dialog
struct used for test TLS Tables
TLSTableTest(const TLSTableTest &)=delete
invalidated copy constructor
const FXSelector sel
selector
TLSTableTest()=delete
invalidated default constructor
void changeSupermode()
process changeSupermode function
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 createSquaredShape 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 reloadFile()
process reload file function
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 * getNextStep() const
get next step
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
void modifyStringAttribute(Category category, const int tabs, const int overlappedTabs, const std::string &value) const
modify attribute
void checkParameters(const int overlappedTabs) const
process checkParameters function
void selection() const
process selection function
void pressTLSButton(const std::string &type)
process pressTLSButton function
void resetAllTLSPhases() const
process resetAllTLSPhases function
void selectAdditionalChild()
process selectChild function
FXSelector getSelector() const
get selector (based in messageType and messageID)
void buildRedo(const int number) const
process check redo function
void undo() const
process undo function
InternalTestStep * myNextStep
next step in the test
void moveElementVertical() const
process moveElementVertical function
void focusOnFrame() const
process focusOnFrame 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 overwritingAccept()
process overwriting accept function
void selectEdgeType()
process select edge type function
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 createNewEdgeType()
process create new edge type 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.
DialogArgument * myDialogArgument
dialog argument
void crossingClearEdges() const
process crossingClearEdges function
void overwritingApplyToAll()
process overwriting apply to all function
void saveExistentFile()
process save existent 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
InternalTest * myTestSystem
test system parent
void openAboutDialog()
process openAboutDialog function
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
DialogArgument * getDialogArgument() const
get dialog argument
void createDataSet() const
process createDataSet function
void createMeanData()
process createMeanData function
void buildTwoPressKeyEvent(Category category, 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 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 computeJunctions function
void saveFileAs()
process save file as 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 changeElement function
void deleteMeanData()
process deleteMeanData function
void changeMode()
process changeMode function
bool checkStringArgument(const std::string &argument) const
check string argument
void buildPressKeyEvent(Category category, const std::string &key, const bool updateView) const
build a key press and key release (used for tabs, spaces, enter, etc)
~InternalTestStep()
destructor
void changePlan() const
@bief process changePlan function
void redo() const
process redo function
void fixCrossings()
process fixCrossings function
void overwritingAbort()
process overwriting abort function
FXSelector myMessageType
message type (by default SEL_COMMAND)
void createRectangledShape()
process createRectangledShape function
void createLineShape()
process createLineShape 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
void setNextStep(InternalTestStep *nextStep)
set next step
Category getCategory() const
get category
void fixRoute()
process fixRoutes function
void selectionRectangle() const
process selectionRectangle function
void saveNewFile()
process save new file function
void leftClickOffset(const std::string &button) const
process click function
void computeJunctionsVolatileOptions()
process computeJunctionsVolatileOptions function
void modifyVClassDialog_Cancel(const int overlappedTabs) const
process modifyVClassDialog_Cancel function
void overwritingCancel()
process overwriting 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 loadFile()
process load file function
void modifyCrossingDefaultValue() const
process modifyCrossingDefaultValue function
void finish()
finish 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