tests: Prevent tests from crashing when manager is invalid (#9)

This commit is contained in:
Zach DeCook 2024-03-21 11:21:43 -04:00 committed by GitHub
parent e3694ecf2f
commit 8a874fc49c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -9,6 +9,10 @@ int main(int argc, char** argv) {
printf("mgr null\n"); printf("mgr null\n");
return 1; return 1;
} }
if (!hyprcursor_manager_valid(mgr)) {
printf("mgr is invalid\n");
return 1;
}
struct hyprcursor_cursor_style_info info = {.size = 48}; struct hyprcursor_cursor_style_info info = {.size = 48};
if (!hyprcursor_load_theme_style(mgr, info)) { if (!hyprcursor_load_theme_style(mgr, info)) {

View File

@ -4,8 +4,12 @@
int main(int argc, char** argv) { int main(int argc, char** argv) {
Hyprcursor::CHyprcursorManager mgr(nullptr); 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 // preload size 48 for testing
if (!mgr.loadThemeStyle(style)) { if (!mgr.loadThemeStyle(style)) {
std::cout << "failed loading style\n"; std::cout << "failed loading style\n";