From 77b5373c6b576b28a52da1710387c9155307b605 Mon Sep 17 00:00:00 2001 From: James Holderness Date: Tue, 25 Jun 2024 21:52:19 +0100 Subject: [PATCH] Add unit tests. --- src/terminal/adapter/ut_adapter/adapterTest.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/terminal/adapter/ut_adapter/adapterTest.cpp b/src/terminal/adapter/ut_adapter/adapterTest.cpp index 44274d66a7d..da5a7c93cb2 100644 --- a/src/terminal/adapter/ut_adapter/adapterTest.cpp +++ b/src/terminal/adapter/ut_adapter/adapterTest.cpp @@ -3377,10 +3377,23 @@ class AdapterTest TEST_METHOD(WindowManipulationTypeTests) { + // Our pixel size reports are based on a virtual cell size of 10x20 pixels + // for compatibility with the VT240 and VT340 graphic terminals. + const auto cellSize = til::size{ 10, 20 }; + _testGetSet->PrepData(); - _pDispatch->WindowManipulation(DispatchTypes::WindowManipulationType::ReportTextSizeInCharacters, NULL, NULL); const auto [textBuffer, viewport, _] = _testGetSet->GetBufferAndViewport(); - const std::wstring expectedResponse = fmt::format(L"\033[8;{};{}t", viewport.height(), textBuffer.GetSize().Width()); + + _pDispatch->WindowManipulation(DispatchTypes::WindowManipulationType::ReportTextSizeInCharacters, NULL, NULL); + std::wstring expectedResponse = fmt::format(L"\033[8;{};{}t", viewport.height(), textBuffer.GetSize().Width()); + _testGetSet->ValidateInputEvent(expectedResponse.c_str()); + + _pDispatch->WindowManipulation(DispatchTypes::WindowManipulationType::ReportTextSizeInPixels, NULL, NULL); + expectedResponse = fmt::format(L"\033[4;{};{}t", viewport.height() * cellSize.height, textBuffer.GetSize().Width() * cellSize.width); + _testGetSet->ValidateInputEvent(expectedResponse.c_str()); + + _pDispatch->WindowManipulation(DispatchTypes::WindowManipulationType::ReportCharacterCellSize, NULL, NULL); + expectedResponse = fmt::format(L"\033[6;{};{}t", cellSize.height, cellSize.width); _testGetSet->ValidateInputEvent(expectedResponse.c_str()); }