Compare commits

...

3 Commits

Author SHA1 Message Date
Almamu
8bfbf8ecf1 chore: only compile Catch2 if a testing build is requested and run cmake on any branch after tests 2025-05-17 05:20:04 +02:00
Almamu
9f0bdd50e2 chore: added catch2 + github actions for testing 2025-05-17 04:57:59 +02:00
Almamu
be0fc25e72 chore: better error reporting for parameters, highlighting --help usage. fixess #303 and should improve #275
Some checks failed
CMake / build-x11 (ubuntu-22.04) (push) Has been cancelled
CMake / build-x11 (ubuntu-24.04) (push) Has been cancelled
CMake / build-x11-wayland (ubuntu-22.04) (push) Has been cancelled
CMake / build-x11-wayland (ubuntu-24.04) (push) Has been cancelled
CMake / build-wayland (ubuntu-22.04) (push) Has been cancelled
CMake / build-wayland (ubuntu-24.04) (push) Has been cancelled
2025-05-17 03:23:05 +02:00
15 changed files with 372 additions and 115 deletions

View File

@ -1,31 +0,0 @@
---
name: Background doesn't load properly
about: Use this to report backgrounds that are not loading (cannot find files, black
image, effects not working, etc)
title: "[BGFIX]"
labels: bug
assignees: Almamu
---
**Wallpaper Engine Background(s)**
Link(s) to the background(s) in the steam workshop or their background ID(s).
**Console output**
When a background cannot be loaded, it's usually due to some unexpected error that is logged into the terminal. Please attach the program's output so we can properly debug it if needed.
**Screenshots**
If you have any screenshot of it working on Windows that'll help so we can compare both outputs
**Desktop (please complete the following information):**
- OS: [e.g. Arch Linux]
- Desktop Environment: [e.g. GNOME, CINNAMON, KDE...]
- Window Manager: [if in doubt, just leave it empty]
**Additional context**
Any additional information about your setup

58
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: "Bug Report"
description: "Report a bug or unexpected behavior."
labels: [bug]
body:
- type: markdown
attributes:
value: |
Please fill out this form to report a bug.
- type: input
id: summary
attributes:
label: Bug Summary
description: Briefly describe the bug.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to Reproduce
description: Step-by-step instructions to reproduce the bug.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
validations:
required: false
- type: textarea
id: actual
attributes:
label: Actual Behavior / Logs
validations:
required: false
- type: input
id: os
attributes:
label: Operating System and Version
validations:
required: true
- type: input
id: de
attributes:
label: Desktop Environment (GNOME, KDE, etc.)
validations:
required: true
- type: input
id: x11_wayland
attributes:
label: Display Server (X11/Wayland)
validations:
required: true
- type: textarea
id: extra
attributes:
label: Additional Context or Screenshots
validations:
required: false

View File

@ -0,0 +1,46 @@
name: "Wallpaper Compatibility Issue"
description: "Report a problem with a specific Wallpaper Engine wallpaper."
labels: [compatibility, wallpaper]
body:
- type: input
id: wallpaper
attributes:
label: Wallpaper Name, URL or ID
validations:
required: true
- type: textarea
id: issue
attributes:
label: Describe the Issue
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
validations:
required: false
- type: textarea
id: logs
attributes:
label: Logs or Crash Output
validations:
required: false
- type: input
id: os
attributes:
label: Operating System and Version
validations:
required: true
- type: input
id: de
attributes:
label: Desktop Environment (GNOME, KDE, etc.)
validations:
required: true
- type: input
id: x11_wayland
attributes:
label: Display Server (X11/Wayland)
validations:
required: true

View File

@ -0,0 +1,32 @@
name: "Feature Request"
description: "Propose a new feature or enhancement."
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Use this form to suggest new features or improvements.
- type: textarea
id: feature
attributes:
label: Describe the Feature
validations:
required: true
- type: textarea
id: problem
attributes:
label: Problem this Feature Addresses (if any)
validations:
required: false
- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
validations:
required: false
- type: textarea
id: context
attributes:
label: Additional Context or Mockups
validations:
required: false

View File

