Skip to content

Commit aca862e

Browse files
committed
[QtTestDriver] QtTest steps for examples
1 parent 5d13d7a commit aca862e

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

examples/Calc/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
2020
add_executable(BoostCalculatorSteps features/step_definitions/BoostCalculatorSteps)
2121
target_link_libraries(BoostCalculatorSteps Calc ${CUKE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
2222
endif()
23+
24+
if(Qt5TEST_FOUND)
25+
add_executable(QtTestCalculatorSteps features/step_definitions/QtTestCalculatorSteps)
26+
target_link_libraries(QtTestCalculatorSteps Calc Qt5::Test ${CUKE_LIBRARIES})
27+
endif()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include <QTest>
2+
// Pretend to be GTest
3+
#define EXPECT_EQ QCOMPARE
4+
#include "CalculatorSteps.cpp"

examples/CalcQt/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@ if(QT_LIBRARIES)
99
add_executable(calcqt src/CalcQt.cpp)
1010
target_link_libraries(calcqt libcalcqt ${QT_LIBRARIES})
1111

12+
if(Qt5TEST_FOUND)
13+
add_executable(QtTestCalculatorQtSteps features/step_definitions/QtTestCalculatorQtSteps)
14+
target_link_libraries(QtTestCalculatorQtSteps PRIVATE libcalcqt ${QT_LIBRARIES} ${CUKE_LIBRARIES})
15+
endif()
16+
1217
if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
1318
add_executable(BoostCalculatorQtSteps features/step_definitions/BoostCalculatorQtSteps)
1419
target_link_libraries(BoostCalculatorQtSteps libcalcqt ${CUKE_LIBRARIES} ${QT_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
1520
endif()
21+
1622
if(GTEST_FOUND)
1723
add_executable(GTestCalculatorQtSteps features/step_definitions/GTestCalculatorQtSteps)
1824
target_link_libraries(GTestCalculatorQtSteps libcalcqt ${CUKE_LIBRARIES} ${CUKE_GTEST_LIBRARIES} ${QT_LIBRARIES})
1925
endif()
26+
2027
endif()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include <QTest>
2+
// Pretend to be GTest
3+
#define EXPECT_EQ QCOMPARE
4+
#include "CalculatorQtSteps.cpp"

travis.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ fi
5050

5151
for TEST in \
5252
build/examples/Calc/GTestCalculatorSteps \
53+
build/examples/Calc/QtTestCalculatorSteps \
5354
build/examples/Calc/BoostCalculatorSteps \
5455
build/examples/Calc/FuncArgsCalculatorSteps \
5556
; do
@@ -63,6 +64,7 @@ done
6364

6465
for TEST in \
6566
build/examples/CalcQt/GTestCalculatorQtSteps \
67+
build/examples/CalcQt/QtTestCalculatorQtSteps \
6668
build/examples/CalcQt/BoostCalculatorQtSteps \
6769
; do
6870
if [ -f "${TEST}" -a -n "${DISPLAY:-}" ]; then

0 commit comments

Comments
 (0)