Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
InternalTestStep.cpp
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#include <config.h>
21
22#include <fxkeys.h>
23
26
27#include "InternalTestStep.h"
28
29// ===========================================================================
30// static member definitions
31// ===========================================================================
32
33const std::string InternalTestStep::DialogTest::colorValue = "139,131,120";
34// this offsets corresponds to the offset of the test magenta square
35constexpr int MOUSE_OFFSET_X = 24;
36constexpr int MOUSE_OFFSET_Y = 25;
37constexpr int MOUSE_REFERENCE_X = 304;
38constexpr int MOUSE_REFERENCE_Y = 168;
39
40// ===========================================================================
41// member method definitions
42// ===========================================================================
43
44// ---------------------------------------------------------------------------
45// InternalTestStep::DialogTest - public methods
46// ---------------------------------------------------------------------------
47
49 questionDialogValues({value}) {
50}
51
52
53InternalTestStep::DialogTest::DialogTest(const std::vector<FXuint>& values) :
54 questionDialogValues(values) {
55}
56
57
58InternalTestStep::DialogTest::DialogTest(const std::string& solution) :
59 fixSolution(solution) {
60}
61
62// ---------------------------------------------------------------------------
63// InternalTestStep::TLSTableTest - public methods
64// ---------------------------------------------------------------------------
65
66InternalTestStep::TLSTableTest::TLSTableTest(FXSelector sel_, const int row_) :
67 sel(sel_),
68 row(row_) {
69}
70
71
72InternalTestStep::TLSTableTest::TLSTableTest(FXSelector sel_, const int row_, const int column_, const std::string& text_) :
73 sel(sel_),
74 row(row_),
75 column(column_),
76 text(text_) {
77}
78
79// ---------------------------------------------------------------------------
80// InternalTestStep - public methods
81// ---------------------------------------------------------------------------
82
83InternalTestStep::InternalTestStep(InternalTest* testSystem, const std::string& step) :
84 myTestSystem(testSystem) {
85 // add this testStep to test system
86 testSystem->addTestSteps(this);
87 // get overlapped tabs
88 const int overlappedTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.editElements.overlapped");
89 // parse step
90 const auto function = parseStep(step);
91 // set description based in function
92 myDescription = "Process function: " + function;
93 // continue depending of function
94 if (function == "setupAndStart") {
96 } else if ((function == "leftClick") || (function == "leftClickData")) {
97 mouseClick("left", "");
98 } else if (function == "leftClickControl") {
99 mouseClick("left", "control");
100 } else if (function == "leftClickShift") {
101 mouseClick("left", "shift");
102 } else if (function == "rightClick") {
103 mouseClick("right", "");
104 } else if (function == "rightClickControl") {
105 mouseClick("right", "control");
106 } else if (function == "rightClickShift") {
107 mouseClick("right", "shift");
108 } else if (function == "leftClickOffset") {
109 leftClickOffset("left");
110 } else if (function == "typeKey") {
111 typeKey();
112 } else if (function == "moveElementHorizontal") {
114 } else if (function == "moveElementVertical") {
116 } else if (function == "moveElement") {
117 moveElement();
118 } else if (function == "contextualMenuOperation") {
120 } else if (function == "protectElements") {
122 } else if (function == "waitDeleteWarning") {
124 } else if (function == "modifyAttribute") {
126 } else if (function == "modifyAttributeOverlapped") {
127 modifyAttribute(overlappedTabs);
128 } else if (function == "modifyBoolAttribute") {
130 } else if (function == "modifyBoolAttributeOverlapped") {
131 modifyBoolAttribute(overlappedTabs);
132 } else if (function == "modifyColorAttribute") {
134 } else if (function == "modifyColorAttributeOverlapped") {
135 modifyColorAttribute(overlappedTabs);
136 } else if (function == "modifyVClassDialog_NoDisallowAll") {
138 } else if (function == "modifyVClassDialogOverlapped_NoDisallowAll") {
139 modifyVClassDialog_NoDisallowAll(overlappedTabs);
140 } else if (function == "modifyVClassDialog_DisallowAll") {
142 } else if (function == "modifyVClassDialogOverlapped_DisallowAll") {
143 modifyVClassDialog_DisallowAll(overlappedTabs);
144 } else if (function == "modifyVClassDialog_Cancel") {
146 } else if (function == "modifyVClassDialogOverlapped_Cancel") {
147 modifyVClassDialog_Cancel(overlappedTabs);
148 } else if (function == "modifyVClassDialog_Reset") {
150 } else if (function == "modifyVClassDialogOverlapped_Reset") {
151 modifyVClassDialog_Reset(overlappedTabs);
152 } else if (function == "modifyVTypeDialogAttribute") {
154 } else if (function == "createConnection") {
156 } else if (function == "createCrossing") {
158 } else if (function == "modifyCrossingDefaultValue") {
160 } else if (function == "modifyCrossingDefaultBoolValue") {
162 } else if (function == "crossingClearEdges") {
164 } else if (function == "crossingInvertEdges") {
166 } else if (function == "createConnectionConflict") {
167 createConnection("control");
168 } else if (function == "createConnectionYield") {
169 createConnection("shift");
170 } else if (function == "saveConnectionEdit") {
172 } else if (function == "fixCrossings") {
173 fixCrossings();
174 } else if (function == "fixStoppingPlace") {
176 } else if (function == "fixRoute") {
177 fixRoute();
178 } else if (function == "createTLS") {
179 createTLS(0);
180 } else if (function == "createTLSOverlapped") {
181 createTLS(overlappedTabs);
182 } else if (function == "copyTLS") {
183 copyTLS();
184 } else if (function == "joinTSL") {
185 joinTSL();
186 } else if (function == "disJoinTLS") {
187 disJoinTLS();
188 } else if (function == "deleteTLS") {
189 deleteTLS();
190 } else if (function == "modifyTLSTable") {
192 } else if (function == "resetSingleTLSPhases") {
194 } else if (function == "resetAllTLSPhases") {
196 } else if (function == "pressTLSPhaseButton") {
198 } else if (function == "addDefaultPhase") {
199 addPhase("default");
200 } else if (function == "addDuplicatePhase") {
201 addPhase("duplicate");
202 } else if (function == "addRedPhase") {
203 addPhase("red");
204 } else if (function == "addYellowPhase") {
205 addPhase("yellow");
206 } else if (function == "addGreenPhase") {
207 addPhase("green");
208 } else if (function == "addGreenPriorityPhase") {
209 addPhase("priorityGreen");
210 } else if (function == "tlsDeletePhase") {
211 addPhase("deletePhase");
212 } else if (function == "tlsMoveUp") {
213 addPhase("moveUp");
214 } else if (function == "tlsMoveDown") {
215 addPhase("moveDown");
216 } else if (function == "tlsCleanStates") {
217 pressTLSButton("cleanStates");
218 } else if (function == "tlsAddStates") {
219 pressTLSButton("addStates");
220 } else if (function == "tlsGroupSignal") {
221 pressTLSButton("groupSignal");
222 } else if (function == "tlsUngroupSignal") {
223 pressTLSButton("ungroupSignal");
224 } else if (function == "checkParameters") {
226 } else if (function == "checkParametersOverlapped") {
227 checkParameters(overlappedTabs);
228 } else if (function == "checkDoubleParameters") {
230 } else if (function == "checkDoubleParametersOverlapped") {
231 checkDoubleParameters(overlappedTabs);
232 } else if (function == "changeEditMode") {
234 } else if (function == "changeSupermode") {
236 } else if (function == "changeMode") {
237 changeMode();
238 } else if (function == "changeElement") {
240 } else if (function == "changePlan") {
241 changePlan();
242 } else if (function == "computeJunctions") {
244 } else if (function == "computeJunctionsVolatileOptions") {
246 } else if (function == "selectAdditionalChild") {
248 } else if (function == "createRectangledShape") {
250 } else if (function == "createSquaredShape") {
252 } else if (function == "createLineShape") {
254 } else if (function == "createMeanData") {
256 } else if (function == "deleteMeanData") {
258 } else if (function == "copyMeanData") {
259 copyMeanData();
260 } else if (function == "saveExistentShortcut") {
262 } else if (function == "checkUndoRedo") {
264 } else if (function == "delete") {
266 } else if (function == "selection") {
267 selection();
268 } else if (function == "selectNetworkItems") {
270 } else if (function == "lockSelection") {
272 } else if (function == "selectionRectangle") {
274 } else if (function == "createDataSet") {
276 } else if (function == "createDataInterval") {
278 } else if (function == "undo") {
279 undo();
280 } else if (function == "redo") {
281 redo();
282 } else if (function == "quit") {
283 quit();
284 } else if (function.size() > 0) {
285 std::cout << "Function " + function + " not implemented in InternalTestStep" << std::endl;
286 throw ProcessError();
287 }
288}
289
290
291InternalTestStep::InternalTestStep(InternalTest* testSystem, FXSelector messageType,
292 FXSelector messageID, Category category, const std::string description) :
293 myTestSystem(testSystem),
294 myMessageType(messageType),
295 myMessageID(messageID),
296 myCategory(category),
297 myDescription(description) {
298 // add this testStep to test system
299 testSystem->addTestSteps(this);
300}
301
302
303InternalTestStep::InternalTestStep(InternalTest* testSystem, FXSelector messageType,
304 Category category, FXEvent* event, const bool updateView,
305 const std::string description) :
306 myTestSystem(testSystem),
307 myMessageType(messageType),
308 myCategory(category),
309 myUpdateView(updateView),
310 myDescription(description),
311 myEvent(event) {
312 // add this testStep to test system
313 testSystem->addTestSteps(this);
314}
315
316
317InternalTestStep::InternalTestStep(InternalTestStep* parent, const std::string& solution,
318 const std::string description) :
319 myTestSystem(parent->myTestSystem),
320 myMessageID(MID_INTERNALTEST),
321 myDescription(description) {
322 // add this testStep to parent modal dialgo testSteps
323 parent->myDialogTestSteps.push_back(this);
324 // modal arguments
325 myDialogTest = new DialogTest(solution);
326}
327
328
329InternalTestStep::InternalTestStep(InternalTestStep* parent, FXSelector messageType, FXEvent* event,
330 const std::string description) :
331 myTestSystem(parent->myTestSystem),
332 myMessageType(messageType),
333 myDescription(description),
334 myEvent(event) {
335 // add this testStep to parent modal dialgo testSteps
336 parent->myDialogTestSteps.push_back(this);
337}
338
339
341 if (myEvent) {
342 delete myEvent;
343 }
344 if (myDialogTest) {
345 delete myDialogTest;
346 }
347 if (myTLSTableTest) {
348 delete myTLSTableTest;
349 }
350 // remove all key steps
351 for (auto modalDialogTestStep : myDialogTestSteps) {
352 delete modalDialogTestStep;
353 }
354 myDialogTestSteps.clear();
355}
356
357
358FXSelector
362
363
364FXSelector
368
369
374
375
380
381
382FXSelector
384 return FXSEL(myMessageType, myMessageID);
385}
386
387
388bool
392
393
396 return myCategory;
397}
398
399
400void*
402 return myEvent;
403}
404
405
406const std::vector<const InternalTestStep*>&
410
411
412const std::string&
416
417
418std::string
419InternalTestStep::parseStep(const std::string& rowText) {
420 // first check if this is the netedit.setupAndStart function
421 if (rowText.find("netedit.setupAndStart") != std::string::npos) {
422 return "setupAndStart";
423 } else if (rowText.compare(0, 8, "netedit.") != 0) {
424 // proces only lines that start with "netedit."
425 return "";
426 } else {
427 std::string functionName;
428 // make a copy to help editing row
429 std::string rowStr = rowText;
430 // every function has the format <function>(<argument1>, <argument2>,....,)
431 if (rowText.empty() || (rowText.front() == '(') || (rowText.back() != ')')) {
432 writeError("parseStep", 0, "function(arguments)");
433 return "";
434 }
435 // first extract function
436 while (rowStr.size() > 0) {
437 if (rowStr.front() == '(') {
438 break;
439 } else {
440 functionName.push_back(rowStr.front());
441 rowStr.erase(rowStr.begin());
442 }
443 }
444 // remove prefix "netedit." (size 8) from function
445 functionName = functionName.substr(8);
446 // check if there are at least two characters (to avoid cases like 'function)')
447 if (rowStr.size() < 2) {
448 writeError("parseStep", 0, "function(arguments)");
449 return functionName;
450 }
451 // remove both pharentesis
452 rowStr.erase(rowStr.begin());
453 rowStr.pop_back();
454 // now parse arguments
455 parseArguments(rowStr);
456 // remove "netedit." from frunction
457 return functionName;
458 }
459}
460
461
462void
463InternalTestStep::parseArguments(const std::string& arguments) {
464 std::string current;
465 bool inQuotes = false;
466 for (size_t i = 0; i < arguments.length(); ++i) {
467 char c = arguments[i];
468 if (c == '\"' || c == '\'') {
469 // Toggle quote state
470 inQuotes = !inQuotes;
471 current.push_back(c);
472 } else if (c == ',' && !inQuotes) {
473 // End of argument
474 if (!current.empty()) {
475 // Trim leading/trailing whitespace
476 size_t start = current.find_first_not_of(" \t");
477 size_t end = current.find_last_not_of(" \t");
478 myArguments.push_back(current.substr(start, end - start + 1));
479 current.clear();
480 }
481 } else {
482 current += c;
483 }
484 }
485 // Add the last argument
486 if (!current.empty()) {
487 size_t start = current.find_first_not_of(" \t");
488 size_t end = current.find_last_not_of(" \t");
489 myArguments.push_back(current.substr(start, end - start + 1));
490 }
491 // inQuotes MUST be false, in other case we have a case like < "argument1", argument2, "argument3 >
492 if (inQuotes) {
493 writeError("parseArguments", 0, "<\"argument\", \"argument\">");
494 myArguments.clear();
495 }
496}
497
498
499void
502 // print in console the following lines
503 std::cout << "TestFunctions: Netedit opened successfully" << std::endl;
504 std::cout << "Finding reference" << std::endl;
505 std::cout << "TestFunctions: 'reference.png' found. Position: " <<
506 toString(MOUSE_REFERENCE_X) << " - " <<
507 toString(MOUSE_REFERENCE_Y) << std::endl;
508 // set first mouse position
510}
511
512
513void
514InternalTestStep::mouseClick(const std::string& button, const std::string& modifier) const {
515 if ((myArguments.size() != 2) || (myTestSystem->getViewPositions().count(myArguments[1]) == 0)) {
516 writeError("leftClick", 0, "<reference, position>");
517 } else {
518 // parse view position
519 const auto& viewPosition = myTestSystem->getViewPositions().at(myArguments[1]);
520 // build mouse click
521 buildMouseClick(viewPosition, 0, 0, button, modifier);
522 // print info
523 writeClickInfo(viewPosition, 0, 0, modifier);
524 }
525}
526
527
528void
529InternalTestStep::leftClickOffset(const std::string& button) const {
530 if ((myArguments.size() != 4) || (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
532 writeError("leftClickOffset", 0, "<reference, position, int, int>");
533 } else {
534 // parse view position
535 const auto& viewPosition = myTestSystem->getViewPositions().at(myArguments[1]);
536 const int x = getIntArgument(myArguments[2]);
537 const int y = getIntArgument(myArguments[3]);
538 // build mouse click
539 buildMouseClick(viewPosition, x, y, button, "");
540 // print info
541 writeClickInfo(viewPosition, x, y, button);
542 }
543}
544
545
546void
548 if ((myArguments.size() != 3) || (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
549 (myTestSystem->getMovements().count(myArguments[2]) == 0)) {
550 writeError("moveElementHorizontal", 0, "<reference, position, radius>");
551 } else {
552 // get parameters
553 const auto& referencePosition = myTestSystem->getViewPositions().at("netedit.positions.reference");
554 const auto& position = myTestSystem->getViewPositions().at(myArguments[1]);
555 const auto& radius = myTestSystem->getMovements().at(myArguments[2]);
556 // click over reference
557 buildMouseClick(referencePosition, 0, 0, "left", "");
558 // drag and drop
559 buildMouseDragDrop(position, 0, 0, position, radius.getRight(), 0, "");
560 buildMouseDragDrop(position, radius.getRight(), 0, position, radius.getLeft(), 0, "");
561 // write info
562 writeClickInfo(position, 0, 0, "");
563 }
564}
565
566
567void
569 if ((myArguments.size() != 3) || (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
570 (myTestSystem->getMovements().count(myArguments[2]) == 0)) {
571 writeError("moveElementVertical", 0, "<reference, position, radius>");
572 } else {
573 // get parameters
574 const auto& referencePosition = myTestSystem->getViewPositions().at("netedit.positions.reference");
575 const auto& position = myTestSystem->getViewPositions().at(myArguments[1]);
576 const auto& radius = myTestSystem->getMovements().at(myArguments[2]);
577 // click over reference
578 buildMouseClick(referencePosition, 0, 0, "left", "");
579 // drag and drop
580 buildMouseDragDrop(position, 0, 0, position, 0, radius.getUp(), "");
581 buildMouseDragDrop(position, radius.getRight(), 0, position, 0, radius.getDown(), "");
582 // write info
583 writeClickInfo(position, 0, 0, "");
584 }
585}
586
587
588void
590 if ((myArguments.size() != 3) || (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
591 (myTestSystem->getMovements().count(myArguments[2]) == 0)) {
592 writeError("moveElement", 0, "<reference, position, radius>");
593 } else {
594 // get parameters
595 const auto& referencePosition = myTestSystem->getViewPositions().at("netedit.positions.reference");
596 const auto& position = myTestSystem->getViewPositions().at(myArguments[1]);
597 const auto& radius = myTestSystem->getMovements().at(myArguments[2]);
598 // click over reference
599 buildMouseClick(referencePosition, 0, 0, "left", "");
600 // drag and drop
601 buildMouseDragDrop(position, 0, 0, position, radius.getRight(), 0, "");
602 buildMouseDragDrop(position, radius.getRight(), 0, position, radius.getRight(), radius.getDown(), "");
603 // drag and drop
604 buildMouseDragDrop(position, radius.getRight(), radius.getDown(), position, radius.getLeft(), radius.getDown(), "");
605 buildMouseDragDrop(position, radius.getLeft(), radius.getDown(), position, radius.getLeft(), radius.getUp(), "");
606 }
607}
608
609
610void
612 if (myArguments.size() != 1) {
613 writeError("typeKey", 0, "<key>");
614 } else {
616 }
617}
618
619
620void
622 if ((myArguments.size() != 3) || (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
624 writeError("contextualMenuOperation", 0, "<reference, position, contextualMenuOperations>");
625 } else {
626 // parse arguments
627 const auto& viewPosition = myTestSystem->getViewPositions().at(myArguments[1]);
628 const auto& contextualMenu = myTestSystem->getContextualMenuOperations().at(myArguments[2]);
629 // build mouse click
630 buildMouseClick(viewPosition, 0, 0, "right", "");
631 // jump to the element
632 for (int i = 0; i < contextualMenu.getMainMenuPosition(); i++) {
633 buildPressKeyEvent("down", false);
634 }
635 // type space for select
636 buildPressKeyEvent("space", false);
637 // jump to the subMenuA
638 if (contextualMenu.getSubMenuAPosition() > 0) {
639 for (int i = 0; i < contextualMenu.getSubMenuAPosition(); i++) {
640 buildPressKeyEvent("down", false);
641 }
642 // type space for select
643 buildPressKeyEvent("space", false);
644 }
645 // jump to the subMenuB
646 if (contextualMenu.getSubMenuBPosition() > 0) {
647 for (int i = 0; i < contextualMenu.getSubMenuBPosition(); i++) {
648 buildPressKeyEvent("down", false);
649 }
650 // type space for select
651 buildPressKeyEvent("space", false);
652 }
653 }
654}
655
656
657void
659 if (myArguments.size() != 0) {
660 writeError("protectElements", 0, "<>");
661 } else {
662 // go to delete mode
664 // focus frame
666 // jump to the element
667 for (int i = 0; i < myTestSystem->getAttributesEnum().at("netedit.attrs.frames.delete.protectElements"); i++) {
668 buildPressKeyEvent("tab", false);
669 }
670 // press enter to confirm changes (updating view)
671 buildPressKeyEvent("space", true);
672 }
673}
674
675
676void
678 if (myArguments.size() != 0) {
679 writeError("waitDeleteWarning", 0, "<>");
680 } else {
681 // nothing to do (wait for delete warning doesnt' appear in internal test)
682 }
683}
684
685
686void
687InternalTestStep::modifyAttribute(const int overlappedTabs) const {
688 if ((myArguments.size() != 2) || !checkIntArgument(myArguments[0]) ||
690 writeError("modifyAttribute", overlappedTabs, "<int/attributeEnum, \"string\">");
691 } else {
692 // modify attribute
694 }
695}
696
697
698void
699InternalTestStep::modifyBoolAttribute(const int overlappedTabs) const {
700 if ((myArguments.size() != 1) || !checkIntArgument(myArguments[0])) {
701 writeError("modifyBoolAttribute", overlappedTabs, "<int/attributeEnum>");
702 } else {
703 // modify bool attribute
705 }
706}
707
708
709void
710InternalTestStep::modifyColorAttribute(const int overlappedTabs) const {
711 if ((myArguments.size() != 1) || !checkIntArgument(myArguments[0])) {
712 writeError("modifyColorAttribute", overlappedTabs, "<int/attributeEnum>");
713 } else {
714 // open dialog
716 // get last event (openDialogEvent)
717 auto openDialogEvent = myTestSystem->getLastTestStep();
718 // go to the list of colors
719 for (int i = 0; i < 2; i++) {
720 buildTwoPressKeyEvent(openDialogEvent, "shift", "tab");
721 }
722 // select color
723 for (int i = 0; i < 6; i++) {
724 buildPressKeyEvent(openDialogEvent, "down");
725 }
726 // go to button
727 buildPressKeyEvent(openDialogEvent, "tab");
728 // press button
729 buildPressKeyEvent(openDialogEvent, "space");
730 }
731}
732
733
734void
736 if ((myArguments.size() != 2) || !checkIntArgument(myArguments[0]) ||
738 writeError("modifyVClassDialog_NoDisallowAll", overlappedTabs, "<int/attributeEnum, int/attributeEnum>");
739 } else {
740 // open dialog
742 // get last event (openDialogEvent)
743 auto openDialogEvent = myTestSystem->getLastTestStep();
744 // get vClass
745 const int vClass = getIntArgument(myArguments[1]);
746 // jump to vClass
747 for (int i = 0; i < vClass; i++) {
748 buildPressKeyEvent(openDialogEvent, "tab");
749 }
750 // select vclass
751 buildPressKeyEvent(openDialogEvent, "space");
752 // go to accept button
753 for (int i = 0; i < (myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.accept") - vClass); i++) {
754 buildPressKeyEvent(openDialogEvent, "tab");
755 }
756 // press accept
757 buildPressKeyEvent(openDialogEvent, "space");
758 }
759}
760
761
762void
764 if ((myArguments.size() != 2) || !checkIntArgument(myArguments[0]) ||
766 writeError("modifyVClassDialog_DisallowAll", overlappedTabs, "<int/attributeEnum, int/attributeEnum>");
767 } else {
768 // open dialog
770 // get last event (openDialogEvent)
771 auto openDialogEvent = myTestSystem->getLastTestStep();
772 // get vClass
773 const int vClass = getIntArgument(myArguments[1]);
774 // go to disallow all vehicles
775 for (int i = 0; i < myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.disallowAll"); i++) {
776 buildPressKeyEvent(openDialogEvent, "tab");
777 }
778 // disallow all vehicles
779 buildPressKeyEvent(openDialogEvent, "space");
780 // go to vClass
781 for (int i = 0; i < (vClass - myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.disallowAll")); i++) {
782 buildPressKeyEvent(openDialogEvent, "tab");
783 }
784 // select vClass
785 buildPressKeyEvent(openDialogEvent, "space");
786 // go to accept button
787 for (int i = 0; i < (myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.accept") - vClass); i++) {
788 buildPressKeyEvent(openDialogEvent, "tab");
789 }
790 // press accept
791 buildPressKeyEvent(openDialogEvent, "space");
792 }
793}
794
795
796void
797InternalTestStep::modifyVClassDialog_Cancel(const int overlappedTabs) const {
798 if ((myArguments.size() != 2) ||
801 writeError("modifyVClassDialog_Cancel", overlappedTabs, "<int/attributeEnum, int/attributeEnum>");
802 } else {
803 // open dialog
805 // get last event (openDialogEvent)
806 auto openDialogEvent = myTestSystem->getLastTestStep();
807 // get vClass
808 const int vClass = getIntArgument(myArguments[1]);
809 // go to disallow all vehicles
810 for (int i = 0; i < myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.disallowAll"); i++) {
811 buildPressKeyEvent(openDialogEvent, "tab");
812 }
813 // disallow all vehicles
814 buildPressKeyEvent(openDialogEvent, "space");
815 // go to vClass
816 for (int i = 0; i < (vClass - myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.disallowAll")); i++) {
817 buildPressKeyEvent(openDialogEvent, "tab");
818 }
819 // select vClass
820 buildPressKeyEvent(openDialogEvent, "space");
821 // go to cancel button
822 for (int i = 0; i < (myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.cancel") - vClass); i++) {
823 buildPressKeyEvent(openDialogEvent, "tab");
824 }
825 // press cancel
826 buildPressKeyEvent(openDialogEvent, "space");
827 }
828}
829
830
831void
832InternalTestStep::modifyVClassDialog_Reset(const int overlappedTabs) const {
833 if ((myArguments.size() != 2) || !checkIntArgument(myArguments[0]) ||
835 writeError("modifyVClassDialog_Reset", overlappedTabs, "<int/attributeEnum, int/attributeEnum>");
836 } else {
837 // open dialog
839 // get last event (openDialogEvent)
840 auto openDialogEvent = myTestSystem->getLastTestStep();
841 // get vClass
842 const int vClass = getIntArgument(myArguments[1]);
843 // go to disallow all vehicles
844 for (int i = 0; i < myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.disallowAll"); i++) {
845 buildPressKeyEvent(openDialogEvent, "tab");
846 }
847 // disallow all vehicles
848 buildPressKeyEvent(openDialogEvent, "space");
849 // go to vClass
850 for (int i = 0; i < (vClass - myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.disallowAll")); i++) {
851 buildPressKeyEvent(openDialogEvent, "tab");
852 }
853 // select vClass
854 buildPressKeyEvent(openDialogEvent, "space");
855 // go to reset button
856 for (int i = 0; i < (myTestSystem->getAttributesEnum().at("netedit.attrs.dialog.allowVClass.reset") - vClass); i++) {
857 buildPressKeyEvent(openDialogEvent, "tab");
858 }
859 // press reset
860 buildPressKeyEvent(openDialogEvent, "space");
861 // go to accept button
862 for (int i = 0; i < 2; i++) {
863 buildTwoPressKeyEvent(openDialogEvent, "shift", "tab");
864 }
865 // press accept
866 buildPressKeyEvent(openDialogEvent, "space");
867 }
868}
869
870
871void
873 if ((myArguments.size() != 3) || !checkStringArgument(myArguments[0]) ||
875 writeError("modifyVTypeDialogAttribute", 0, "<str, int/attributeEnum, str>");
876 } else {
877 // get arguments
878 const auto operation = getStringArgument(myArguments[0]);
879 const auto tabs = getIntArgument(myArguments[1]);
880 const auto value = getStringArgument(myArguments[2]);
881 // first check if open dialog
882 if (operation == "open") {
883 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.type.buttons.dialog"), 0);
884 }
885 // obtain last step
887 // print info
888 std::cout << value << std::endl;
889 // focus dialog
890 buildTwoPressKeyEvent(parentStep, "alt", "f");
891 // jump to the element
892 for (int i = 0; i < tabs; i++) {
893 buildPressKeyEvent(parentStep, "tab");
894 }
895 // write attribute character by character
896 if (value.empty()) {
897 buildPressKeyEvent(parentStep, "delete");
898 } else {
899 for (const char c : value) {
900 buildPressKeyEvent(parentStep, {c});
901 }
902 }
903 // press enter to confirm changes (updating view)
904 buildPressKeyEvent(parentStep, "enter");
905 // finally check if close dialog
906 if (operation == "close") {
907 buildTwoPressKeyEvent(parentStep, "alt", "a");
908 buildPressKeyEvent(parentStep, "enter");
909 }
910 }
911}
912
913
914void
915InternalTestStep::createConnection(const std::string& keyModifier) const {
916 if ((myArguments.size() != 3) ||
917 (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
918 (myTestSystem->getViewPositions().count(myArguments[2]) == 0)) {
919 writeError("createConnection", 0, "<reference, position, position>");
920 } else {
921 // parse view position
922 const auto& fromLane = myTestSystem->getViewPositions().at(myArguments[1]);
923 const auto& toLane = myTestSystem->getViewPositions().at(myArguments[2]);
924 // build mouse click from
925 buildMouseClick(fromLane, 0, 0, "left", keyModifier);
926 writeClickInfo(fromLane, 0, 0, "");
927 // build mouse click from
928 buildMouseClick(toLane, 0, 0, "left", keyModifier);
929 writeClickInfo(toLane, 0, 0, "");
930 }
931}
932
933
934void
936 if ((myArguments.size() != 1) || !checkBoolArgument(myArguments[0])) {
937 writeError("createCrossing", 0, "<bool>");
938 } else {
940 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.crossing.createTLS.button"), 0);
941 } else {
942 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.crossing.create.button"), 0);
943 }
944 }
945}
946
947
948void
950 if ((myArguments.size() != 2) || !checkIntArgument(myArguments[0]) || !checkStringArgument(myArguments[1])) {
951 writeError("modifyCrossingDefaultValue", 0, "<int, value>");
952 } else {
953 const int tabs = getIntArgument(myArguments[0]);
954 const auto value = getStringArgument(myArguments[1]);
955 modifyStringAttribute(tabs, myTestSystem->getAttributesEnum().at("netedit.attrs.crossing.firstField"), value);
956 }
957}
958
959
960void
962 if ((myArguments.size() != 1) || !checkIntArgument(myArguments[0])) {
963 writeError("modifyCrossingDefaultBoolValue", 0, "<int>");
964 } else {
965 const int tabs = getIntArgument(myArguments[0]);
966 modifyBoolAttribute(tabs, myTestSystem->getAttributesEnum().at("netedit.attrs.crossing.firstField"));
967 }
968}
969
970
971void
973 if (myArguments.size() != 0) {
974 writeError("crossingClearEdges", 0, "<>");
975 } else {
976 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.crossing.clearEdges"), 0);
977 }
978}
979
980
981void
983 if (myArguments.size() != 0) {
984 writeError("crossingInvertEdges", 0, "<>");
985 } else {
986 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.crossing.invertEdges"), 0);
987 }
988}
989
990
991void
993 if (myArguments.size() != 0) {
994 writeError("saveConnectionEdit", 0, "<>");
995 } else {
996 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.connection.saveConnections"), 0);
997 }
998}
999
1000
1001void
1003 if ((myArguments.size() != 1) || !checkStringArgument(myArguments[0])) {
1004 writeError("fixCrossings", 0, "<str>");
1005 } else {
1006 // save config
1008 Category::APP, "save netedit config");
1009 // create fix dialog test
1010 new InternalTestStep(saveConfig, getStringArgument(myArguments[0]), "fix crossing in dialog");
1011 }
1012}
1013
1014
1015void
1017 if ((myArguments.size() != 1) || !checkStringArgument(myArguments[0])) {
1018 writeError("fixStoppingPlace", 0, "<str>");
1019 } else {
1020 // save config
1022 Category::APP, "save netedit config");
1023 // create fix dialog test
1024 new InternalTestStep(saveConfig, getStringArgument(myArguments[0]), "fix stoppingPlace in dialog");
1025 }
1026}
1027
1028
1029void
1031 if ((myArguments.size() != 1) || !checkStringArgument(myArguments[0])) {
1032 writeError("fixRoute", 0, "<str>");
1033 } else {
1034 // save config
1036 Category::APP, "save netedit config");
1037 // create fix dialog test
1038 new InternalTestStep(saveConfig, getStringArgument(myArguments[0]), "fix route in dialog");
1039 }
1040}
1041
1042
1043void
1044InternalTestStep::createTLS(const int overlappedTabs) const {
1045 if (myArguments.size() != 0) {
1046 writeError("createTLS", overlappedTabs, "<>");
1047 } else {
1048 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.create"), overlappedTabs);
1049 }
1050}
1051
1052
1053void
1055 if ((myArguments.size() != 1) || !checkBoolArgument(myArguments[0])) {
1056 writeError("copyTLS", 0, "<bool>");
1057 } else {
1058 if (getBoolArgument(myArguments[0])) {
1059 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.copyJoined"), 0);
1060 } else {
1061 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.copySingle"), 0);
1062 }
1063 }
1064}
1065
1066
1067void
1069 if (myArguments.size() != 0) {
1070 writeError("joinTSL", 0, "<>");
1071 } else {
1072 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.joinTLS"), 0);
1073 }
1074}
1075
1076
1077void
1079 if (myArguments.size() != 0) {
1080 writeError("disJoinTLS", 0, "<>");
1081 } else {
1082 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.disjoinTLS"), 0);
1083 }
1084}
1085
1086
1087void
1089 if ((myArguments.size() != 1) || !checkBoolArgument(myArguments[0])) {
1090 writeError("deleteTLS", 0, "<bool>");
1091 } else {
1092 if (getBoolArgument(myArguments[0])) {
1093 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.deleteJoined"), 0);
1094 } else {
1095 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.deleteSingle"), 0);
1096 }
1097 }
1098}
1099
1100
1101void
1103 if ((myArguments.size() != 3) || !checkIntArgument(myArguments[0]) ||
1105 writeError("modifyTLSTable", 0, "<row, int/attributeEnum, \"string\">");
1106 } else {
1108 // get row
1109 const int row = getIntArgument(myArguments[0]);
1110 const int column = getIntArgument(myArguments[1]);
1111 const std::string text = getStringArgument(myArguments[2]);
1112 // modify attribute
1113 myTLSTableTest = new TLSTableTest(MID_GNE_TLSTABLE_TEXTFIELD, row, column, text);
1114 // show text
1115 std::cout << text << std::endl;
1116 }
1117}
1118
1119
1120void
1122 if ((myArguments.size() != 1) || !checkBoolArgument(myArguments[0])) {
1123 writeError("resetSingleTLSPhases", 0, "<bool>");
1124 } else {
1125 if (getBoolArgument(myArguments[0])) {
1126 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.resetPhaseSingle"));
1127 } else {
1128 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.resetPhaseJoined"));
1129 }
1130 }
1131}
1132
1133
1134void
1136 if ((myArguments.size() != 1) || !checkBoolArgument(myArguments[0])) {
1137 writeError("resetAllTLSPhases", 0, "<bool>");
1138 } else {
1139 if (getBoolArgument(myArguments[0])) {
1140 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.resetAllJoined"));
1141 } else {
1142 modifyBoolAttribute(myTestSystem->getAttributesEnum().at("netedit.attrs.TLS.resetAllSingle"));
1143 }
1144 }
1145}
1146
1147
1148void
1150 if ((myArguments.size() != 1) || !checkIntArgument(myArguments[0])) {
1151 writeError("pressTLSPhaseButton", 0, "<int/attributeEnum>");
1152 } else {
1154 }
1155}
1156
1157
1158void
1159InternalTestStep::addPhase(const std::string& type) {
1160 if ((myArguments.size() != 1) || !checkIntArgument(myArguments[0])) {
1161 writeError("addPhase" + type, 0, "<int/attributeEnum>");
1162 } else {
1164 // get row
1165 const int row = getIntArgument(myArguments[0]);
1166 // continue depending of the type of phase
1167 if (type == "default") {
1169 } else if (type == "duplicate") {
1171 } else if (type == "red") {
1173 } else if (type == "yellow") {
1175 } else if (type == "green") {
1177 } else if (type == "priorityGreen") {
1179 } else if (type == "deletePhase") {
1181 } else if (type == "moveUp") {
1183 } else if (type == "moveDown") {
1185 }
1186 }
1187}
1188
1189
1190void
1191InternalTestStep::pressTLSButton(const std::string& type) {
1192 if (myArguments.size() != 0) {
1193 writeError("pressTLSButton" + type, 0, "<>");
1194 } else {
1196 // continue depending of the type of phase
1197 if (type == "cleanStates") {
1199 } else if (type == "addStates") {
1201 } else if (type == "groupSignal") {
1203 } else if (type == "ungroupSignal") {
1205 }
1206 }
1207}
1208
1209
1210void
1211InternalTestStep::checkParameters(const int overlappedTabs) const {
1212 if ((myArguments.size() != 2) || !checkIntArgument(myArguments[1])) {
1213 writeError("checkParameters", overlappedTabs, "<int/attributeEnum>");
1214 } else {
1215 const int tabs = getIntArgument(myArguments[1]);
1216 // check different values
1217 modifyStringAttribute(tabs, overlappedTabs, "dummyGenericParameters");
1218 modifyStringAttribute(tabs, overlappedTabs, "key1|key2|key3");
1219 modifyStringAttribute(tabs, overlappedTabs, "key1=value1|key2=value2|key3=value3");
1220 modifyStringAttribute(tabs, overlappedTabs, "key1=|key2=|key3=");
1221 modifyStringAttribute(tabs, overlappedTabs, "");
1222 modifyStringAttribute(tabs, overlappedTabs, "key1duplicated=value1|key1duplicated=value2|key3=value3");
1223 modifyStringAttribute(tabs, overlappedTabs, "key1=valueDuplicated|key2=valueDuplicated|key3=valueDuplicated");
1224 modifyStringAttribute(tabs, overlappedTabs, "keyInvalid.;%>%$$=value1|key2=value2|key3=value3");
1225 modifyStringAttribute(tabs, overlappedTabs, "key1=valueInvalid%;%$<>$$%|key2=value2|key3=value3");
1226 modifyStringAttribute(tabs, overlappedTabs, "keyFinal1=value1|keyFinal2=value2|keyFinal3=value3");
1227 // check undo-redo
1228 buildUndo(9);
1229 buildRedo(9);
1230 }
1231}
1232
1233
1234void
1235InternalTestStep::checkDoubleParameters(const int overlappedTabs) const {
1236 if ((myArguments.size() != 2) || !checkIntArgument(myArguments[1])) {
1237 writeError("checkDoubleParameters", overlappedTabs, "<int/attributeEnum>");
1238 } else {
1239 const int tabs = getIntArgument(myArguments[1]);
1240 // check different values
1241 modifyStringAttribute(tabs, overlappedTabs, "dummyGenericParameters");
1242 modifyStringAttribute(tabs, overlappedTabs, "key1|key2|key3");
1243 modifyStringAttribute(tabs, overlappedTabs, "key1=1|key2=2|key3=3");
1244 modifyStringAttribute(tabs, overlappedTabs, "key1=|key2=|key3=");
1245 modifyStringAttribute(tabs, overlappedTabs, "");
1246 modifyStringAttribute(tabs, overlappedTabs, "key1duplicated=1|key1duplicated=2|key3=3");
1247 modifyStringAttribute(tabs, overlappedTabs, "key1=Duplicated|key2=Duplicated|key3=Duplicated");
1248 modifyStringAttribute(tabs, overlappedTabs, "keyInvalid.;%>%$$=1|key2=2|key3=3");
1249 modifyStringAttribute(tabs, overlappedTabs, "key1=Invalid%;%$<>$$%|key2=2|key3=3");
1250 modifyStringAttribute(tabs, overlappedTabs, "keyFinal1=1|keyFinal2=2|keyFinal3=3");
1251 // check undo-redo
1252 buildUndo(9);
1253 buildRedo(9);
1254 }
1255}
1256
1257
1258void
1260 if ((myArguments.size() != 1) || (myTestSystem->getAttributesEnum().count(myArguments[0]) == 0)) {
1261 writeError("changeEditMode", 0, "<int/attributeEnum>");
1262 } else {
1264 // network
1265 if (myArguments[0] == "netedit.attrs.modes.network.grid") {
1267 } else if (myArguments[0] == "netedit.attrs.modes.network.junctionShape") {
1269 } else if (myArguments[0] == "netedit.attrs.modes.network.spreadVehicle") {
1271 } else if (myArguments[0] == "netedit.attrs.modes.network.showDemandElements") {
1273 } else if (myArguments[0] == "netedit.attrs.modes.network.selectLane") {
1275 } else if (myArguments[0] == "netedit.attrs.modes.network.showConnections") {
1277 } else if (myArguments[0] == "netedit.attrs.modes.network.hideConnetions") {
1279 } else if (myArguments[0] == "netedit.attrs.modes.network.showSubAdditionals") {
1281 } else if (myArguments[0] == "netedit.attrs.modes.network.showTAZElements") {
1283 } else if (myArguments[0] == "netedit.attrs.modes.network.automaticSelectJunctions") {
1285 } else if (myArguments[0] == "netedit.attrs.modes.network.applyAllPhases") {
1287 } else if (myArguments[0] == "netedit.attrs.modes.network.mergingJunction") {
1289 } else if (myArguments[0] == "netedit.attrs.modes.network.showBubbles") {
1291 } else if (myArguments[0] == "netedit.attrs.modes.network.moveElevation") {
1293 } else if (myArguments[0] == "netedit.attrs.modes.network.chainMode") {
1295 } else if (myArguments[0] == "netedit.attrs.modes.network.twoWayMode") {
1297 // demand
1298 } else if (myArguments[0] == "netedit.attrs.modes.demand.grid") {
1300 } else if (myArguments[0] == "netedit.attrs.modes.demand.junctionShape") {
1302 } else if (myArguments[0] == "netedit.attrs.modes.demand.spreadVehicle") {
1304 } else if (myArguments[0] == "netedit.attrs.modes.demand.showNonInspected") {
1306 } else if (myArguments[0] == "netedit.attrs.modes.demand.showShapes") {
1308 } else if (myArguments[0] == "netedit.attrs.modes.demand.showAllTrips") {
1310 } else if (myArguments[0] == "netedit.attrs.modes.demand.showPersonPlans") {
1312 } else if (myArguments[0] == "netedit.attrs.modes.demand.lockPerson") {
1314 } else if (myArguments[0] == "netedit.attrs.modes.demand.showContainerPlans") {
1316 } else if (myArguments[0] == "netedit.attrs.modes.demand.lockContainer") {
1318 } else if (myArguments[0] == "netedit.attrs.modes.demand.showOverlappedRoutes") {
1320 // data
1321 } else if (myArguments[0] == "netedit.attrs.modes.data.junctionShape") {
1323 } else if (myArguments[0] == "netedit.attrs.modes.data.showAdditionals") {
1325 } else if (myArguments[0] == "netedit.attrs.modes.data.showShapes") {
1327 } else if (myArguments[0] == "netedit.attrs.modes.data.showDemandElements") {
1329 } else if (myArguments[0] == "netedit.attrs.modes.data.TAZRelDrawingMode") {
1331 } else if (myArguments[0] == "netedit.attrs.modes.data.TAZFill") {
1333 } else if (myArguments[0] == "netedit.attrs.modes.data.TAZRelOnlyFrom") {
1335 } else if (myArguments[0] == "netedit.attrs.modes.data.TAZRelOnlyTo") {
1337 } else {
1338 writeError("changeEditMode", 0, "<enum>");
1339 }
1340 }
1341}
1342
1343
1344void
1346 if ((myArguments.size() != 1) ||
1348 writeError("save", 0, "<\"string\">");
1349 } else {
1351 const auto savingType = getStringArgument(myArguments[0]);
1352 if (savingType == "network") {
1354 } else if (savingType == "additionals") {
1356 } else if (savingType == "demands") {
1358 } else if (savingType == "datas") {
1360 } else if (savingType == "meanDatas") {
1362 } else if (savingType == "sumoConfig") {
1364 } else if (savingType == "neteditConfig") {
1366 } else {
1367 writeError("save", 0, "<neteditConfig>");
1368 }
1369 }
1370}
1371
1372
1373void
1375 if (myArguments.size() != 1) {
1376 writeError("checkUndoRedo", 0, "<referencePosition>");
1377 } else {
1378 const int numUndoRedos = 9;
1379 buildUndo(numUndoRedos);
1380 buildRedo(numUndoRedos);
1381 }
1382}
1383
1384
1385void
1387 if (myArguments.size() != 0) {
1388 writeError("delete", 0, "<>");
1389 } else {
1390 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_HOTKEY_DEL, Category::APP, "delete element");
1391 }
1392}
1393
1394
1395void
1397 if (myArguments.size() != 1 || !checkStringArgument(myArguments[0])) {
1398 writeError("selection", 0, "<selection operation>");
1399 } else {
1400 const std::string selectionType = getStringArgument(myArguments[0]);
1401 // get number of tabls
1402 int numTabs = 0;
1403 if (selectionType == "default") {
1404 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.default");
1405 } else if (selectionType == "save") {
1406 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.save");
1407 } else if (selectionType == "load") {
1408 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.load");
1409 } else if (selectionType == "add") {
1410 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.add");
1411 } else if (selectionType == "remove") {
1412 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.remove");
1413 } else if (selectionType == "keep") {
1414 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.keep");
1415 } else if (selectionType == "replace") {
1416 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.replace");
1417 } else if (selectionType == "clear") {
1418 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.clear");
1419 } else if (selectionType == "invert") {
1420 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.invert");
1421 } else if (selectionType == "invertData") {
1422 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.invertData");
1423 } else if (selectionType == "delete") {
1424 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.basic.delete");
1425 }
1426 // focus frame
1427 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_HOTKEY_SHIFT_F12_FOCUSUPPERELEMENT, Category::APP, "focus selection frame");
1428 // jump to the element
1429 for (int i = 0; i < numTabs; i++) {
1430 buildPressKeyEvent("tab", false);
1431 }
1432 if (selectionType == "save") {
1433 buildPressKeyEvent("enter", false);
1434 // complete
1435 } else if (selectionType == "load") {
1436 buildPressKeyEvent("enter", false);
1437 // complete
1438 } else {
1439 buildPressKeyEvent("space", true);
1440 }
1441 }
1442}
1443
1444
1445void
1447 if (myArguments.size() != 3 || !checkStringArgument(myArguments[0]) ||
1449 writeError("selectNetworkItems", 0, "<element/int, \"attribute\", \"value\">");
1450 } else {
1451 const std::string element = getStringArgument(myArguments[0]);
1452 const std::string attribute = getStringArgument(myArguments[1]);
1453 const std::string value = getStringArgument(myArguments[2]);
1454 // focus frame
1455 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_HOTKEY_SHIFT_F12_FOCUSUPPERELEMENT, Category::APP, "focus selelection frame");
1456 // got to type
1457 for (int i = 0; i < myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.networkItem.type"); i++) {
1458 buildPressKeyEvent("tab", false);
1459 }
1460 // set network element
1461 for (const char c : "Network elements") {
1462 buildPressKeyEvent({c}, false);
1463 }
1464 // show info
1465 std::cout << "Network elements" << std::endl;
1466 // got to type
1467 for (int i = 0; i < myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.networkItem.subType"); i++) {
1468 buildPressKeyEvent("tab", false);
1469 }
1470 // set network element
1471 for (const char c : element) {
1472 buildPressKeyEvent({c}, false);
1473 }
1474 // show info
1475 std::cout << element << std::endl;
1476 // got to attribute
1477 for (int i = 0; i < myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.networkItem.attribute"); i++) {
1478 buildPressKeyEvent("tab", false);
1479 }
1480 // set attribute
1481 for (const char c : attribute) {
1482 buildPressKeyEvent({c}, false);
1483 }
1484 // show info
1485 std::cout << attribute << std::endl;
1486 // got to value
1487 for (int i = 0; i < myTestSystem->getAttributesEnum().at("netedit.attrs.frames.selection.networkItem.value"); i++) {
1488 buildPressKeyEvent("tab", false);
1489 }
1490 // set value
1491 for (const char c : value) {
1492 buildPressKeyEvent({c}, false);
1493 }
1494 // show info
1495 std::cout << value << std::endl;
1496 // press enter to confirm changes (updating view)
1497 buildPressKeyEvent("enter", true);
1498 }
1499}
1500
1501
1502void
1504 if (myArguments.size() != 1 || !checkIntArgument(myArguments[0])) {
1505 writeError("lockSelection", 0, "<element/int, \"attribute\", \"value\">");
1506 } else {
1507 // get argument
1508 const auto lockType = getIntArgument(myArguments[0]);
1509 // continue depending of lock type
1510 if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.junctions")) {
1511 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_JUNCTION, Category::APP, "lock junctions");
1512 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.edges")) {
1513 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_EDGE, Category::APP, "lock edges");
1514 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.lanes")) {
1515 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_LANE, Category::APP, "lock lanes");
1516 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.connections")) {
1517 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_CONNECTION, Category::APP, "lock connections");
1518 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.crossings")) {
1519 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_CROSSING, Category::APP, "lock crossings");
1520 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.walkingAreas")) {
1521 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_WALKINGAREA, Category::APP, "lock walking areas");
1522 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.additionals")) {
1523 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_ADDITIONALELEMENT, Category::APP, "lock additionals");
1524 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.tazs")) {
1525 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_TAZ, Category::APP, "lock TAZs");
1526 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.wires")) {
1527 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_WIRE, Category::APP, "lock wires");
1528 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.polygons")) {
1529 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_POLYGON, Category::APP, "lock polygons");
1530 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.pois")) {
1531 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_POI, Category::APP, "lock POIs");
1532 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.walkableAreas")) {
1533 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_JPS_WALKABLEAREA, Category::APP, "lock walkableAreas");
1534 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.obstacles")) {
1535 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_JPS_OBSTACLE, Category::APP, "lock obstacles");
1536 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.selected")) {
1537 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_SELECTEDELEMENTS, Category::APP, "lock selected elements");
1538 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.lockAll")) {
1539 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_LOCK_ALLELEMENTS, Category::APP, "lock all elements");
1540 } else if (lockType == myTestSystem->getAttributesEnum().at("netedit.attrs.selection.lockSelectionNetwork.unlockAll")) {
1541 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_GNE_UNLOCK_ALLELEMENTS, Category::APP, "unlock all elements");
1542 }
1543 }
1544}
1545
1546
1547void
1549 if (myArguments.size() != 3 || (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
1550 (myTestSystem->getViewPositions().count(myArguments[2]) == 0)) {
1551 writeError("selectionRectangle", 0, "<viewPosition, viewPosition>");
1552 } else {
1553 // get position
1554 const auto& from = myTestSystem->getViewPositions().at(myArguments[1]);
1555 const auto& to = myTestSystem->getViewPositions().at(myArguments[2]);
1556 // go to selection mode
1558 // drag and drop
1559 buildMouseDragDrop(from, 0, 0, to, 0, 0, "shift");
1560 }
1561}
1562
1563
1564void
1566 if ((myArguments.size() != 1) || !checkStringArgument(myArguments[0])) {
1567 writeError("createDataSet", 0, "<dataSetId>");
1568 } else {
1569 // get dataSetId
1570 const auto& dataSetId = getStringArgument(myArguments[0]);
1571 // show info
1572 std::cout << dataSetId << std::endl;
1573 // focus frame
1575 // jump to select additional argument
1576 for (int i = 0; i < 2; i++) {
1577 buildPressKeyEvent("tab", false);
1578 }
1579 // create new dataSet
1580 buildPressKeyEvent("space", true);
1581 // write additional character by character
1582 for (const char c : dataSetId) {
1583 buildPressKeyEvent({c}, false);
1584 }
1585 // go to create new dataSet
1586 buildPressKeyEvent("tab", false);
1587 // press enter to confirm changes (updating view)
1588 buildPressKeyEvent("space", true);
1589 }
1590}
1591
1592
1593void
1596 writeError("createDataInterval", 0, "<begin, end>");
1597 } else {
1598 // get begin and end
1599 const auto& begin = getStringArgument(myArguments[0]);
1600 const auto& end = getStringArgument(myArguments[1]);
1601 // show info
1602 std::cout << begin << std::endl;
1603 std::cout << end << std::endl;
1604 // focus frame
1606 // jump to create interval
1607 for (int i = 0; i < 6; i++) {
1608 buildPressKeyEvent("tab", false);
1609 }
1610 // create new interval
1611 buildPressKeyEvent("space", true);
1612 // go to begin
1613 buildPressKeyEvent("tab", false);
1614 // write begin character by character
1615 for (const char c : begin) {
1616 buildPressKeyEvent({c}, false);
1617 }
1618 // go to begin
1619 buildPressKeyEvent("tab", false);
1620 // write end character by character
1621 for (const char c : end) {
1622 buildPressKeyEvent({c}, false);
1623 }
1624 // go to create button
1625 buildPressKeyEvent("tab", false);
1626 // press button
1627 buildPressKeyEvent("space", true);
1628 }
1629}
1630
1631
1632void
1634 if ((myArguments.size() != 2) || !checkIntArgument(myArguments[1])) {
1635 writeError("undo", 0, "<referencePosition, int>");
1636 } else {
1637 // do undo
1639 }
1640}
1641
1642
1643void
1645 if ((myArguments.size() != 2) || !checkIntArgument(myArguments[1])) {
1646 writeError("redo", 0, "<referencePosition, int>");
1647 } else {
1648 // do redo
1650 }
1651}
1652
1653
1654void
1656 if ((myArguments.size() != 1) ||
1658 writeError("supermode", 0, "<\"string\">");
1659 } else {
1661 const std::string supermode = getStringArgument(myArguments[0]);
1662 if (supermode == "network") {
1664 } else if (supermode == "demand") {
1666 } else if (supermode == "data") {
1668 } else {
1669 writeError("supermode", 0, "<network/demand/data>");
1670 }
1671 }
1672}
1673
1674
1675void
1677 if ((myArguments.size() != 1) ||
1679 writeError("changeMode", 0, "<\"string\">");
1680 } else {
1681 // set category and enable upate view
1683 myUpdateView = true;
1684 // get mode
1685 const std::string mode = getStringArgument(myArguments[0]);
1686 // set description
1687 myDescription = "Change mode to '" + mode + "'";
1688 // continue depending of mode
1689 if (mode == "inspect") {
1691 } else if (mode == "delete") {
1693 } else if (mode == "select") {
1695 } else if (mode == "move") {
1697 } else if ((mode == "createEdge") || (mode == "edgeData")) {
1699 } else if ((mode == "trafficLight") || (mode == "type") || (mode == "TLS")) {
1701 } else if ((mode == "connection") || (mode == "container")) {
1703 } else if ((mode == "prohibition") || (mode == "containerPlan")) {
1705 } else if ((mode == "crossing") || (mode == "route") || (mode == "edgeRelData")) {
1707 } else if ((mode == "additional") || (mode == "stop")) {
1709 } else if ((mode == "wire") || (mode == "routeDistribution")) {
1711 } else if ((mode == "taz") || (mode == "TAZ") || (mode == "TAZRelData")) {
1713 } else if ((mode == "shape") || (mode == "person")) {
1715 } else if ((mode == "decal") || (mode == "typeDistribution")) {
1717 } else if (mode == "personPlan") {
1719 } else if (mode == "vehicle") {
1721 } else if (mode == "meanData") {
1723 } else {
1724 writeError("changeMode", 0, "<inspect/delete/select/move...>");
1725 }
1726 }
1727}
1728
1729
1730void
1732 if ((myArguments.size() != 2) ||
1734 writeError("changeElement", 0, "<\"frame\", \"string\">");
1735 } else {
1736 const std::string frame = getStringArgument(myArguments[0]);
1737 const std::string element = getStringArgument(myArguments[1]);
1738 int numTabs = -1;
1739 // continue depending of frame
1740 if (frame == "additionalFrame") {
1741 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.additional");
1742 } else if (frame == "shapeFrame") {
1743 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.shape");
1744 } else if (frame == "vehicleFrame") {
1745 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.vehicle");
1746 } else if (frame == "routeFrame") {
1747 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.route");
1748 } else if (frame == "personFrame") {
1749 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.person");
1750 } else if (frame == "containerFrame") {
1751 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.container");
1752 } else if (frame == "personPlanFrame") {
1753 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.personPlan");
1754 } else if (frame == "containerPlanFrame") {
1755 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.containerPlan");
1756 } else if (frame == "stopFrame") {
1757 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.stop");
1758 } else if (frame == "meanDataFrame") {
1759 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changeElement.meanData");
1760 } else {
1761 WRITE_ERRORF("Invalid frame '%' used in function changeElement", frame);
1762 }
1763 if (numTabs >= 0) {
1764 // show info
1765 std::cout << element << std::endl;
1766 // focus frame
1768 // jump to select additional argument
1769 for (int i = 0; i < numTabs; i++) {
1770 buildPressKeyEvent("tab", false);
1771 }
1772 // write additional character by character
1773 for (const char c : element) {
1774 buildPressKeyEvent({c}, false);
1775 }
1776 // press enter to confirm changes (updating view)
1777 buildPressKeyEvent("enter", true);
1778 }
1779 }
1780}
1781
1782
1783void
1785 if ((myArguments.size() != 3) ||
1789 writeError("changePlan", 0, "<\"type\", \"plan\", true/false>");
1790 } else {
1791 // get arguments
1792 const std::string type = getStringArgument(myArguments[0]);
1793 const std::string plan = getStringArgument(myArguments[1]);
1794 const bool flow = getBoolArgument(myArguments[2]);
1795 // check plan
1796 if ((type != "person") && (type != "container")) {
1797 WRITE_ERRORF("invalid plan type '%' used in changePlan()", type);
1798 } else {
1799 // calculate num tabs
1800 int numTabs = 0;
1801 if (flow) {
1802 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changePlan." + type + "Flow");
1803 } else {
1804 numTabs = myTestSystem->getAttributesEnum().at("netedit.attrs.frames.changePlan." + type);
1805 }
1806 // focus frame
1808 // jump to select additional argument
1809 for (int i = 0; i < numTabs; i++) {
1810 buildPressKeyEvent("tab", false);
1811 }
1812 // write additional character by character
1813 for (const char c : plan) {
1814 buildPressKeyEvent({c}, false);
1815 }
1816 // print info
1817 std::cout << plan << std::endl;
1818 // press enter to confirm changes (updating view)
1819 buildPressKeyEvent("enter", true);
1820 }
1821 }
1822}
1823
1824
1825void
1827 if (myArguments.size() > 0) {
1828 writeError("computeJunctions", 0, "<>");
1829 } else {
1832 }
1833}
1834
1835
1836void
1838 if (myArguments.size() > 1) {
1839 writeError("computeJunctionsVolatileOptions", 0, "<True/False>");
1840 } else {
1841 // due argument is optional, if not given, we assume True
1842 FXuint result = DialogTest::yes;
1843 if ((myArguments.size() == 1) && (myArguments[0] == "False")) {
1844 result = DialogTest::no;
1845 }
1848 myDialogTest = new DialogTest(result);
1849 }
1850}
1851
1852
1853void
1855 if ((myArguments.size() != 2) ||
1858 writeError("selectAdditionalChild", 0, "<int, int>");
1859 } else {
1860 const auto tabs = getIntArgument(myArguments[0]);
1861 const auto downs = getIntArgument(myArguments[1]);
1862 // focus frame
1863 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_HOTKEY_SHIFT_F12_FOCUSUPPERELEMENT, Category::APP, "select additional child");
1864 // jump to the element
1865 for (int i = 0; i < tabs; i++) {
1866 buildPressKeyEvent("tab", false);
1867 }
1868 // jump to the element
1869 for (int i = 0; i < downs; i++) {
1870 buildPressKeyEvent("down", false);
1871 }
1872 // select additional child
1873 buildPressKeyEvent("space", true);
1874 // leave
1875 buildPressKeyEvent("tab", true);
1876 }
1877}
1878
1879
1880void
1882 if ((myArguments.size() != 5) ||
1883 (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
1887 writeError("createRectangledShape", 0, "<viewPosition, sizeX, sizeY, true/false>");
1888 } else {
1889 // create shape
1894 false);
1895 }
1896}
1897
1898
1899void
1901 if ((myArguments.size() != 4) ||
1902 (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
1905 writeError("createSquaredShape", 0, "<viewPosition, size, true/false>");
1906 } else {
1907 // create shape
1912 false);
1913 }
1914}
1915
1916
1917void
1919 if ((myArguments.size() != 5) ||
1920 (myTestSystem->getViewPositions().count(myArguments[1]) == 0) ||
1924 writeError("createLineShape", 0, "<viewPosition, sizeX, sizeY, true/false>");
1925 } else {
1926 // create shape
1931 true);
1932 }
1933}
1934
1935
1936void
1938 if (myArguments.size() != 0) {
1939 writeError("createMeanData", 0, "<>");
1940 } else {
1941 modifyBoolAttribute(5, 0);
1942 }
1943}
1944
1945
1946void
1948 if (myArguments.size() != 0) {
1949 writeError("deleteMeanData", 0, "<>");
1950 } else {
1951 modifyBoolAttribute(6, 0);
1952 }
1953}
1954
1955
1956void
1958 if (myArguments.size() != 0) {
1959 writeError("copyMeanData", 0, "<>");
1960 } else {
1961 modifyBoolAttribute(7, 0);
1962 }
1963}
1964
1965
1966void
1968 if (myArguments.size() == 0) {
1969 writeError("quit", 0, "<neteditProcess>");
1970 } else {
1973 //don't update view if we're closing to avoid problems with drawGL
1974 myUpdateView = false;
1975 }
1976}
1977
1978
1979bool
1980InternalTestStep::checkIntArgument(const std::string& argument) const {
1981 if (StringUtils::isInt(argument)) {
1982 return true;
1983 } else if (myTestSystem->getAttributesEnum().count(argument) > 0) {
1984 return true;
1985 } else {
1986 return false;
1987 }
1988}
1989
1990
1991int
1992InternalTestStep::getIntArgument(const std::string& argument) const {
1993 if (StringUtils::isInt(argument)) {
1994 return StringUtils::toInt(argument);
1995 } else {
1996 return myTestSystem->getAttributesEnum().at(argument);
1997 }
1998}
1999
2000
2001bool
2002InternalTestStep::checkBoolArgument(const std::string& argument) const {
2003 if (argument == "True") {
2004 return true;
2005 } else if (argument == "False") {
2006 return true;
2007 } else {
2008 return false;
2009 }
2010}
2011
2012
2013bool
2014InternalTestStep::getBoolArgument(const std::string& argument) const {
2015 if (argument == "True") {
2016 return true;
2017 } else {
2018 return false;
2019 }
2020}
2021
2022
2023bool
2024InternalTestStep::checkStringArgument(const std::string& argument) const {
2025 if (argument.size() < 2) {
2026 return false;
2027 } else if ((argument.front() != argument.back()) || ((argument.front() != '\'') && ((argument.front() != '\"')))) {
2028 return false;
2029 } else {
2030 return true;
2031 }
2032}
2033
2034
2035std::string
2036InternalTestStep::getStringArgument(const std::string& argument) const {
2037 std::string argumentParsed;
2038 for (int i = 1; i < ((int)argument.size() - 1); i++) {
2039 argumentParsed.push_back(argument[i]);
2040 }
2041 return argumentParsed;
2042}
2043
2044
2045std::string
2046InternalTestStep::stripSpaces(const std::string& str) const {
2047 auto start = std::find_if_not(str.begin(), str.end(), isspace);
2048 auto end = std::find_if_not(str.rbegin(), str.rend(), isspace).base();
2049 if (start < end) {
2050 return std::string(start, end);
2051 } else {
2052 return "";
2053 }
2054}
2055
2056
2057void
2058InternalTestStep::writeError(const std::string& function, const int overlapping, const std::string& expected) const {
2059 if (overlapping > 0) {
2060 WRITE_ERRORF("Invalid internal testStep function '%Ovelapped', requires '%' arguments ", function, expected);
2061 } else {
2062 WRITE_ERRORF("Invalid internal testStep function '%', requires '%' arguments ", function, expected);
2063 }
2064 // also print arguments
2065 if (myArguments.size() > 0) {
2066 WRITE_ERROR("Arguments: ");
2067 for (const auto& arg : myArguments) {
2069 }
2070 }
2071}
2072
2073
2074void
2076 const int sizeX, const int sizeY, const bool close,
2077 const bool line) const {
2078 // calculate half-sizes
2079 const int halfSizeX = int(sizeX * -0.5);
2080 const int halfSizeY = int(sizeY * -0.5);
2081 // focus frame
2083 // press enter to start drawing
2084 buildPressKeyEvent("enter", true);
2085 // first edge
2086 buildMouseClick(viewPosition, 0, 0, "left", "");
2087 writeClickInfo(viewPosition, 0, 0, "");
2088 // second edge
2089 if (!line) {
2090 buildMouseClick(viewPosition, 0, halfSizeY, "left", "");
2091 writeClickInfo(viewPosition, 0, halfSizeY, "");
2092 }
2093 // third edge
2094 buildMouseClick(viewPosition, halfSizeX, halfSizeY, "left", "");
2095 writeClickInfo(viewPosition, halfSizeX, halfSizeY, "");
2096 // four edge
2097 if (!line) {
2098 buildMouseClick(viewPosition, halfSizeX, 0, "left", "");
2099 writeClickInfo(viewPosition, halfSizeX, 0, "");
2100 }
2101 // check if close polygon
2102 if (close) {
2103 buildMouseClick(viewPosition, 0, 0, "left", "");
2104 writeClickInfo(viewPosition, 0, 0, "");
2105 }
2106 // press enter to end drawing
2107 buildPressKeyEvent("enter", true);
2108}
2109
2110
2111void
2112InternalTestStep::modifyStringAttribute(const int tabs, const int overlappedTabs, const std::string& value) const {
2113 // print info
2114 std::cout << value << std::endl;
2115 // focus frame
2117 // jump to the element
2118 for (int i = 0; i < (tabs + overlappedTabs); i++) {
2119 buildPressKeyEvent("tab", false);
2120 }
2121 // write attribute character by character
2122 if (value.empty()) {
2123 buildPressKeyEvent("delete", false);
2124 } else {
2125 for (const char c : value) {
2126 buildPressKeyEvent({c}, false);
2127 }
2128 }
2129 // press enter to confirm changes (updating view)
2130 buildPressKeyEvent("enter", true);
2131}
2132
2133
2134void
2135InternalTestStep::modifyBoolAttribute(const int tabs, const int overlappedTabs) const {
2136 // focus frame
2138 // jump to the element
2139 for (int i = 0; i < (tabs + overlappedTabs); i++) {
2140 buildPressKeyEvent("tab", false);
2141 }
2142 // toogle attribute
2143 buildPressKeyEvent("space", true);
2144}
2145
2146
2147void
2148InternalTestStep::buildUndo(const int number) const {
2149 // get reference position
2150 const auto& referencePosition = myTestSystem->getViewPositions().at("netedit.positions.reference");
2151 // focus frame
2153 // go to inspect mode
2154 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_HOTKEY_I_MODE_INSPECT, Category::APP, "inspect mode");
2155 // click over reference
2156 std::cout << "TestFunctions: Clicked over position " <<
2157 toString(MOUSE_REFERENCE_X) << " - " <<
2158 toString(MOUSE_REFERENCE_Y) << std::endl;
2159 // build mouse click
2160 buildMouseClick(referencePosition, 0, 0, "left", "");
2161 // undo
2162 for (int i = 0; i < number; i++) {
2164 }
2165}
2166
2167
2168void
2169InternalTestStep::buildRedo(const int number) const {
2170 // get reference position
2171 const auto& referencePosition = myTestSystem->getViewPositions().at("netedit.positions.reference");
2172 // focus frame
2174 // go to inspect mode
2175 new InternalTestStep(myTestSystem, SEL_COMMAND, MID_HOTKEY_I_MODE_INSPECT, Category::APP, "inspect mode");
2176 // click over reference
2177 std::cout << "TestFunctions: Clicked over position " <<
2178 toString(MOUSE_REFERENCE_X) << " - " <<
2179 toString(MOUSE_REFERENCE_Y) << std::endl;
2180 // build mouse click
2181 buildMouseClick(referencePosition, 0, 0, "left", "");
2182 // undo
2183 for (int i = 0; i < number; i++) {
2185 }
2186}
2187
2188
2189std::pair<FXint, FXString>
2190InternalTestStep::translateKey(const std::string& key) const {
2191 std::pair<FXint, FXString> solution;
2192 // check if key is a single character
2193 if (key.size() == 1) {
2194 solution.first = FXint(key.front());
2195 solution.second.append(key.front());
2196 } else {
2197 // continue depending of key
2198 if (key == "backspace") {
2199 solution.first = KEY_BackSpace;
2200 solution.second = "\b";
2201 } else if (key == "space") {
2202 solution.first = KEY_space;
2203 } else if (key == "tab") {
2204 solution.first = KEY_Tab;
2205 solution.second = "\t";
2206 } else if (key == "clear") {
2207 solution.first = KEY_Clear;
2208 } else if (key == "enter" || key == "return") {
2209 solution.first = KEY_Return;
2210 solution.second = "\n";
2211 } else if (key == "pause") {
2212 solution.first = KEY_Pause;
2213 } else if (key == "sys_req") {
2214 solution.first = KEY_Sys_Req;
2215 } else if (key == "esc" || key == "escape") {
2216 solution.first = KEY_Escape;
2217 solution.second = "\x1B";
2218 } else if (key == "delete") {
2219 solution.first = KEY_Delete;
2220 solution.second = "\x7F";
2221 } else if (key == "multi_key") {
2222 solution.first = KEY_Multi_key;
2223 // function
2224 } else if (key == "shift") {
2225 solution.first = KEY_Shift_L;
2226 } else if (key == "control") {
2227 solution.first = KEY_Control_L;
2228 // Cursor
2229 } else if (key == "home") {
2230 solution.first = KEY_Home;
2231 } else if (key == "left") {
2232 solution.first = KEY_Left;
2233 } else if (key == "up") {
2234 solution.first = KEY_Up;
2235 } else if (key == "right") {
2236 solution.first = KEY_Right;
2237 } else if (key == "down") {
2238 solution.first = KEY_Down;
2239 } else if (key == "prior" || key == "page_up") {
2240 solution.first = KEY_Page_Up;
2241 } else if (key == "next" || key == "page_down") {
2242 solution.first = KEY_Page_Down;
2243 } else if (key == "end") {
2244 solution.first = KEY_End;
2245 } else if (key == "begin") {
2246 solution.first = KEY_Begin;
2247 // Function keys
2248 } else if (key == "f1") {
2249 solution.first = KEY_F1;
2250 } else if (key == "f2") {
2251 solution.first = KEY_F2;
2252 } else if (key == "f3") {
2253 solution.first = KEY_F3;
2254 } else if (key == "f4") {
2255 solution.first = KEY_F4;
2256 } else if (key == "f5") {
2257 solution.first = KEY_F5;
2258 } else if (key == "f6") {
2259 solution.first = KEY_F6;
2260 } else if (key == "f7") {
2261 solution.first = KEY_F7;
2262 } else if (key == "f8") {
2263 solution.first = KEY_F8;
2264 } else if (key == "f9") {
2265 solution.first = KEY_F9;
2266 } else if (key == "f10") {
2267 solution.first = KEY_F10;
2268 } else if (key == "f11" || key == "l1") {
2269 solution.first = KEY_F11;
2270 } else if (key == "f12" || key == "l2") {
2271 solution.first = KEY_F12;
2272 } else {
2273 writeError("translateKey", 0, "<key>");
2274 solution.first = KEY_VoidSymbol;
2275 }
2276 }
2277 return solution;
2278}
2279
2280
2281FXEvent*
2282InternalTestStep::buildKeyPressEvent(const std::string& key) const {
2283 const auto keyValues = translateKey(key);
2284 FXEvent* keyPressEvent = new FXEvent();
2285 // set event values
2286 keyPressEvent->time = myTestSystem->getTime();
2287 keyPressEvent->synthetic = true;
2288 keyPressEvent->type = SEL_KEYPRESS;
2289 keyPressEvent->code = keyValues.first;
2290 keyPressEvent->text = keyValues.second;
2291 return keyPressEvent;
2292}
2293
2294
2295FXEvent*
2296InternalTestStep::buildKeyReleaseEvent(const std::string& key) const {
2297 const auto keyValues = translateKey(key);
2298 FXEvent* keyPressEvent = new FXEvent();
2299 // set event values
2300 keyPressEvent->time = myTestSystem->getTime();
2301 keyPressEvent->synthetic = true;
2302 keyPressEvent->type = SEL_KEYPRESS;
2303 keyPressEvent->code = keyValues.first;
2304 keyPressEvent->text = keyValues.second;
2305 // special case for shift and control
2306 return keyPressEvent;
2307}
2308
2309
2310void
2311InternalTestStep::buildPressKeyEvent(const std::string& key, const bool updateView) const {
2312 new InternalTestStep(myTestSystem, SEL_KEYPRESS, Category::APP, buildKeyPressEvent(key), updateView, "key '" + key + "' pressed");
2313 new InternalTestStep(myTestSystem, SEL_KEYRELEASE, Category::APP, buildKeyReleaseEvent(key), updateView, "key '" + key + "' released");
2314}
2315
2316
2317void
2318InternalTestStep::buildPressKeyEvent(InternalTestStep* parent, const std::string& key) const {
2319 new InternalTestStep(parent, SEL_KEYPRESS, buildKeyPressEvent(key), "key '" + key + "' pressed in dialog");
2320 new InternalTestStep(parent, SEL_KEYRELEASE, buildKeyReleaseEvent(key), "key '" + key + "' released in dialog");
2321}
2322
2323
2324void
2325InternalTestStep::buildTwoPressKeyEvent(const std::string& keyA, const std::string& keyB, const bool updateView) const {
2326 // create both events using keyB
2327 auto pressEvent = buildKeyPressEvent(keyB);
2328 auto releaseEvent = buildKeyPressEvent(keyB);
2329 // check if set state
2330 if (keyA == "shift") {
2331 pressEvent->state = SHIFTMASK;
2332 releaseEvent->state = SHIFTMASK;
2333 } else if (keyA == "control") {
2334 pressEvent->state = CONTROLMASK;
2335 releaseEvent->state = CONTROLMASK;
2336 } else if (keyA == "alt") {
2337 pressEvent->state = ALTMASK;
2338 releaseEvent->state = ALTMASK;
2339 }
2340 new InternalTestStep(myTestSystem, SEL_KEYPRESS, Category::APP, pressEvent, updateView, "keys '" + keyA + "' + '" + keyB + "' pressed");
2341 new InternalTestStep(myTestSystem, SEL_KEYRELEASE, Category::APP, releaseEvent, updateView, "keys '" + keyA + "' + '" + keyB + " pressed");
2342}
2343
2344
2345void
2346InternalTestStep::buildTwoPressKeyEvent(InternalTestStep* parent, const std::string& keyA, const std::string& keyB) const {
2347 // create both events using keyB
2348 auto pressEvent = buildKeyPressEvent(keyB);
2349 auto releaseEvent = buildKeyPressEvent(keyB);
2350 // check if set state
2351 if (keyA == "shift") {
2352 pressEvent->state = SHIFTMASK;
2353 releaseEvent->state = SHIFTMASK;
2354 } else if (keyA == "control") {
2355 pressEvent->state = CONTROLMASK;
2356 releaseEvent->state = CONTROLMASK;
2357 } else if (keyA == "alt") {
2358 pressEvent->state = ALTMASK;
2359 releaseEvent->state = ALTMASK;
2360 }
2361 new InternalTestStep(parent, SEL_KEYPRESS, pressEvent, "keys '" + keyA + "' + '" + keyB + "' pressed in dialog");
2362 new InternalTestStep(parent, SEL_KEYRELEASE, releaseEvent, "keys '" + keyA + "' + '" + keyB + " pressed in dialog");
2363}
2364
2365
2366void
2368 const int offsetX, const int offsetY,
2369 const std::string& button, const std::string& keyModifier) const {
2370 // move mouse move
2372 buildMouseMoveEvent(viewPosition, offsetX, offsetY, 0, "", 0),
2373 true, "mouse moved to click position");
2374 // continue depending of mouse
2375 if (button == "left") {
2376 new InternalTestStep(myTestSystem, SEL_LEFTBUTTONPRESS, Category::VIEW,
2377 buildMouseClickEvent(SEL_LEFTBUTTONPRESS, viewPosition, offsetX, offsetY, keyModifier, 1),
2378 true, "mouse button " + button + " pressed");
2379 new InternalTestStep(myTestSystem, SEL_LEFTBUTTONRELEASE, Category::VIEW,
2380 buildMouseClickEvent(SEL_LEFTBUTTONRELEASE, viewPosition, offsetX, offsetY, keyModifier, 1),
2381 true, "mouse button " + button + " released");
2382 } else if (button == "center") {
2383 new InternalTestStep(myTestSystem, SEL_MIDDLEBUTTONPRESS, Category::VIEW,
2384 buildMouseClickEvent(SEL_MIDDLEBUTTONPRESS, viewPosition, offsetX, offsetY, keyModifier, 1),
2385 true, "mouse button " + button + " pressed");
2386 new InternalTestStep(myTestSystem, SEL_MIDDLEBUTTONRELEASE, Category::VIEW,
2387 buildMouseClickEvent(SEL_MIDDLEBUTTONRELEASE, viewPosition, offsetX, offsetY, keyModifier, 1),
2388 true, "mouse button " + button + " released");
2389 } else if (button == "right") {
2390 new InternalTestStep(myTestSystem, SEL_RIGHTBUTTONPRESS, Category::VIEW,
2391 buildMouseClickEvent(SEL_RIGHTBUTTONPRESS, viewPosition, offsetX, offsetY, keyModifier, 1),
2392 true, "mouse button " + button + " pressed");
2393 new InternalTestStep(myTestSystem, SEL_RIGHTBUTTONRELEASE, Category::VIEW,
2394 buildMouseClickEvent(SEL_RIGHTBUTTONRELEASE, viewPosition, offsetX, offsetY, keyModifier, 1),
2395 true, "mouse button " + button + " released");
2396 }
2397}
2398
2399
2400void
2402 const int offsetStartX, const int offsetStartY,
2403 const InternalTest::ViewPosition& viewEndPosition,
2404 const int offsetEndX, const int offsetEndY,
2405 const std::string& keyModifier) const {
2406 // move mouse interpolating
2407 const auto interpolationSteps = myTestSystem->interpolateViewPositions(viewStartPosition, offsetStartX, offsetStartY, viewEndPosition, offsetEndX, offsetEndY);
2408 // move mouse move
2410 buildMouseMoveEvent(viewStartPosition, offsetStartX, offsetStartY, 0, "", 0),
2411 true, "mouse moved to click position (dragDrop)");
2412 // press button
2413 new InternalTestStep(myTestSystem, SEL_LEFTBUTTONPRESS, Category::VIEW,
2414 buildMouseClickEvent(SEL_LEFTBUTTONPRESS, viewStartPosition, offsetStartX, offsetStartY, keyModifier, 1),
2415 true, "mouse button left pressed (dragDrop)");
2416 // move mouse button
2417 for (const auto& position : interpolationSteps) {
2419 buildMouseMoveEvent(position, 0, 0, LEFTBUTTON, "leftButton", 1),
2420 true, "mouse moved (dragDrop)");
2421 }
2422 // release button
2423 new InternalTestStep(myTestSystem, SEL_LEFTBUTTONRELEASE, Category::VIEW,
2424 buildMouseClickEvent(SEL_LEFTBUTTONRELEASE, viewEndPosition, offsetEndX, offsetEndY, keyModifier, 1),
2425 true, "mouse button left released (dragDrop)");
2426}
2427
2428
2429FXEvent*
2431 const int offsetX, const int offsetY, const int clickedButton,
2432 const std::string& keyModifier, const int numberOfClicks) const {
2433 FXEvent* moveEvent = new FXEvent();
2434 // set event values
2435 moveEvent->time = myTestSystem->getTime();
2436 moveEvent->type = SEL_MOTION;
2437 moveEvent->synthetic = true;
2438 moveEvent->win_x = viewPosition.getX() + MOUSE_OFFSET_X + offsetX;
2439 moveEvent->win_y = viewPosition.getY() + MOUSE_OFFSET_Y + offsetY;
2440 moveEvent->last_x = myTestSystem->getLastMovedPosition().getX();
2441 moveEvent->last_y = myTestSystem->getLastMovedPosition().getY();
2442 moveEvent->click_x = 0;
2443 moveEvent->click_y = 0;
2444 moveEvent->moved = true;
2445 moveEvent->rect = FXRectangle(0, 0, 0, 0);
2446 moveEvent->click_button = clickedButton;
2447 moveEvent->click_count = numberOfClicks;
2448 moveEvent->code = 0;
2449 // set modifier
2450 if (keyModifier == "control") {
2451 moveEvent->state = CONTROLMASK;
2452 } else if (keyModifier == "shift") {
2453 moveEvent->state = SHIFTMASK;
2454 } else if (keyModifier == "leftButton") {
2455 moveEvent->state = LEFTBUTTONMASK;
2456 } else {
2457 moveEvent->state = 0;
2458 }
2459 // update last moved position
2460 myTestSystem->updateLastMovedPosition(moveEvent->win_x, moveEvent->win_y);
2461 return moveEvent;
2462}
2463
2464
2465FXEvent*
2467 const int offsetX, const int offsetY, const std::string& keyModifier,
2468 const int numberOfClicks) const {
2469 FXEvent* clickEvent = new FXEvent();
2470 // set event values
2471 clickEvent->time = myTestSystem->getTime();
2472 clickEvent->type = type;
2473 clickEvent->synthetic = true;
2474 clickEvent->win_x = viewPosition.getX() + MOUSE_OFFSET_X + offsetX;
2475 clickEvent->win_y = viewPosition.getY() + MOUSE_OFFSET_Y + offsetY;
2476 clickEvent->click_x = viewPosition.getX() + MOUSE_OFFSET_X + offsetX;
2477 clickEvent->click_y = viewPosition.getY() + MOUSE_OFFSET_Y + offsetY;
2478 clickEvent->last_x = myTestSystem->getLastMovedPosition().getX();
2479 clickEvent->last_y = myTestSystem->getLastMovedPosition().getY();
2480 clickEvent->click_count = numberOfClicks;
2481 clickEvent->moved = false;
2482 clickEvent->rect = FXRectangle(0, 0, 0, 0);
2483 // set button
2484 if ((type == SEL_LEFTBUTTONPRESS) || (type == SEL_LEFTBUTTONRELEASE)) {
2485 clickEvent->click_button = LEFTBUTTON;
2486 clickEvent->code = LEFTBUTTON;
2487 } else if ((type == SEL_MIDDLEBUTTONPRESS) || (type == SEL_MIDDLEBUTTONRELEASE)) {
2488 clickEvent->click_button = MIDDLEBUTTON;
2489 clickEvent->code = MIDDLEBUTTON;
2490 } else if ((type == SEL_RIGHTBUTTONPRESS) || (type == SEL_RIGHTBUTTONRELEASE)) {
2491 clickEvent->click_button = RIGHTBUTTON;
2492 clickEvent->code = RIGHTBUTTON;
2493 } else {
2494 clickEvent->click_button = 0;
2495 clickEvent->code = 0;
2496 }
2497 // set modifier
2498 if (keyModifier == "control") {
2499 clickEvent->state = CONTROLMASK;
2500 } else if (keyModifier == "shift") {
2501 clickEvent->state = SHIFTMASK;
2502 } else {
2503 clickEvent->state = 0;
2504 }
2505 return clickEvent;
2506}
2507
2508
2509void
2511 const int offsetX, const int offsetY,
2512 const std::string modifier) const {
2513 if (modifier == "control") {
2514 std::cout << "TestFunctions: Clicked with Control key pressed over position " <<
2515 toString(viewPosition.getX() + MOUSE_REFERENCE_X + offsetX) << " - " <<
2516 toString(viewPosition.getY() + MOUSE_REFERENCE_Y + offsetY) << std::endl;
2517 } else if (modifier == "shift") {
2518 std::cout << "TestFunctions: Clicked with Shift key pressed over position " <<
2519 toString(viewPosition.getX() + MOUSE_REFERENCE_X + offsetX) << " - " <<
2520 toString(viewPosition.getY() + MOUSE_REFERENCE_Y) << std::endl;
2521 } else {
2522 std::cout << "TestFunctions: Clicked over position " <<
2523 toString(viewPosition.getX() + MOUSE_REFERENCE_X + offsetX) << " - " <<
2524 toString(viewPosition.getY() + MOUSE_REFERENCE_Y + offsetY) << std::endl;
2525 }
2526}
2527
2528/****************************************************************************/
@ MID_GNE_NETWORKVIEWOPTIONS_AUTOOPPOSITEEDGES
automatically create opposite edge
Definition GUIAppEnum.h:847
@ MID_GNE_LOCK_POLYGON
lock polygons
Definition GUIAppEnum.h:873
@ MID_HOTKEY_CTRL_Q_CLOSE
Main window closes.
Definition GUIAppEnum.h:115
@ MID_HOTKEY_SHIFT_F5_COMPUTEJUNCTIONS_VOLATILE
compute junctions with volatile options
Definition GUIAppEnum.h:268
@ MID_HOTKEY_CTRL_SHIFT_B_SAVEDATAELEMENTS
save Data Elements
Definition GUIAppEnum.h:204
@ MID_HOTKEY_F3_SUPERMODE_DEMAND
select demand supermode in netedit
Definition GUIAppEnum.h:234
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWALLPERSONPLANS
show all person plans
Definition GUIAppEnum.h:931
@ MID_GNE_UNLOCK_ALLELEMENTS
unlock all element
Definition GUIAppEnum.h:909
@ MID_GNE_DATAVIEWOPTIONS_TAZRELDRAWING
toggle TAZRel drawing
Definition GUIAppEnum.h:955
@ MID_HOTKEY_U_MODE_DECAL_TYPEDISTRIBUTION
hotkey for mode decal AND type distribution
Definition GUIAppEnum.h:69
@ MID_GNE_NETWORKVIEWOPTIONS_DRAWSPREADVEHICLES
Draw vehicles in begin position or spread in lane.
Definition GUIAppEnum.h:821
@ MID_GNE_TLSFRAME_PHASES_ADDUNUSED
add unused states
@ MID_HOTKEY_CTRL_Y_REDO
Undo.
Definition GUIAppEnum.h:133
@ MID_GNE_NETWORKVIEWOPTIONS_MOVEELEVATION
move elevation instead of x,y
Definition GUIAppEnum.h:843
@ MID_GNE_LOCK_WIRE
lock wires
Definition GUIAppEnum.h:869
@ MID_GNE_NETWORKVIEWOPTIONS_HIDECONNECTIONS
hide connections
Definition GUIAppEnum.h:829
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWCONNECTIONS
show connections
Definition GUIAppEnum.h:827
@ MID_GNE_TLSTABLE_ADDPHASE
TLSTable button for add phase.
@ MID_GNE_DATAVIEWOPTIONS_TAZRELONLYTO
toggle draw TAZRel only to
Definition GUIAppEnum.h:961
@ MID_GNE_LOCK_ALLELEMENTS
lock all element
Definition GUIAppEnum.h:907
@ MID_HOTKEY_F5_COMPUTE_NETWORK_DEMAND
compute Network in network mode and Demand elements in demand mode
Definition GUIAppEnum.h:238
@ MID_GNE_DATAVIEWOPTIONS_TOGGLEDRAWJUNCTIONSHAPE
toggle draw junction shape
Definition GUIAppEnum.h:947
@ MID_GNE_TLSTABLE_COPYPHASE
TLSTable button for copy phase.
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWTAZELEMENTS
show TAZ elements
Definition GUIAppEnum.h:833
@ MID_GNE_DEMANDVIEWOPTIONS_LOCKPERSON
lock person
Definition GUIAppEnum.h:933
@ MID_GNE_LOCK_JPS_WALKABLEAREA
lock walkableAreas
Definition GUIAppEnum.h:877
@ MID_HOTKEY_Z_MODE_TAZ_TAZREL
hotkey for mode editing TAZ and TAZRel
Definition GUIAppEnum.h:75
@ MID_GNE_TLSTABLE_ADDPHASEALLGREENPRIORITY
TLSTable button for add phase green priority.
@ MID_GNE_DEMANDVIEWOPTIONS_TOGGLEDRAWJUNCTIONSHAPE
toggle draw junction shape
Definition GUIAppEnum.h:921
@ MID_GNE_LOCK_SELECTEDELEMENTS
lock selected element
Definition GUIAppEnum.h:911
@ MID_GNE_TLSFRAME_PHASES_CLEANUP
cleanup unused states
@ MID_GNE_TLSFRAME_PHASES_GROUPSTATES
group states
@ MID_HOTKEY_DEL
hot key delete selections or elements
Definition GUIAppEnum.h:286
@ MID_HOTKEY_A_MODE_STARTSIMULATION_ADDITIONALS_STOPS
hotkey for start simulation in SUMO and set editing mode additionals AND stops in netedit
Definition GUIAppEnum.h:43
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWGRID
show grid
Definition GUIAppEnum.h:919
@ MID_HOTKEY_CTRL_SHIFT_D_SAVEDEMANDELEMENTS
Save Demand Elements.
Definition GUIAppEnum.h:208
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in netedit.
Definition GUIAppEnum.h:117
@ MID_INTERNALTEST
execute internal test in modal dialog
@ MID_HOTKEY_D_MODE_SINGLESIMULATIONSTEP_DELETE
hotkey for perform a single simulation step in SUMO and set delete mode in netedit
Definition GUIAppEnum.h:49
@ MID_GNE_NETWORKVIEWOPTIONS_CHAINEDGES
create edges in chain mode
Definition GUIAppEnum.h:845
@ MID_GNE_DATAVIEWOPTIONS_SHOWDEMANDELEMENTS
show demand elements
Definition GUIAppEnum.h:953
@ MID_GNE_LOCK_WALKINGAREA
lock walkingareas
Definition GUIAppEnum.h:865
@ MID_HOTKEY_C_MODE_CONNECT_CONTAINER
hotkey for mode connecting lanes AND container
Definition GUIAppEnum.h:45
@ MID_HOTKEY_H_MODE_PROHIBITION_CONTAINERPLAN
hotkey for mode prohibition AND container plan
Definition GUIAppEnum.h:53
@ MID_HOTKEY_W_MODE_WIRE_ROUTEDISTRIBUTION
hotkey for mode editing overhead wires AND route distributions
Definition GUIAppEnum.h:73
@ MID_HOTKEY_T_MODE_TLS_TYPE
hotkey for mode editing TLS AND Vehicle Types
Definition GUIAppEnum.h:67
@ MID_GNE_DEMANDVIEWOPTIONS_HIDESHAPES
hide shapes
Definition GUIAppEnum.h:927
@ MID_GNE_TLSFRAME_PHASES_UNGROUPSTATES
ungroup states
@ MID_GNE_LOCK_JPS_OBSTACLE
lock obstacles
Definition GUIAppEnum.h:879
@ MID_GNE_TLSTABLE_ADDPHASEALLYELLOW
TLSTable button for add phase yelllow.
@ MID_GNE_DATAVIEWOPTIONS_SHOWADDITIONALS
show additionals
Definition GUIAppEnum.h:949
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWBUBBLES
show junctions as bubbles
Definition GUIAppEnum.h:841
@ MID_GNE_TLSTABLE_TEXTFIELD
TLSTable textField.
@ MID_GNE_NETWORKVIEWOPTIONS_EXTENDSELECTION
extend selection
Definition GUIAppEnum.h:835
@ MID_GNE_TLSTABLE_ADDPHASEALLRED
TLSTable button for add phase red.
@ MID_HOTKEY_S_MODE_STOPSIMULATION_SELECT
hotkey for stop simulation in SUMO and set select mode in netedit
Definition GUIAppEnum.h:63
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWSUBADDITIONALS
show sub-additionals
Definition GUIAppEnum.h:831
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWALLCONTAINERPLANS
show all container plans
Definition GUIAppEnum.h:935
@ MID_GNE_LOCK_ADDITIONALELEMENT
lock additional elements
Definition GUIAppEnum.h:867
@ MID_GNE_TLSTABLE_MOVEDOWNPHASE
TLSTable button for move down phase.
@ MID_HOTKEY_F4_SUPERMODE_DATA
select data supermode in netedit
Definition GUIAppEnum.h:236
@ MID_GNE_LOCK_EDGE
lock edges
Definition GUIAppEnum.h:857
@ MID_HOTKEY_R_MODE_CROSSING_ROUTE_EDGERELDATA
hotkey for mode editing crossing, routes and edge rel datas
Definition GUIAppEnum.h:65
@ MID_GNE_DATAVIEWOPTIONS_TAZDRAWFILL
toggle draw TAZ fill
Definition GUIAppEnum.h:957
@ MID_HOTKEY_L_MODE_PERSONPLAN
hotkey for mode person plan
Definition GUIAppEnum.h:57
@ MID_HOTKEY_V_MODE_VEHICLE
hotkey for mode create vehicles
Definition GUIAppEnum.h:71
@ MID_HOTKEY_I_MODE_INSPECT
hotkey for mode inspecting object attributes
Definition GUIAppEnum.h:55
@ MID_GNE_TLSTABLE_ADDPHASEALLGREEN
TLSTable button for add phase green.
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWDEMANDELEMENTS
show demand elements
Definition GUIAppEnum.h:823
@ MID_GNE_TLSTABLE_REMOVEPHASE
TLSTable button for remove phase.
@ MID_HOTKEY_CTRL_SHIFT_E_SAVENETEDITCONFIG
save netedit Config
Definition GUIAppEnum.h:210
@ MID_GNE_DEMANDVIEWOPTIONS_HIDENONINSPECTED
hide non-inspected demand element
Definition GUIAppEnum.h:925
@ MID_GNE_LOCK_CONNECTION
lock connections
Definition GUIAppEnum.h:861
@ MID_GNE_NETWORKVIEWOPTIONS_MERGEAUTOMATICALLY
don't ask before merging junctions
Definition GUIAppEnum.h:839
@ MID_HOTKEY_CTRL_SHIFT_M_SAVEMEANDATAELEMENTS
save Mean Datas
Definition GUIAppEnum.h:216
@ MID_GNE_NETWORKVIEWOPTIONS_CHANGEALLPHASES
change all phases
Definition GUIAppEnum.h:837
@ MID_GNE_TLSTABLE_MOVEUPPHASE
TLSTable button for move up phase.
@ MID_GNE_DATAVIEWOPTIONS_SHOWSHAPES
show shapes
Definition GUIAppEnum.h:951
@ MID_HOTKEY_E_MODE_EDGE_EDGEDATA
hotkey for mode adding edges AND edgeDatas
Definition GUIAppEnum.h:51
@ MID_GNE_DATAVIEWOPTIONS_TAZRELONLYFROM
toggle draw TAZRel only from
Definition GUIAppEnum.h:959
@ MID_GNE_LOCK_LANE
lock lanes
Definition GUIAppEnum.h:859
@ MID_GNE_NETWORKVIEWOPTIONS_TOGGLEDRAWJUNCTIONSHAPE
toggle draw junction shape
Definition GUIAppEnum.h:819
@ MID_GNE_DEMANDVIEWOPTIONS_DRAWSPREADVEHICLES
Draw vehicles in begin position or spread in lane.
Definition GUIAppEnum.h:923
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWOVERLAPPEDROUTES
show overlapped routes
Definition GUIAppEnum.h:939
@ MID_HOTKEY_CTRL_Z_UNDO
Redo.
Definition GUIAppEnum.h:135
@ MID_HOTKEY_CTRL_SHIFT_S_SAVESUMOCONFIG
save SUMOConfig (SUMO AND netedit)
Definition GUIAppEnum.h:222
@ MID_GNE_LOCK_CROSSING
lock crossings
Definition GUIAppEnum.h:863
@ MID_HOTKEY_M_MODE_MOVE_MEANDATA
hotkey for mode moving element AND mean data
Definition GUIAppEnum.h:59
@ MID_HOTKEY_F2_SUPERMODE_NETWORK
select network supermode in netedit
Definition GUIAppEnum.h:232
@ MID_GNE_DEMANDVIEWOPTIONS_LOCKCONTAINER
lock container
Definition GUIAppEnum.h:937
@ MID_HOTKEY_SHIFT_F12_FOCUSUPPERELEMENT
focus upper element of current frame (only used in netedit)
Definition GUIAppEnum.h:274
@ MID_GNE_NETWORKVIEWOPTIONS_SELECTEDGES
select edges
Definition GUIAppEnum.h:825
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWTRIPS
show all trips
Definition GUIAppEnum.h:929
@ MID_GNE_NETWORKVIEWOPTIONS_TOGGLEGRID
show grid
Definition GUIAppEnum.h:817
@ MID_GNE_LOCK_JUNCTION
lock junctions
Definition GUIAppEnum.h:855
@ MID_GNE_LOCK_POI
lock POIs
Definition GUIAppEnum.h:875
@ MID_HOTKEY_P_MODE_POLYGON_PERSON
hotkey for mode creating polygons
Definition GUIAppEnum.h:61
@ MID_GNE_LOCK_TAZ
lock TAZs
Definition GUIAppEnum.h:871
@ MID_HOTKEY_CTRL_SHIFT_A_SAVEADDITIONALELEMENTS
Save Additional Elements.
Definition GUIAppEnum.h:202
@ KEY_F4
@ KEY_F9
@ KEY_F6
@ KEY_F7
@ KEY_F10
@ KEY_F5
@ KEY_F12
@ KEY_F2
@ KEY_F3
@ KEY_F8
@ KEY_F11
@ KEY_F1
constexpr int MOUSE_OFFSET_X
constexpr int MOUSE_REFERENCE_Y
constexpr int MOUSE_REFERENCE_X
constexpr int MOUSE_OFFSET_Y
#define WRITE_ERRORF(...)
Definition MsgHandler.h:297
#define WRITE_ERROR(msg)
Definition MsgHandler.h:296
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
int getY() const
get y value
int getX() const
get x value
std::vector< InternalTest::ViewPosition > interpolateViewPositions(const InternalTest::ViewPosition &viewStartPosition, const int offsetStartX, const int offsetStartY, const InternalTest::ViewPosition &viewEndPosition, const int offsetEndX, const int offsetEndY) const
interpolate view positions
void addTestSteps(InternalTestStep *internalTestStep)
add test steps
const std::map< std::string, InternalTest::ContextualMenu > & getContextualMenuOperations() const
get map with contextual menu operation jump steps
const std::map< std::string, int > & getAttributesEnum() const
get map with attributesEnum jump steps
const std::map< std::string, InternalTest::ViewPosition > & getViewPositions() const
get map with view position pairs
FXint getTime() const
get currentTime
void updateLastMovedPosition(const int x, const int y)
update last moved position
const InternalTest::ViewPosition & getLastMovedPosition() const
get last moved position
InternalTestStep * getLastTestStep() const
get last test step
const std::map< std::string, InternalTest::Movement > & getMovements() const
get map with movement pairs
dialog arguments (used for certain functions that opens modal dialogs)
static const FXuint no
no value
DialogTest()=delete
invalidated default constructor
static const std::string colorValue
color dialog value
static const FXuint yes
yes value
struct used for test TLS Tables
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
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
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
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool isInt(const std::string &sData)
check if the given sData can be converted to int