@ -0,0 +1,38 @@
name: "Installation/Usage Help"
description: "Request help with installing or using linux-wallpaperengine."
labels: [question, support]
body:
- type: markdown
attributes:
value: |
Need help? Fill this out so we can assist you better.
- type: textarea
id: issue
attributes:
label: What are you trying to do, and what's the problem?
validations:
required: true
- type: textarea
id: attempted
attributes:
label: What have you tried so far?
validations:
required: false
- type: textarea
id: error_logs
attributes:
label: Errors or Log Output
validations:
required: false
- type: input
id: system
attributes:
label: OS, Desktop Environment, X11/Wayland
validations:
required: true
- type: input
id: install_method
attributes:
label: Installation Method (e.g., AUR, Flatpak, build from source)
validations:
required: true

View File

@ -1,10 +0,0 @@
---
name: Other issues
about: Use this to report general issues with the software
title: ''
labels: ''
assignees: Almamu
---

22
.github/ISSUE_TEMPLATE/refactor.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: "Code Cleanup / Refactor"
description: "Suggest internal improvements like refactoring or technical debt cleanup."
labels: [refactor, maintenance]
body:
- type: textarea
id: what
attributes:
label: What needs improvement?
validations:
required: true
- type: textarea
id: why
attributes:
label: Why is this necessary or beneficial?
validations:
required: false
- type: textarea
id: impact
attributes:
label: Potential Impact on Users
validations:
required: false

View File

@ -1,20 +1,18 @@
name: CMake name: CMake
on: on:
workflow_run:
workflows: [tests]
types: [completed]
workflow_dispatch:
push: push:
paths: paths:
- 'src/**'
- 'CMakeModules/**'
- CMakeLists.txt
- 'protocols/**' - 'protocols/**'
branches: [ "main" ] branches: [main]
pull_request: pull_request:
paths: paths:
- 'src/**'
- 'CMakeModules/**'
- CMakeLists.txt
- 'protocols/**' - 'protocols/**'
branches: [ "main" ] branches: [main]
env: env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)

52
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: Unit tests
on:
push:
paths:
- 'src/**'
- 'CMakeModules/**'
- CMakeLists.txt
branches: [main]
workflow_dispatch:
pull_request:
paths:
- 'src/**'
- 'CMakeModules/**'
- CMakeLists.txt
branches: [main]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
testing:
strategy:
matrix:
os: [ubuntu-24.04]
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
if: matrix.os == 'ubuntu-24.04'
run: sudo apt-get update && sudo apt-get -y install libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv2 libfftw3-dev
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=On
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Run tests
# Run the unit tests available
run: ${{github.workspace}}/build/output/tests

4
.gitmodules vendored
View File

@ -26,3 +26,7 @@
path = src/External/argparse path = src/External/argparse
url = https://github.com/p-ranav/argparse.git url = https://github.com/p-ranav/argparse.git
branch = master branch = master
[submodule "src/External/Catch2"]
path = src/External/Catch2
url = https://github.com/catchorg/Catch2.git
branch = devel

View File

