Skip to content

Commit d2644df

Browse files
committed
fix: repair ci portability issues
1 parent 6541713 commit d2644df

5 files changed

Lines changed: 19 additions & 9 deletions

File tree

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# robot-cpp
22

3-
![Build](https://github.com/developer239/robot-cpp/actions/workflows/build.yml/badge.svg)
4-
[![macOS Tests](https://github.com/developer239/robot-cpp/actions/workflows/test-macos.yml/badge.svg)](https://github.com/developer239/robot-cpp/actions/workflows/test-macos.yml)
5-
[![Windows Tests](https://github.com/developer239/robot-cpp/actions/workflows/test-windows.yml/badge.svg)](https://github.com/developer239/robot-cpp/actions/workflows/test-windows.yml)
3+
[![Linux (GCC 14)](https://github.com/developer239/robot-cpp/actions/workflows/ci.yml/badge.svg)](https://github.com/developer239/robot-cpp/actions/workflows/ci.yml)
4+
[![macOS (Apple Clang)](https://github.com/developer239/robot-cpp/actions/workflows/ci.yml/badge.svg)](https://github.com/developer239/robot-cpp/actions/workflows/ci.yml)
5+
[![Windows (MSVC)](https://github.com/developer239/robot-cpp/actions/workflows/ci.yml/badge.svg)](https://github.com/developer239/robot-cpp/actions/workflows/ci.yml)
6+
[![Sanitizers (ASan + UBSan)](https://github.com/developer239/robot-cpp/actions/workflows/ci.yml/badge.svg)](https://github.com/developer239/robot-cpp/actions/workflows/ci.yml)
67

78
robot-cpp is a C++23 library for programmatic keyboard, mouse, and screen control on macOS, Windows, and Linux. It injects synthetic input, captures the screen at native resolution, and records and replays global input events, all behind a single `Session` object that owns the platform backend and reports what it can and cannot do in the current environment.
89

examples/type_text.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ int main() {
2323

2424
// Layout-independent Unicode text, including characters absent from a US
2525
// keyboard.
26-
if (auto r = keyboard.typeText("Hello, \u4e16\u754c! \U0001F642\n"); !r) {
26+
if (auto r = keyboard.typeText(
27+
"Hello, \xE4\xB8\x96\xE7\x95\x8C! \xF0\x9F\x99\x82\n"
28+
);
29+
!r) {
2730
std::println("typeText failed: {}", r.error().message);
2831
return 1;
2932
}
@@ -37,4 +40,4 @@ int main() {
3740
}
3841

3942
return 0;
40-
}
43+
}

src/platform/linux/UinputBackend.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <cmath>
88
#include <cstring>
9+
#include <memory>
910

1011
#include "LinuxEvdevKeymap.h" // Key -> evdev KEY_* codes (declared below).
1112

src/platform/linux/UinputBackend.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <memory>
4+
35
#include "robot/backend/IKeyboardBackend.h"
46
#include "robot/backend/IMouseBackend.h"
57

@@ -55,4 +57,4 @@ class UinputBackend final : public backend::IKeyboardBackend,
5557
int fd_ = -1;
5658
};
5759

58-
} // namespace robot::linux_uinput
60+
} // namespace robot::linux_uinput

tests/unit/Utf8Tests.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ TEST(Utf8, DecodesAsciiAndMultibyte) {
2121
MockPlatformBackend backend;
2222
Keyboard keyboard(backend.keyboard());
2323

24-
// "Aé中🙂": 1-, 2-, 3-, and 4-byte sequences in one string.
25-
const auto result = keyboard.typeText("A\u00e9\u4e2d\U0001F642");
24+
// "Aé中🙂": 1-, 2-, 3-, and 4-byte UTF-8 sequences in one string.
25+
// Keep the input byte-explicit so MSVC does not transcode the narrow literal
26+
// through the active source code page.
27+
const std::string input = "A\xC3\xA9\xE4\xB8\xAD\xF0\x9F\x99\x82";
28+
const auto result = keyboard.typeText(input);
2629
ASSERT_TRUE(result.has_value());
2730

2831
const auto codes = typed(backend.log());
@@ -55,4 +58,4 @@ TEST(Utf8, RejectsOverlongEncoding) {
5558
}
5659

5760
} // namespace
58-
} // namespace robot::test
61+
} // namespace robot::test

0 commit comments

Comments
 (0)