[PR #13316] Extend test coverage of TestDbcsWriteRead #29473

Open
opened 2026-01-31 09:35:08 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/13316

State: closed
Merged: Yes


TestDbcsWriteRead failed to properly test all text input scenarios.
In order to write wide characters with CHAR_INFO structs using the W APIs
one must still repeat the CHAR_INFO twice, once with COMMON_LVB_LEADING_BYTE
and once with COMMON_LVB_TRAILING_BYTE set in the attributes. This is because
CHAR_INFO APIs are column oriented. TestDbcsWriteRead on the other hand
only tested the scenario of sending wide characters without those flags.

This commit fixes the problem by introducing a UnicodeDoubled mode and
increases the number of test patterns from 14 to 17. Due to the existing
code having been written with the false assumption in mind, a simpler
modification resulted in +1100 LOC. As such I opted to rewrite the code instead
and replaced the potentially buggy output generators with static arrays.

Code page 437 tests were removed, as it contains no DBCS characters anyways.

This is preliminary work for #8000.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/13316 **State:** closed **Merged:** Yes --- `TestDbcsWriteRead` failed to properly test all text input scenarios. In order to write wide characters with `CHAR_INFO` structs using the `W` APIs one must still repeat the `CHAR_INFO` twice, once with `COMMON_LVB_LEADING_BYTE` and once with `COMMON_LVB_TRAILING_BYTE` set in the attributes. This is because `CHAR_INFO` APIs are column oriented. `TestDbcsWriteRead` on the other hand only tested the scenario of sending wide characters without those flags. This commit fixes the problem by introducing a `UnicodeDoubled` mode and increases the number of test patterns from 14 to 17. Due to the existing code having been written with the false assumption in mind, a simpler modification resulted in +1100 LOC. As such I opted to rewrite the code instead and replaced the potentially buggy output generators with static arrays. Code page 437 tests were removed, as it contains no DBCS characters anyways. This is preliminary work for #8000.
claunia added the pull-request label 2026-01-31 09:35:08 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29473