| 17 | #include <string.h> |
| 18 | |
| 19 | int main(int argc, char** argv) |
| 20 | { |
| 21 | const char* device_node = (argc > 1) ? argv[1] : "/dev/uinput"; |
| 22 | int width = (argc > 2) ? atoi(argv[2]) : 1920; |
| 23 | int height = (argc > 3) ? atoi(argv[3]) : 1080; |
| 24 | |
| 25 | printf("=== KWinControlUnit Integration Test ===\n"); |
| 26 | printf("Device node : %s\n", device_node); |
| 27 | printf("Resolution : %dx%d\n", width, height); |
| 28 | printf("Version : %s\n\n", MaaKWinControlUnitGetVersion()); |
| 29 | |
| 30 | /* 1. Create */ |
| 31 | MaaKWinControlUnitHandle handle = MaaKWinControlUnitCreate(device_node, width, height, false); |
| 32 | if (!handle) { |
| 33 | fprintf(stderr, "FAIL: MaaKWinControlUnitCreate returned NULL\n"); |
| 34 | return 1; |
| 35 | } |
| 36 | printf("[PASS] MaaKWinControlUnitCreate\n"); |
| 37 | |
| 38 | /* 2. Connect (opens /dev/uinput + establishes PipeWire screencast session) */ |
| 39 | MaaBool connected = MaaKWinControlUnitConnect(handle); |
| 40 | if (!connected) { |
| 41 | fprintf(stderr, "FAIL: MaaKWinControlUnitConnect returned false\n"); |
| 42 | MaaKWinControlUnitDestroy(handle); |
| 43 | return 1; |
| 44 | } |
| 45 | printf("[PASS] MaaKWinControlUnitConnect\n"); |
| 46 | |
| 47 | /* 3. Test screencap (capture one frame via PipeWire) */ |
| 48 | MaaBool screencap_ok = MaaKWinControlUnitTestScreencap(handle); |
| 49 | if (!screencap_ok) { |
| 50 | fprintf(stderr, "FAIL: MaaKWinControlUnitTestScreencap returned false\n"); |
| 51 | MaaKWinControlUnitDestroy(handle); |
| 52 | return 1; |
| 53 | } |
| 54 | printf("[PASS] MaaKWinControlUnitTestScreencap\n"); |
| 55 | |
| 56 | /* 4. Cleanup */ |
| 57 | MaaKWinControlUnitDestroy(handle); |
| 58 | printf("\n=== All tests PASSED ===\n"); |
| 59 | return 0; |
| 60 | } |
nothing calls this directly
no test coverage detected