hyprcursor/tests/test.cpp

36 lines
No EOL
893 B
C++

#include <iostream>
#include <hyprcursor/hyprcursor.hpp>
int main(int argc, char** argv) {
Hyprcursor::CHyprcursorManager mgr(nullptr);
Hyprcursor::SCursorStyleInfo style{.size = 48};
// preload size 48 for testing
if (!mgr.loadThemeStyle(style)) {
std::cout << "failed loading style\n";
return 1;
}
// get cursor for left_ptr
const auto SHAPEDATA = mgr.getShape("left_ptr", style);
if (SHAPEDATA.images.empty()) {
std::cout << "no images\n";
return 1;
}
std::cout << "hyprcursor returned " << SHAPEDATA.images.size() << " images\n";
// save to disk
const auto RET = cairo_surface_write_to_png(SHAPEDATA.images[0].surface, "/tmp/arrow.png");
std::cout << "Cairo returned for write: " << RET << "\n";
mgr.cursorSurfaceStyleDone(style);
if (RET)
return 1;
return !mgr.valid();
}