diff options
-rw-r--r-- | Project/MainFrame.cpp | 26 | ||||
-rw-r--r-- | Project/MainFrame.h | 2 | ||||
-rw-r--r-- | Project/main.cpp | 9 |
3 files changed, 34 insertions, 3 deletions
diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp index 249a612..3447ed5 100644 --- a/Project/MainFrame.cpp +++ b/Project/MainFrame.cpp @@ -31,10 +31,10 @@ #include "MainFrame.h" #include "PropertiesData.h" #include "SimulationsSettingsForm.h" +#include "StabilityEventList.h" #include "SyncGenerator.h" #include "SyncMotor.h" #include "Transformer.h" -#include "StabilityEventList.h" #include "Workspace.h" #include "artProvider/ArtMetro.h" @@ -600,3 +600,27 @@ void MainFrame::OnStabilityMenuClick(wxCommandEvent& event) } } } + +int MainFrame::RunPSPTest() +{ + wxMessageOutput::Get()->Printf("Main frame setup OK!\n"); + + // Emulate new project creation + EnableCurrentProjectRibbon(); + + Workspace* newWorkspace = new Workspace(this, wxString::Format(_("New project %d"), m_projectNumber), + this->GetStatusBar(), m_sharedGLContext); + if(!m_sharedGLContext) m_sharedGLContext = newWorkspace->GetOpenGLContext(); + m_workspaceList.push_back(newWorkspace); + + m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true); + m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false); + + m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true); + newWorkspace->Redraw(); + + wxMessageOutput::Get()->Printf("Project creation OK!\n"); + wxMessageOutput::Get()->Printf("Test done!\n"); + + return 0; +} diff --git a/Project/MainFrame.h b/Project/MainFrame.h index 2187909..0e2be07 100644 --- a/Project/MainFrame.h +++ b/Project/MainFrame.h @@ -81,6 +81,8 @@ class MainFrame : public MainFrameBase * @brief Default destructor. */ ~MainFrame(); + + int RunPSPTest(); protected: virtual void OnStabilityDropdown(wxRibbonButtonBarEvent& event); diff --git a/Project/main.cpp b/Project/main.cpp index e064ab5..a9bf579 100644 --- a/Project/main.cpp +++ b/Project/main.cpp @@ -133,13 +133,14 @@ class MainApp : public wxApp //cmdLineParser.SetDesc(cmdLineDesc); cmdLineParser.AddParam("", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL); cmdLineParser.AddSwitch("t", "test", "Run PSP-UFU tests"); + + bool test = false; if(cmdLineParser.Parse() == 0) { wxCmdLineArgs args = cmdLineParser.GetArguments(); for(auto it = args.begin(), itEnd = args.end(); it != itEnd; ++it) { if(it->GetKind() == wxCMD_LINE_PARAM) { openFilePath = it->GetStrVal();} else if(it->GetShortName() == "t") { - wxMessageOutput::Get()->Printf("Test OK!"); - exit(0); + test = true; } } } @@ -149,6 +150,10 @@ class MainApp : public wxApp mainFrame->SetIcon(wxICON(aaaaprogicon)); #endif SetTopWindow(mainFrame); + if(test) { + GetTopWindow()->Show(); + exit(mainFrame->RunPSPTest()); + } return GetTopWindow()->Show(); } |