Skip to content

Commit

Permalink
Enable Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Oct 20, 2021
1 parent 64339ec commit 6363d9c
Show file tree
Hide file tree
Showing 8 changed files with 1,945 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
, extraCmakeConfig: "-DQT_DEFAULT_MAJOR_VERSION=5"
, packageName: ff7tk-continuous-Qt5-linux
, ff7tkInstallPrefix: /usr
, ff7tkTestExport: "export QT_QPA_PLATFORM=minimal"
, ff7tkTestCommand: "ctest --test-dir build/unittests --output-on-failure"
, releasePackage: "ff7tk-continuous-Qt5-linux.tar.xz"
}
- {
Expand All @@ -36,6 +38,8 @@ jobs:
, extraCmakeConfig: "-DQT_DEFAULT_MAJOR_VERSION=6"
, packageName: ff7tk-continuous-Qt6-linux
, ff7tkInstallPrefix: /usr
, ff7tkTestExport: "export QT_QPA_PLATFORM=minimal"
, ff7tkTestCommand: "ctest --test-dir build/unittests --output-on-failure"
, linuxDeployQtPath: "export PATH=$PATH:/opt/Qt/6.2.0/gcc_64/libexec"
, releasePackage: "ff7tk-continuous-Qt6-linux.tar.xz"
}
Expand All @@ -47,6 +51,7 @@ jobs:
, extraCmakeConfig: "-DQT_DEFAULT_MAJOR_VERSION=5"
, packageName: ff7tk-continuous-Qt5-macos
, ff7tkInstallPrefix: ff7tk-continuous-Qt5-macos
, ff7tkTestCommand: "ctest --test-dir build/unittests --output-on-failure"
, releasePackage: "ff7tk-continuous-Qt5-macos.zip"
}
- {
Expand All @@ -57,6 +62,7 @@ jobs:
, extraCmakeConfig: "-DQT_DEFAULT_MAJOR_VERSION=6"
, packageName: ff7tk-continuous-Qt6-macos
, ff7tkInstallPrefix: ff7tk-continuous-Qt6-macos
, ff7tkTestCommand: "ctest --test-dir build/unittests --output-on-failure"
, releasePackage: "ff7tk-continuous-Qt6-macos.zip"
}
- {
Expand All @@ -67,6 +73,7 @@ jobs:
, extraCmakeConfig: "-DZLIB_ROOT=C:/zlib -G Ninja -DQT_DEFAULT_MAJOR_VERSION=5"
, packageName: "ff7tk-continuous-Qt5-win64"
, ff7tkInstallPrefix: ff7tk-continuous-Qt5-win64
, ff7tkTestCommand: "start \"C:/Program Files/CMake/bin/ctest.exe --test-dir ../../unittests --output-on-failure\" -wo D:/a/ff7tk/ff7tk/build/src/data"
, releasePackage: "ff7tk-continuous-Qt5-win64.zip"
}
- {
Expand All @@ -77,6 +84,8 @@ jobs:
, extraCmakeConfig: "-DZLIB_ROOT=C:/zlib -G Ninja -DQT_DEFAULT_MAJOR_VERSION=6"
, packageName: "ff7tk-continuous-Qt6-win64"
, ff7tkInstallPrefix: ff7tk-continuous-Qt6-win64
, ff7tkTestCommand: "start \"C:\Program Files/CMake/bin/ctest.exe --test-dir ../../unittests --output-on-failure\" -wo D:/a/ff7tk/ff7tk/build/src/data"

, releasePackage: "ff7tk-continuous-Qt6-win64.zip"
}
- {
Expand All @@ -87,6 +96,7 @@ jobs:
, extraCmakeConfig: "-DZLIB_ROOT=C:/zlib -G Ninja -DQT_DEFAULT_MAJOR_VERSION=5"
, packageName: "ff7tk-continuous-Qt5-win32"
, ff7tkInstallPrefix: ff7tk-continuous-Qt5-win32
, ff7tkTestCommand: "start \"C:/Program Files/CMake/bin/ctest.exe --test-dir build/unittests --output-on-failure\" -wo D:/a/ff7tk/ff7tk/build/src/data"
, releasePackage: "ff7tk-continuous-Qt5-win32.zip"
}

Expand Down Expand Up @@ -147,6 +157,11 @@ jobs:
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{matrix.config.ff7tkInstallPrefix}} -DWIDGET_GALLERY=ON -DQML_GALLERY=ON -DDOCS=ON ${{matrix.config.extraCmakeConfig}}
cmake --build build --config ${{env.BUILD_TYPE}} -j8
- name: Run UnitTests
run: |
${{ matrix.config.ff7tkTestExport }}
${{ matrix.config.ff7tkTestCommand }}
- name: Install(Linux)
if: runner.os == 'Linux'
run: |
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
option(WIDGET_GALLERY "Build the widget based gallery" OFF)
option(QML_GALLERY "Build the qml based gallery" OFF)
option(DOCS "Build and Install Documents (Requires Doxygen)" OFF)
option(ENABLE_TESTING "Build and run UnitTests" ON)


add_subdirectory(src)
add_subdirectory(lang)
Expand All @@ -68,6 +70,10 @@ if(DOCS)
add_subdirectory(docs)
endif()

if(ENABLE_TESTING)
add_subdirectory(unittests)
endif()

#pkgconfig

configure_file(ff7tk.pc.in ff7tk.pc @ONLY)
Expand Down
14 changes: 14 additions & 0 deletions unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
enable_testing()

find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED NO_MODULE COMPONENTS
Test
)

function (MAKE_TEST NAME FILE LIB)
add_executable( ${NAME} ${FILE} )
target_link_libraries( ${NAME} ${LIB} Qt::Test)
add_test(NAME ${NAME} COMMAND $<TARGET_FILE:${NAME}>)
set_tests_properties(${NAME} PROPERTIES DEPENDS ${LIB})
endfunction()

add_subdirectory(data)
2 changes: 2 additions & 0 deletions unittests/data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MAKE_TEST(FF7Text_Tests FF7Text_test.cpp ff7tk)
MAKE_TEST(FF7Save_Tests FF7Save_test.cpp ff7tk)
Loading

0 comments on commit 6363d9c

Please sign in to comment.