-
-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3345 from khaneliman/testing
Organize tests and start Hyprland testing
- Loading branch information
Showing
20 changed files
with
259 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ concurrency: | |
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
distro: | ||
- alpine | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
[wrap-file] | ||
directory = spdlog-1.11.0 | ||
source_url = https://github.com/gabime/spdlog/archive/v1.11.0.tar.gz | ||
source_filename = v1.11.0.tar.gz | ||
source_hash = ca5cae8d6cac15dae0ec63b21d6ad3530070650f68076f3a4a862ca293a858bb | ||
patch_filename = spdlog_1.11.0-2_patch.zip | ||
patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.11.0-2/get_patch | ||
patch_hash = db1364fe89502ac67f245a6c8c51290a52afd74a51eed26fa9ecb5b3443df57a | ||
wrapdb_version = 1.11.0-2 | ||
directory = spdlog-1.12.0 | ||
source_url = https://github.com/gabime/spdlog/archive/refs/tags/v1.12.0.tar.gz | ||
source_filename = spdlog-1.12.0.tar.gz | ||
source_hash = 4dccf2d10f410c1e2feaff89966bfc49a1abb29ef6f08246335b110e001e09a9 | ||
patch_filename = spdlog_1.12.0-2_patch.zip | ||
patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.12.0-2/get_patch | ||
patch_hash = 9596972d1eb2e0a69cea4a53273ca7bbbcb9b2fa872cd734864fc7232dc2d573 | ||
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.12.0-2/spdlog-1.12.0.tar.gz | ||
wrapdb_version = 1.12.0-2 | ||
|
||
[provide] | ||
spdlog = spdlog_dep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[ | ||
{ | ||
"height": 20, | ||
"layer": "bottom", | ||
"output": [ | ||
"HDMI-0", | ||
"DP-0" | ||
], | ||
"hyprland/workspaces": { | ||
"active-only": true, | ||
"all-outputs": false, | ||
"show-special": true, | ||
"move-to-monitor": true, | ||
"format": "{icon} {windows}", | ||
"format-window-separator": " ", | ||
"format-icons": { | ||
"1": "", | ||
"2": "", | ||
"3": "", | ||
"default": "", | ||
"empty": "", | ||
"urgent": "" | ||
}, | ||
"persistent-workspaces": { | ||
"1": "HDMI-0" | ||
}, | ||
"on-scroll-down": "hyprctl dispatch workspace e-1", | ||
"on-scroll-up": "hyprctl dispatch workspace e+1", | ||
"window-rewrite": { | ||
"title<Steam>": "" | ||
}, | ||
"window-rewrite-default": "", | ||
"window-rewrite-separator": " ", | ||
"sort-by": "number" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include <cstdlib> | ||
#if __has_include(<catch2/catch_test_macros.hpp>) | ||
#include <catch2/catch_test_macros.hpp> | ||
#else | ||
#include <catch2/catch.hpp> | ||
#endif | ||
|
||
#include "fixtures/IPCTestFixture.hpp" | ||
#include "modules/hyprland/backend.hpp" | ||
|
||
namespace fs = std::filesystem; | ||
namespace hyprland = waybar::modules::hyprland; | ||
|
||
TEST_CASE_METHOD(IPCTestFixture, "XDGRuntimeDirExists", "[getSocketFolder]") { | ||
// Test case: XDG_RUNTIME_DIR exists and contains "hypr" directory | ||
// Arrange | ||
tempDir = fs::temp_directory_path() / "hypr_test/run/user/1000"; | ||
fs::path expectedPath = tempDir / "hypr" / instanceSig; | ||
fs::create_directories(tempDir / "hypr" / instanceSig); | ||
setenv("XDG_RUNTIME_DIR", tempDir.c_str(), 1); | ||
|
||
// Act | ||
fs::path actualPath = getSocketFolder(instanceSig); | ||
|
||
// Assert expected result | ||
REQUIRE(actualPath == expectedPath); | ||
} | ||
|
||
TEST_CASE_METHOD(IPCTestFixture, "XDGRuntimeDirDoesNotExist", "[getSocketFolder]") { | ||
// Test case: XDG_RUNTIME_DIR does not exist | ||
// Arrange | ||
unsetenv("XDG_RUNTIME_DIR"); | ||
fs::path expectedPath = fs::path("/tmp") / "hypr" / instanceSig; | ||
|
||
// Act | ||
fs::path actualPath = getSocketFolder(instanceSig); | ||
|
||
// Assert expected result | ||
REQUIRE(actualPath == expectedPath); | ||
} | ||
|
||
TEST_CASE_METHOD(IPCTestFixture, "XDGRuntimeDirExistsNoHyprDir", "[getSocketFolder]") { | ||
// Test case: XDG_RUNTIME_DIR exists but does not contain "hypr" directory | ||
// Arrange | ||
fs::path tempDir = fs::temp_directory_path() / "hypr_test/run/user/1000"; | ||
fs::create_directories(tempDir); | ||
setenv("XDG_RUNTIME_DIR", tempDir.c_str(), 1); | ||
fs::path expectedPath = fs::path("/tmp") / "hypr" / instanceSig; | ||
|
||
// Act | ||
fs::path actualPath = getSocketFolder(instanceSig); | ||
|
||
// Assert expected result | ||
REQUIRE(actualPath == expectedPath); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "modules/hyprland/backend.hpp" | ||
|
||
namespace fs = std::filesystem; | ||
namespace hyprland = waybar::modules::hyprland; | ||
|
||
class IPCTestFixture : public hyprland::IPC { | ||
public: | ||
IPCTestFixture() : IPC() { IPC::socketFolder_ = ""; } | ||
~IPCTestFixture() { fs::remove_all(tempDir); } | ||
|
||
protected: | ||
const char* instanceSig = "instance_sig"; | ||
fs::path tempDir = fs::temp_directory_path() / "hypr_test"; | ||
|
||
private: | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
test_inc = include_directories('../../include') | ||
|
||
test_dep = [ | ||
catch2, | ||
fmt, | ||
gtkmm, | ||
jsoncpp, | ||
spdlog, | ||
] | ||
|
||
test_src = files( | ||
'../main.cpp', | ||
'backend.cpp', | ||
'../../src/modules/hyprland/backend.cpp' | ||
) | ||
|
||
hyprland_test = executable( | ||
'hyprland_test', | ||
test_src, | ||
dependencies: test_dep, | ||
include_directories: test_inc, | ||
) | ||
|
||
test( | ||
'hyprland', | ||
hyprland_test, | ||
workdir: meson.project_source_root(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.