Skip to content

Commit 8bb1f8d

Browse files
committed
修复自动构建失败
1 parent 27f3616 commit 8bb1f8d

5 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎.github/workflows/build-and-release.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
run: cmake --build build/${{ matrix.display_name }} --config Release --target CodexUsage CodexUsageTests
6767

6868
- name: Test
69+
if: matrix.display_name != 'arm64'
6970
run: ctest --test-dir build/${{ matrix.display_name }} -C Release --output-on-failure
7071

7172
- name: Package

‎CMakeLists.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,9 @@ add_executable(CodexUsageTests
8585

8686
target_link_libraries(CodexUsageTests PRIVATE CodexUsageCore)
8787

88+
if(MSVC)
89+
target_compile_options(CodexUsageTests PRIVATE /utf-8)
90+
endif()
91+
8892
enable_testing()
8993
add_test(NAME CodexUsageTests COMMAND CodexUsageTests)

‎src/CodexUsageCore.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ std::wstring BuildUsageTooltip(const UsageSnapshot& snapshot) {
127127
return L"Codex Usage error: " + snapshot.errorMessage;
128128
}
129129

130-
std::wstring text = L"Codex: 5小时剩余 " + FormatRemainingPercent(snapshot.fiveHour.remainingPercent);
131-
text += L"(" + FormatResetAfter(snapshot.fiveHour.resetAfterSeconds) + L"后重置)";
132-
text += L" / 本周剩余 " + FormatRemainingPercent(snapshot.weekly.remainingPercent);
133-
text += L"(" + FormatResetAfter(snapshot.weekly.resetAfterSeconds) + L"后重置)";
130+
std::wstring text = L"Codex: 5\u5c0f\u65f6\u5269\u4f59 " + FormatRemainingPercent(snapshot.fiveHour.remainingPercent);
131+
text += L"(" + FormatResetAfter(snapshot.fiveHour.resetAfterSeconds) + L"\u540e\u91cd\u7f6e)";
132+
text += L" / \u672c\u5468\u5269\u4f59 " + FormatRemainingPercent(snapshot.weekly.remainingPercent);
133+
text += L"(" + FormatResetAfter(snapshot.weekly.resetAfterSeconds) + L"\u540e\u91cd\u7f6e)";
134134
return text;
135135
}

‎src/CodexUsagePlugin.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ class CodexUsagePlugin final : public ITMPlugin {
130130
}
131131

132132
CodexUsageFetcher fetcher_;
133-
CodexUsageItem fiveHourItem_{CodexUsageItem::Window::FiveHour, L"Codex 5h Remaining", L"CodexUsage5h", L"5小时: "};
134-
CodexUsageItem weeklyItem_{CodexUsageItem::Window::Weekly, L"Codex Weekly Remaining", L"CodexUsageWeek", L"本 周: "};
133+
CodexUsageItem fiveHourItem_{CodexUsageItem::Window::FiveHour, L"Codex 5h Remaining", L"CodexUsage5h", L"5\u5c0f\u65f6: "};
134+
CodexUsageItem weeklyItem_{CodexUsageItem::Window::Weekly, L"Codex Weekly Remaining", L"CodexUsageWeek", L"\u672c \u5468: "};
135135
mutable std::mutex mutex_;
136136
UsageSnapshot snapshot_;
137137
std::wstring tooltip_ = L"Codex Usage: waiting for data";

‎tests/CodexUsageCoreTests.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ void BuildsSingleLineSuccessTooltip() {
8282
const std::wstring tooltip = BuildUsageTooltip(snapshot);
8383

8484
AssertNotContains(tooltip, L'\n', "success tooltip should stay on one line");
85-
AssertEqual(tooltip, L"Codex: 5小时剩余 77%(1h 0m后重置) / 本周剩余 39%(1d 0h后重置)", "compact success tooltip");
85+
AssertEqual(
86+
tooltip,
87+
L"Codex: 5\u5c0f\u65f6\u5269\u4f59 77%(1h 0m\u540e\u91cd\u7f6e) / \u672c\u5468\u5269\u4f59 39%(1d 0h\u540e\u91cd\u7f6e)",
88+
"compact success tooltip");
8689
}
8790

8891
void HasGeneratedVersion() {

0 commit comments

Comments
 (0)