Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEInternalTest.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// Internal test system used for testing netedit
19/****************************************************************************/
20
22#include <netedit/GNEViewNet.h>
28
29#include "GNEInternalTest.h"
30
31// ===========================================================================
32// member method definitions
33// ===========================================================================
34
35GNEInternalTest::GNEInternalTest(const std::string& testFile) :
36 InternalTest(testFile) {
37}
38
39
41
42
43void
45 bool writeClosedSucessfully = false;
46 myRunning = true;
47 const auto viewNet = applicationWindow->getViewNet();
48 const auto viewParent = viewNet->getViewParent();
49 // process every step
50 while (myCurrentStep < myTestSteps.size()) {
51 const auto testStep = myTestSteps.at(myCurrentStep);
52 // write description
53 // std::cout << "TestFunctions: Executing step " << myCurrentStep + 1
54 // << " of " << myTestSteps.size() << ": "
55 // << testStep->getDescription() << std::endl;
56 // get argument (either event or modalDialogArgument or nullptr)
57 void* argument = nullptr;
58 if (testStep->getEvent()) {
59 argument = testStep->getEvent();
60 }
61 if (testStep->getDialogTest()) {
62 argument = testStep->getDialogTest();
63 }
64 // check if we have to process it in main windows, abstract view or specific view
65 if (testStep->getCategory() == InternalTestStep::Category::APP) {
66 applicationWindow->handle(this, testStep->getSelector(), argument);
67 } else if (testStep->getCategory() == InternalTestStep::Category::VIEW) {
68 viewNet->handle(this, testStep->getSelector(), argument);
69 } else if (testStep->getCategory() == InternalTestStep::Category::TLS_PHASES) {
70 viewParent->getTLSEditorFrame()->getTLSPhases()->handle(this, testStep->getSelector(), argument);
71 } else if (testStep->getCategory() == InternalTestStep::Category::TLS_PHASETABLE) {
72 viewParent->getTLSEditorFrame()->getTLSPhases()->getPhaseTable()->testTable(testStep->getTLSTableTest());
73 } else if (testStep->getCategory() == InternalTestStep::Category::INIT) {
74 writeClosedSucessfully = true;
75 }
76 // check if update view after execute step
77 if (testStep->updateView()) {
78 applicationWindow->getViewNet()->handle(this, FXSEL(SEL_PAINT, 0), nullptr);
79 }
81 }
82 // check if print netedit closed sucessfully
83 if (writeClosedSucessfully) {
84 std::cout << "TestFunctions: Netedit closed successfully" << std::endl;
85 }
86}
87
88
89bool
91 return myRunning;
92}
93
94/****************************************************************************/
The main window of Netedit.
GNEViewNet * getViewNet()
get pointer to viewNet
bool isRunning() const
check if test is running
bool myRunning
flag to indicate if test is running
GNEInternalTest()=delete
Invalidated default constructor.
~GNEInternalTest()
destructor
void runNeteditInternalTests(GNEApplicationWindow *applicationWindow)
run netedit internal test
GNEViewParent * getViewParent() const
get the net object
std::vector< InternalTestStep * > myTestSteps
test steps
size_t myCurrentStep
current step index