mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-07-10 04:20:23 +02:00
## Summary of the Pull Request `TrigModeSettingsTest` fails under cultures using `,` as decimal separator (e.g., `de-DE`, `fr-FR`). Two root causes: the C++ calculator engine's `ToWStringFullPrecision` doesn't pin the stream locale, and the test classes don't set a deterministic thread culture. ## PR Checklist - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated ## Detailed Description of the Pull Request / Additional comments **C++ locale fix** — `ExprtkEvaluator.cpp`: `std::wostringstream` defaults to the global C++ locale, which can be changed to the system locale by the runtime. Pin it to `std::locale::classic()` so the decimal separator is always `.` across the WinRT boundary: ```cpp std::wostringstream oss; oss.imbue(std::locale::classic()); oss << std::fixed << std::setprecision(15) << value; ``` **Test culture setup** — `QueryTests.cs`, `QueryHelperTests.cs`: Added `TestInitialize`/`TestCleanup` to set thread culture to `en-US`, matching the existing pattern across all TimeDate test classes. **Non-English culture test cases** — New `TrigModeSettingsTest_NonEnglishCulture` parameterized over `de-DE` and `fr-FR` verifies `outputUseEnglishFormat: true` produces `.`-separated output regardless of `CurrentCulture`. ## Validation Steps Performed - Code review passed with no actionable findings (naming convention matches existing TimeDate test pattern across 7+ files) - New `TrigModeSettingsTest_NonEnglishCulture` test exercises the exact failure scenario from the issue --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: niels9001 <9866362+niels9001@users.noreply.github.com>