Skip to content

Commit

Permalink
Test the OMEdit diagrams
Browse files Browse the repository at this point in the history
Renamed RunOMEditTestsuite to RunOMEditTestsuite.sh
Merged the browsing tests
  • Loading branch information
adeas31 committed Nov 13, 2019
1 parent 1694d34 commit b66d30c
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .CI/common.groovy
Expand Up @@ -258,7 +258,7 @@ void buildAndRunOMEditTestsuite(stash) {
echo export OPENMODELICALIBRARY="\${MSYS_WORKSPACE}/build/lib/omlibrary"
echo time make -f Makefile.omdev.mingw \${MAKETHREADS} omedit-testsuite
echo cd build/bin
echo ./RunOMEditTestsuite
echo ./RunOMEditTestsuite.sh
) > buildOMEditTestsuiteWindows.sh
set MSYSTEM=MINGW64
Expand All @@ -280,7 +280,7 @@ void buildAndRunOMEditTestsuite(stash) {
sh "${makeCommand()} -j${numPhysicalCPU()} --output-sync omedit-testsuite" // Builds the OMEdit testsuite
sh label: 'RunOMEditTestsuite', script: '''
cd build/bin
xvfb-run ./RunOMEditTestsuite
xvfb-run ./RunOMEditTestsuite.sh
'''

}
Expand Down
Expand Up @@ -30,7 +30,7 @@

include(../Common/Testsuite.pri)

TARGET = BrowseElectricalAnalogBasic
TARGET = BrowseMSL

SOURCES += ../Common/Util.cpp \
Test.cpp
Expand Down
Expand Up @@ -45,11 +45,27 @@ extern "C" {

OMEDITTEST_MAIN(Test)

void Test::testcase()
/*!
* \brief Test::electricalAnalogBasic
* Browses the Modelica.Electrical.Analog.Basic
*/
void Test::electricalAnalogBasic()
{
if (!Util::expandLibraryTreeItemParentHierarchy(MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->findLibraryTreeItem("Modelica.Electrical.Analog.Basic"))) {
QFAIL("Expanding to Modelica.Electrical.Analog.Basic failed.");
}
MainWindow::instance()->close();
}

/*!
* \brief Test::mediaAir
* Browses the Modelica.Media.Air
*/
void Test::mediaAir()
{
OMEDITTEST_SKIP("Enable this testcase by removing this line once the ticket#5669 (https://trac.openmodelica.org/OpenModelica/ticket/5669) is fixed.");
if (!Util::expandLibraryTreeItemParentHierarchy(MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->findLibraryTreeItem("Modelica.Media.Air"))) {
QFAIL("");
QFAIL("Expanding to Modelica.Media.Air failed.");
}
MainWindow::instance()->close();
}
Expand Up @@ -42,7 +42,8 @@ class Test: public QObject
Q_OBJECT

private slots:
void testcase();
void electricalAnalogBasic();
void mediaAir();
};

#endif // TESTGUI_H
Expand Up @@ -30,7 +30,7 @@

include(../Common/Testsuite.pri)

TARGET = BrowseMediaAirReferenceMoistAir
TARGET = Diagram

SOURCES += ../Common/Util.cpp \
Test.cpp
Expand Down
Expand Up @@ -45,10 +45,24 @@ extern "C" {

OMEDITTEST_MAIN(Test)

void Test::testcase()
/*!
* \brief Test::chuaCircuit
* Browses to Modelica.Electrical.Analog.Examples.ChuaCircuit and loads it diagram view.
*/
void Test::chuaCircuit()
{
if (!Util::expandLibraryTreeItemParentHierarchy(MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->findLibraryTreeItem("Modelica.Electrical.Analog.Basic"))) {
QFAIL("");
LibraryTreeItem *pLibraryTreeItem = MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->findLibraryTreeItem("Modelica.Electrical.Analog.Examples.ChuaCircuit");
if (!pLibraryTreeItem) {
QFAIL("Failed to find Modelica.Electrical.Analog.Examples.ChuaCircuit. Makesure MSL is loaded.");
}
if (!Util::expandLibraryTreeItemParentHierarchy(pLibraryTreeItem)) {
QFAIL("Expanding to Modelica.Electrical.Analog.Examples failed.");
}

// Open the Modelica.Electrical.Analog.Examples.ChuaCircuit diagram.
QModelIndex modelIndex = MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->libraryTreeItemIndex(pLibraryTreeItem);
QModelIndex proxyIndex = MainWindow::instance()->getLibraryWidget()->getLibraryTreeProxyModel()->mapFromSource(modelIndex);
MainWindow::instance()->getLibraryWidget()->getLibraryTreeView()->libraryTreeItemDoubleClicked(proxyIndex);

MainWindow::instance()->close();
}
Expand Up @@ -42,7 +42,7 @@ class Test: public QObject
Q_OBJECT

private slots:
void testcase();
void chuaCircuit();
};

#endif // TESTGUI_H
2 changes: 1 addition & 1 deletion OMEdit/Testsuite/Makefile.omdev.mingw
Expand Up @@ -22,7 +22,7 @@ mkbuilddirs:

install: build
cp -p ../bin/tests/*$(EXE) $(builddir_bin)
cp -p RunOMEditTestsuite $(builddir_bin)
cp -p RunOMEditTestsuite.sh $(builddir_bin)

build: Makefile
$(MAKE) -f Makefile
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/Testsuite/Makefile.unix.in
Expand Up @@ -4,7 +4,7 @@ QMAKE=@QMAKE@

install: build
cp -p ../bin/tests/* @OMBUILDDIR@/bin
cp -p RunOMEditTestsuite @OMBUILDDIR@/bin
cp -p RunOMEditTestsuite.sh @OMBUILDDIR@/bin

build: Makefile OMEditGUI.unix.config.pri
$(MAKE) -f Makefile
Expand Down
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

testcases=( "BrowseElectricalAnalogBasic" "BrowseMediaAirReferenceMoistAir" )
testcases=( "BrowseMSL" "Diagram" )
OMEditTestResults="$PWD/OMEditTestResult"

for i in "${testcases[@]}"
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/Testsuite/Testsuite.pro
Expand Up @@ -30,6 +30,6 @@

TEMPLATE = subdirs

SUBDIRS = BrowseElectricalAnalogBasic \
BrowseMediaAirReferenceMoistAir
SUBDIRS = BrowseMSL \
Diagram

0 comments on commit b66d30c

Please sign in to comment.