hyprcursor/tests/test.cpp

28 lines
732 B
C++
Raw Normal View History

2024-03-07 04:19:38 +01:00
#include <iostream>
#include <hyprcursor.hpp>
int main(int argc, char** argv) {
Hyprcursor::CHyprcursorManager mgr(nullptr);
2024-03-07 15:50:48 +01:00
// preload size 48 for testing
if (!mgr.loadThemeStyle(Hyprcursor::SCursorStyleInfo{.size = 48})) {
std::cout << "failed loading style\n";
return 1;
}
// get cursor for left_ptr
2024-03-07 17:01:45 +01:00
const auto SHAPEDATA = mgr.getShape("left_ptr", Hyprcursor::SCursorStyleInfo{.size = 48});
if (SHAPEDATA.images.empty())
return 1;
2024-03-07 04:19:38 +01:00
// save to disk
2024-03-07 17:01:45 +01:00
const auto RET = cairo_surface_write_to_png(SHAPEDATA.images[0].surface, "/tmp/arrow.png");
2024-03-07 04:19:38 +01:00
std::cout << "Cairo returned for write: " << RET << "\n";
2024-03-07 16:10:45 +01:00
if (RET)
return 1;
2024-03-07 04:19:38 +01:00
return !mgr.valid();
}