Skip to content

Commit

Permalink
Adapt the test.
Browse files Browse the repository at this point in the history
  • Loading branch information
miniksa committed Feb 4, 2020
1 parent d3aa56c commit f31a3c1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/host/ft_host/API_FillOutputTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ class FillOutputTests
BEGIN_TEST_CLASS(FillOutputTests)
END_TEST_CLASS()

// Adapted from repro in GH#4258
TEST_METHOD(FillWithInvalidCharacterA)
{
VERIFY_WIN32_BOOL_SUCCEEDED(SetConsoleOutputCP(50220));
auto handle = GetStdOutputHandle();
const COORD pos{ 0, 0 };
DWORD written = 0;
const char originalCh = 14;
VERIFY_WIN32_BOOL_SUCCEEDED(FillConsoleOutputCharacterA(handle, originalCh, 1, pos, &written));
VERIFY_ARE_EQUAL(1u, written);

char readCh = 42; // don't use null (the expected) or 14 (the actual) to ensure that it is read out.
DWORD read = 0;
VERIFY_WIN32_BOOL_SUCCEEDED(ReadConsoleOutputCharacterA(handle, &readCh, 1, pos, &read));
VERIFY_ARE_EQUAL(1u, read);
VERIFY_ARE_EQUAL(0, readCh, L"Null should be read back as the conversion from the invalid original character.");
}

TEST_METHOD(WriteNarrowGlyphAscii)
{
HANDLE hConsole = GetStdOutputHandle();
Expand Down

0 comments on commit f31a3c1

Please sign in to comment.