@ -116,7 +116,9 @@ add_subdirectory(src/External/glslang-WallpaperEngine glslang)
add_subdirectory(src/External/SPIRV-Cross-WallpaperEngine spirv-cross) add_subdirectory(src/External/SPIRV-Cross-WallpaperEngine spirv-cross)
add_subdirectory(src/External/kissfft kissfft) add_subdirectory(src/External/kissfft kissfft)
add_subdirectory(src/External/argparse argparse) add_subdirectory(src/External/argparse argparse)
if(BUILD_TESTING)
add_subdirectory(src/External/Catch2)
endif()
# try to enable wayland builds when possible # try to enable wayland builds when possible
pkg_check_modules(WAYLAND_SUPPORT wayland-cursor wayland-protocols egl wayland-egl) pkg_check_modules(WAYLAND_SUPPORT wayland-cursor wayland-protocols egl wayland-egl)
@ -247,6 +249,13 @@ include_directories(
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
${X11_INCLUDES}) ${X11_INCLUDES})
if(BUILD_TESTING)
add_executable(
tests
src/WallpaperEngine/Testing/Cases/Example.cpp
)
endif()
add_executable( add_executable(
linux-wallpaperengine linux-wallpaperengine
src/main.cpp src/main.cpp
@ -535,6 +544,30 @@ target_link_libraries (linux-wallpaperengine PUBLIC
libcef_dll_wrapper libcef_dll_wrapper
argparse) argparse)
if (BUILD_TESTING)
target_link_libraries (tests PRIVATE
Catch2::Catch2WithMain PUBLIC
${OPENGL_LIBRARIES}
${GLEW_LIBRARIES}
${GLUT_LIBRARIES}
${ZLIB_LIBRARIES}
${LZ4_LIBRARY}
${SDL2_LIBRARIES}
${FFMPEG_LIBRARIES}
${MPV_LIBRARY}
${PULSEAUDIO_LIBRARY}
${WAYLAND_LIBRARIES}
${X11_LIBRARIES}
kissfft
glslang
spirv-cross-core
spirv-cross-glsl
glfw
libcef_lib
libcef_dll_wrapper
argparse)
endif()
COPY_FILES(linux-wallpaperengine "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${TARGET_OUTPUT_DIRECTORY}") COPY_FILES(linux-wallpaperengine "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${TARGET_OUTPUT_DIRECTORY}")
COPY_FILES(linux-wallpaperengine "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${TARGET_OUTPUT_DIRECTORY}") COPY_FILES(linux-wallpaperengine "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${TARGET_OUTPUT_DIRECTORY}")
# remove the vulkan lib as chromium includes a broken libvulkan.so.1 with it # remove the vulkan lib as chromium includes a broken libvulkan.so.1 with it

1
src/External/Catch2 vendored Submodule

@ -0,0 +1 @@
Subproject commit 74fcff6e5b190fb833a231b7f7c1829e3c3ac54d

View File

@ -255,10 +255,11 @@ CApplicationContext::CApplicationContext (int argc, char* argv []) :
" Runs the background 2317494988 on two screens, one on HDMI-1 and the other on HDMI-2\n\n" " Runs the background 2317494988 on two screens, one on HDMI-1 and the other on HDMI-2\n\n"
); );
try {
program.parse_known_args (argc, argv); program.parse_known_args (argc, argv);
if (this->settings.general.defaultBackground.empty ()) { if (this->settings.general.defaultBackground.empty ()) {
throw std::runtime_error ("No default background specified. Either --bg/-b or <background id> must be specified"); throw std::runtime_error ("At least one background ID must be specified");
} }
this->settings.audio.volume = std::max(0, std::min (this->settings.audio.volume, 128)); this->settings.audio.volume = std::max(0, std::min (this->settings.audio.volume, 128));
@ -293,6 +294,9 @@ CApplicationContext::CApplicationContext (int argc, char* argv []) :
this->settings.screenshot.take = false; this->settings.screenshot.take = false;
this->settings.render.pauseOnFullscreen = false; this->settings.render.pauseOnFullscreen = false;
#endif /* DEMOMODE */ #endif /* DEMOMODE */
} catch (const std::runtime_error& e) {
throw std::runtime_error (std::string (e.what()) + ". Use " + std::string (argv[0]) + " --help for more information");
}
} }
int CApplicationContext::getArgc () const { int CApplicationContext::getArgc () const {

View File

@ -0,0 +1,5 @@
#include <catch2/catch_test_macros.hpp>
TEST_CASE ("Example test") {
REQUIRE (true);
}

View File

@ -20,6 +20,7 @@ void initLogging () {
} }
int main (int argc, char* argv[]) { int main (int argc, char* argv[]) {
try {
// if type parameter is specified, this is a subprocess, so no logging should be enabled from our side // if type parameter is specified, this is a subprocess, so no logging should be enabled from our side
bool enableLogging = true; bool enableLogging = true;
std::string typeZygote = "--type=zygote"; std::string typeZygote = "--type=zygote";
@ -63,4 +64,8 @@ int main (int argc, char* argv[]) {
delete app; delete app;
return 0; return 0;
} catch (const std::exception& e) {
std::cerr << e.what () << std::endl;
return 1;
}
} }