Skip to content

Commit

Permalink
Add unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
j4james committed Jul 2, 2024
1 parent dea00fb commit 77b5373
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/terminal/adapter/ut_adapter/adapterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down

0 comments on commit 77b5373

Please sign in to comment.