Skip to content

Commit

Permalink
tests: Prevent tests from crashing when manager is invalid (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
earboxer authored Mar 21, 2024
1 parent e3694ec commit 8a874fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ int main(int argc, char** argv) {
printf("mgr null\n");
return 1;
}
if (!hyprcursor_manager_valid(mgr)) {
printf("mgr is invalid\n");
return 1;
}

struct hyprcursor_cursor_style_info info = {.size = 48};
if (!hyprcursor_load_theme_style(mgr, info)) {
Expand Down
6 changes: 5 additions & 1 deletion tests/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
int main(int argc, char** argv) {
Hyprcursor::CHyprcursorManager mgr(nullptr);

Hyprcursor::SCursorStyleInfo style{.size = 48};
if (!mgr.valid()) {
std::cout << "mgr is invalid\n";
return 1;
}

Hyprcursor::SCursorStyleInfo style{.size = 48};
// preload size 48 for testing
if (!mgr.loadThemeStyle(style)) {
std::cout << "failed loading style\n";
Expand Down

0 comments on commit 8a874fc

Please sign in to comment.