Skip to content
Snippets Groups Projects
Commit aa163ca0 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

First GUI functional test

parent 155b781e
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,6 @@ add_subdirectory(Tests/UnitTests/TestCore) ...@@ -37,7 +37,6 @@ add_subdirectory(Tests/UnitTests/TestCore)
add_subdirectory(ThirdParty/RootMinimizers) add_subdirectory(ThirdParty/RootMinimizers)
add_subdirectory(Fit) add_subdirectory(Fit)
add_subdirectory(Tests/UnitTests/TestFit) add_subdirectory(Tests/UnitTests/TestFit)
add_subdirectory(Tests/FunctionalTests) # functional tests (make check)
if(ROOT_FOUND AND BORNAGAIN_APP) if(ROOT_FOUND AND BORNAGAIN_APP)
add_subdirectory(App) add_subdirectory(App)
...@@ -47,8 +46,10 @@ if(BORNAGAIN_GUI) ...@@ -47,8 +46,10 @@ if(BORNAGAIN_GUI)
add_subdirectory(GUI) add_subdirectory(GUI)
endif() endif()
add_subdirectory(Tests/FunctionalTests) # functional tests (make check)
if(BORNAGAIN_MAN) if(BORNAGAIN_MAN)
add_subdirectory(Doc/UserManual) add_subdirectory(Doc/UserManual)
endif() endif()
add_subdirectory(cmake) # trick to print the message add_subdirectory(cmake) # trick to print the message
......
...@@ -15,3 +15,6 @@ add_subdirectory(externals/qcustomplot) ...@@ -15,3 +15,6 @@ add_subdirectory(externals/qcustomplot)
add_subdirectory(externals/qtpropertybrowser) add_subdirectory(externals/qtpropertybrowser)
add_subdirectory(coregui) add_subdirectory(coregui)
add_subdirectory(main) add_subdirectory(main)
set(BornAgainGUI_INCLUDE_DIRS ${BornAgainGUI_INCLUDE_DIRS} PARENT_SCOPE)
set(BornAgainGUI_LIBRARY ${BornAgainGUI_LIBRARY} PARENT_SCOPE)
...@@ -99,12 +99,9 @@ qt5_use_modules(${library_name} Widgets Core Gui Script Designer PrintSupport) ...@@ -99,12 +99,9 @@ qt5_use_modules(${library_name} Widgets Core Gui Script Designer PrintSupport)
include_directories( include_directories(
${qcustomplot_INCLUDE_DIRS} ${qcustomplot_INCLUDE_DIRS}
${qtpropertybrowser_INCLUDE_DIRS} ${qtpropertybrowser_INCLUDE_DIRS}
# ${GQt_INCLUDE_DIRS}
# ${QtRoot_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${BornAgainCore_INCLUDE_DIRS} ${BornAgainCore_INCLUDE_DIRS}
${BornAgainFit_INCLUDE_DIRS} ${BornAgainFit_INCLUDE_DIRS}
# ${ROOT_INCLUDE_DIR}
${ManhattanStyle_INCLUDE_DIRS} ${ManhattanStyle_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}
...@@ -122,8 +119,6 @@ target_link_libraries(${library_name} ...@@ -122,8 +119,6 @@ target_link_libraries(${library_name}
) )
# --- Installation --- # --- Installation ---
#install (TARGETS ${executable_name} DESTINATION ${destination_bin} COMPONENT Applications)
install (TARGETS ${library_name} DESTINATION ${destination_lib} COMPONENT Libraries) install (TARGETS ${library_name} DESTINATION ${destination_lib} COMPONENT Libraries)
# system libraries: ROOT installation # system libraries: ROOT installation
......
...@@ -30,7 +30,7 @@ class GUIObjectBuilder : public ISampleVisitor ...@@ -30,7 +30,7 @@ class GUIObjectBuilder : public ISampleVisitor
{ {
public: public:
GUIObjectBuilder(); GUIObjectBuilder();
~GUIObjectBuilder(){} virtual ~GUIObjectBuilder(){}
ParameterizedItem *populateSampleModel(SessionModel *sampleModel, ParameterizedItem *populateSampleModel(SessionModel *sampleModel,
ISample *sample); ISample *sample);
......
...@@ -7,7 +7,7 @@ endif() ...@@ -7,7 +7,7 @@ endif()
set(executable_name BornAgain) set(executable_name BornAgain)
include_directories( include_directories(
${CMAKE_SOURCE_DIR}/GUI/coregui/mainwindow ${BornAgainGUI_INCLUDE_DIRS}
${ManhattanStyle_INCLUDE_DIRS} ${ManhattanStyle_INCLUDE_DIRS}
) )
......
...@@ -19,10 +19,10 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/T ...@@ -19,10 +19,10 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/T
#COPY_IF_DIFFERENT( ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit ${SRC_FILES} IncludeTargets "Includes") #COPY_IF_DIFFERENT( ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit ${SRC_FILES} IncludeTargets "Includes")
if(BORNAGAIN_GUI) if(BORNAGAIN_GUI)
# add_subdirectory(TestGUI) add_subdirectory(TestGUI)
endif() endif()
#add_subdirectory(TestCore) add_subdirectory(TestCore)
#add_subdirectory(TestFit) #add_subdirectory(TestFit)
#if(BORNAGAIN_PYTHON) #if(BORNAGAIN_PYTHON)
# add_subdirectory(TestPyCore) # add_subdirectory(TestPyCore)
......
...@@ -6,31 +6,31 @@ set(CMAKE_CXX_FLAGS "-DSTANDALONE") ...@@ -6,31 +6,31 @@ set(CMAKE_CXX_FLAGS "-DSTANDALONE")
set(list_of_tests set(list_of_tests
"IsGISAXS01" "IsGISAXS01"
"IsGISAXS02" # "IsGISAXS02"
"IsGISAXS03BA" # "IsGISAXS03BA"
"IsGISAXS03DWBA" # "IsGISAXS03DWBA"
"IsGISAXS03BAsize" # "IsGISAXS03BAsize"
"IsGISAXS041DDL" # "IsGISAXS041DDL"
"IsGISAXS042DDL" # "IsGISAXS042DDL"
"IsGISAXS06L1" # "IsGISAXS06L1"
"IsGISAXS06L2" # "IsGISAXS06L2"
"IsGISAXS06L3" # "IsGISAXS06L3"
"IsGISAXS06L4" # "IsGISAXS06L4"
"IsGISAXS07" # "IsGISAXS07"
"IsGISAXS08a" # "IsGISAXS08a"
"IsGISAXS08b" # "IsGISAXS08b"
"IsGISAXS09a" # "IsGISAXS09a"
"IsGISAXS09b" # "IsGISAXS09b"
"IsGISAXS10" # "IsGISAXS10"
"IsGISAXS11" # "IsGISAXS11"
"IsGISAXS15" # "IsGISAXS15"
"FormFactors" # "FormFactors"
"MesoCrystal1" # "MesoCrystal1"
"PolDWBAMagCylinders1" # "PolDWBAMagCylinders1"
"PolDWBAMagCylinders2" # "PolDWBAMagCylinders2"
"LayerRoughness" # "LayerRoughness"
"Ripple2" # "Ripple2"
"Ripple1" # "Ripple1"
) )
# for some reason these flags doesn't propagated here by SetUpWindows.cmake # for some reason these flags doesn't propagated here by SetUpWindows.cmake
......
...@@ -2,7 +2,30 @@ ...@@ -2,7 +2,30 @@
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
message("YYY ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}")
#add_subdirectory(GUIExample01) set(list_of_tests
"TestGUI01"
)
# for some reason these flags doesn't propagated here by SetUpWindows.cmake
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /EHsc ")
endif()
include_directories(
${Boost_INCLUDE_DIRS}
${BornAgainCore_INCLUDE_DIRS}
${BornAgainGUI_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${GSL_INCLUDE_DIR}
)
foreach(_test ${list_of_tests})
BORNAGAIN_EXECUTABLE(${_test} LOCATIONS ${_test} EXCLUDE_FROM_ALL LIBRARIES ${BornAgainCore_LIBRARY} ${BornAgainGUI_LIBRARY})
qt5_use_modules(${_test} Widgets Core Gui Script Designer PrintSupport)
BORNAGAIN_ADD_TEST(${_test} INPUT_DIR ${CMAKE_BINARY_DIR}/Tests/ReferenceData/BornAgain/)
endforeach()
cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
set(executable_name GUIExample01)
# --- source and include files ---
set(include_dirs
# ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow
${CMAKE_SOURCE_DIR}/GUI/coregui/utils
${CMAKE_SOURCE_DIR}/GUI/coregui/Models
# ${CMAKE_CURRENT_SOURCE_DIR}/Views
# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/widgetbox
# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/SampleDesigner
# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/JobQueueWidgets
# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/OutputDataWidgets
${CMAKE_SOURCE_DIR}/GUI/coregui/Views/Components/MaterialEditor
# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/InstrumentWidgets
)
include_directories(${include_dirs})
file(GLOB source_files
"*.cpp"
"${CMAKE_SOURCE_DIR}/GUI/coregui/utils/*.cpp"
"${CMAKE_SOURCE_DIR}/GUI/coregui/Models/*.cpp"
# "Views/*.cpp"
# "Views/Components/SampleDesigner/*.cpp"
# "Views/Components/JobQueueWidgets/*.cpp"
# "Views/Components/OutputDataWidgets/*.cpp"
"${CMAKE_SOURCE_DIR}/GUI/coregui/Views/Components/MaterialEditor/*.cpp"
# "Views/Components/InstrumentWidgets/*.cpp"
)
#set(source_widgetbox
# "Views/Components/widgetbox/widgetboxcategorylistview.cpp"
# "Views/Components/widgetbox/widgetboxtreewidget.cpp"
# "Views/Components/widgetbox/widgetbox.cpp"
# "Views/Components/widgetbox/widgetbox_dnditem.cpp"
#)
#list(APPEND source_files ${source_widgetbox})
file(GLOB include_files
# "mainwindow/*.h"
"${CMAKE_SOURCE_DIR}/GUI/coregui/utils/*.h"
"${CMAKE_SOURCE_DIR}/GUI/coregui/Models/*.h"
# "Views/*.h"
# "Views/Components/SampleDesigner/*.h"
# "Views/Components/JobQueueWidgets/*.h"
# "Views/Components/OutputDataWidgets/*.h"
"${CMAKE_SOURCE_DIR}/GUI/coregui/Views/Components/MaterialEditor/*.h"
# "Views/Components/InstrumentWidgets/*.h"
)
#set(include_widgetbox
# "Views/Components/widgetbox/widgetboxcategorylistview.h"
# "Views/Components/widgetbox/widgetboxtreewidget.h"
# "Views/Components/widgetbox/widgetbox.h"
# "Views/Components/widgetbox/widgetbox_dnditem.h"
# "Views/Components/widgetbox/widgetbox_global.h"
#)
#list(APPEND include_files ${include_widgetbox})
#set(resource_files
# "coregui.qrc"
## "qttools/qtpropertybrowser/qtpropertybrowser.qrc"
# "Views/Components/SampleDesigner/SampleDesigner.qrc"
# "Views/Components/widgetbox/widgetbox.qrc"
#)
message("XXX 1.1 ${executable_name} ${source_files} ${include_files}")
set(CMAKE_AUTOMOC ON)
qt5_add_resources(RC_SRCS ${resource_files})
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x040900)
#add_executable(${executable_name} ${source_files} ${RC_SRCS} ${include_files})
add_executable(${executable_name} ${source_files} ${include_files})
qt5_use_modules(${executable_name} Widgets Core Gui Script Designer PrintSupport)
# --- dependencies ---
include_directories(
# ${qcustomplot_INCLUDE_DIRS}
${qtpropertybrowser_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${BornAgainCore_INCLUDE_DIRS}
${BornAgainFit_INCLUDE_DIRS}
# ${ManhattanStyle_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
)
target_link_libraries(${executable_name}
# ${ManhattanStyle_LIBRARY}
# ${qcustomplot_LIBRARY}
${qtpropertybrowser_LIBRARY}
${PYTHON_LIBRARY}
${Boost_LIBRARIES}
${BornAgainCore_LIBRARY}
${BornAgainFit_LIBRARY}
)
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
set(executable_name TestGUI01)
include_directories(
${CMAKE_SOURCE_DIR}/GUI/coregui/mainwindow
${ManhattanStyle_INCLUDE_DIRS}
)
add_executable(${executable_name} TestGUI01.cpp)
target_link_libraries(${executable_name}
${BornAgainCore_LIBRARY}
${BornAgainFit_LIBRARY}
${BornAgainGUI_LIBRARY}
)
#include <iostream>
#include "SimulationRegistry.h"
#include "GUIObjectBuilder.h"
#include "SessionModel.h"
#include "MaterialEditor.h"
#include "MaterialModel.h"
#include "Instrument.h"
#include "DomainObjectBuilder.h"
#include "ParameterizedItem.h"
int test()
{
SimulationRegistry sim_registry;
Simulation *simulation = sim_registry.createSimulation("isgisaxs01");
simulation->runSimulation();
Instrument *instrument = new Instrument(simulation->getInstrument());
ISample *sample = simulation->getSample()->clone();
OutputData<double> *data = simulation->getIntensityData();
std::cout << data->totalSum();
//
SessionModel *sampleModel = new SessionModel(SessionXML::SampleModelTag);
SessionModel *instrumentModel = new SessionModel(SessionXML::InstrumentModelTag);
MaterialModel *materialModel = new MaterialModel();
MaterialEditor *materialEditor = new MaterialEditor(materialModel);
GUIObjectBuilder guiBuilder;
guiBuilder.populateSampleModel(sampleModel, sample);
guiBuilder.populateInstrumentModel(instrumentModel, instrument);
// building sample back
QModelIndex sampleIndex = sampleModel->index(0, 0, QModelIndex());
ParameterizedItem *sampleItem = sampleModel->itemForIndex(sampleIndex);
Q_ASSERT(sampleItem);
DomainObjectBuilder builder;
MultiLayer *new_sample = builder.buildMultiLayer(*sampleItem);
new_sample->printSampleTree();
// building multilayer back
QModelIndex instrumentIndex = instrumentModel->index(0, 0, QModelIndex());
ParameterizedItem *instrumentItem = sampleModel->itemForIndex(instrumentIndex);
Q_ASSERT(sampleItem);
Instrument *new_instrument = builder.buildInstrument(*instrumentItem);
// running simulation again
Simulation *new_simulation = new Simulation;
new_simulation->setSample(*new_sample);
new_simulation->setInstrument(*new_instrument);
new_simulation->runSimulation();
OutputData<double> *new_data = new_simulation->getIntensityData();
std::cout << new_data->totalSum();
return 0;
}
int main()
{
return test();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment