diff --git a/.github/workflows/theme.yml b/.github/workflows/theme.yml index 7a8906e..eeca16c 100644 --- a/.github/workflows/theme.yml +++ b/.github/workflows/theme.yml @@ -25,3 +25,26 @@ jobs: - name: Checking our Python imports. run: | scripts/theme.sh + + theme-cpp: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] # TODO: Restore macos-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Checking our Python imports. + shell: bash + run: | + mkdir -p dist + cd dist + if [[ "${RUNNER_OS}" == "Windows" ]]; then + cl ../scripts/test_theme.cpp /std:c++17 /EHsc /link Advapi32.lib OleAut32.lib + ./test_theme + elif [[ "${RUNNER_OS}" == "macOS" ]]; then + clang++ ../scripts/test_theme.cpp -o test_theme -std=c++17 + ./test_theme + else + g++ ../scripts/test_theme.cpp -o test_theme -std=c++17 + ./test_theme + fi diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 6c9a86b..855b7a2 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -1,6 +1,6 @@ name: Ui -on: [push] +on: [workflow_dispatch] jobs: ui: diff --git a/example/breeze_theme.hpp b/example/breeze_theme.hpp index 75c61d7..f51b964 100644 --- a/example/breeze_theme.hpp +++ b/example/breeze_theme.hpp @@ -6,7 +6,7 @@ * * This code has been minimally tested but should be useful on most platforms. * This makes extensive use of C++17 features. On Windows, this requires adding - * `OleAut32.lib` to the linker. + * `OleAut32.lib` and `Advapi32.lib` to the linker. * * This currently supports: * - Windows diff --git a/scripts/headless.sh b/scripts/headless.sh index eaf797a..1c8dd37 100755 --- a/scripts/headless.sh +++ b/scripts/headless.sh @@ -48,6 +48,8 @@ for script in example/*.py; do done # now we need to run our tests +# NOTE: We run each test separately just because it simplifies the logic. +# Some tests don't work in headless mode so we skip them. widgets=$(${PYTHON} -c "import os; os.chdir('test'); import ui; print(' '.join([i[5:] for i in dir(ui) if i.startswith('test_')]))") for widget in ${widgets[@]}; do for framework in "${frameworks[@]}"; do diff --git a/scripts/test_theme.cpp b/scripts/test_theme.cpp new file mode 100644 index 0000000..a9f2fae --- /dev/null +++ b/scripts/test_theme.cpp @@ -0,0 +1,15 @@ +/** + * Example to test our theme detection works at the C++ level. +*/ + +#include +#include "../example/breeze_theme.hpp" + +int main() +{ + std::cout << "Theme: " << static_cast(breeze_stylesheets::get_theme()) << std::endl; + std::cout << "Is Dark: " << breeze_stylesheets::is_dark() << std::endl; + std::cout << "Is Light: " << breeze_stylesheets::is_light() << std::endl; + + return 0; +}