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 (getCurrentStep()) {
51 // get current step and set next step
52 const auto testStep = setNextStep();
53 // check if we have to process it in main windows, abstract view or specific view
54 if (testStep->getCategory() == InternalTestStep::Category::APP) {
55 applicationWindow->handle(this, testStep->getSelector(), testStep->getEvent());
56 } else if (testStep->getCategory() == InternalTestStep::Category::VIEW) {
57 viewNet->handle(this, testStep->getSelector(), testStep->getEvent());
58 } else if (testStep->getCategory() == InternalTestStep::Category::TLS_PHASES) {
59 viewParent->getTLSEditorFrame()->getTLSPhases()->handle(this, testStep->getSelector(), testStep->getEvent());
60 } else if (testStep->getCategory() == InternalTestStep::Category::TLS_PHASETABLE) {
61 viewParent->getTLSEditorFrame()->getTLSPhases()->getPhaseTable()->testTable(testStep->getTLSTableTest());
62 } else if (testStep->getCategory() == InternalTestStep::Category::INIT) {
63 writeClosedSucessfully = true;
64 }
65 // check if update view after execute step
66 if (testStep->updateView()) {
67 viewNet->handle(this, FXSEL(SEL_PAINT, 0), nullptr);
68 }
69 }
70 // check if print netedit closed sucessfully
71 if (writeClosedSucessfully) {
72 std::cout << "TestFunctions: Netedit closed successfully" << std::endl;
73 }
74}
75
76/****************************************************************************/
The main window of Netedit.
GNEViewNet * getViewNet()
get pointer to viewNet
GNEInternalTest()=delete
Invalidated default constructor.
~GNEInternalTest()
destructor
void runNeteditInternalTests(GNEApplicationWindow *applicationWindow)
run netedit internal test
GNEViewParent * getViewParent() const
get the net object
InternalTestStep * getCurrentStep() const
get current step
bool myRunning
flag to indicate if test is running
InternalTestStep * setNextStep()
get current step and set next step