Skip to content

Commit

Permalink
More test cleanup. Make sure viewport doesnt move
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Mar 8, 2022
1 parent 0a1ed70 commit 9453aa5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/cascadia/TerminalCore/TerminalApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,12 +587,6 @@ void Terminal::PopGraphicsRendition()

void Terminal::UseAlternateScreenBuffer()
{
// Short-circuit: do nothing.
if (_inAltBuffer())
{
return;
}

// the new alt buffer is exactly the size of the viewport.
const COORD bufferSize{ _mutableViewport.Dimensions() };
const auto cursorSize = _mainBuffer->GetCursor().GetSize();
Expand Down
10 changes: 8 additions & 2 deletions src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3754,7 +3754,9 @@ void ConptyRoundtripTests::ClearBufferSignal()

void ConptyRoundtripTests::SimpleAltBufferTest()
{
Log::Comment(L"TODO");
Log::Comment(L"A test for entering and exiting the alt buffer, via conpty. "
L"Ensures cursor is in the right place, and contents are "
L"restored accordingly.");
auto& g = ServiceLocator::LocateGlobals();
auto& renderer = *g.pRender;
auto& gci = g.getConsoleInformation();
Expand Down Expand Up @@ -3851,6 +3853,7 @@ void ConptyRoundtripTests::SimpleAltBufferTest()
Log::Comment(L"Painting the frame");
VERIFY_SUCCEEDED(renderer.PaintFrame());
Log::Comment(L"========== Checking the terminal buffer state (InMainBufferBefore) ==========");
VERIFY_ARE_EQUAL(0, term->_GetMutableViewport().Top());
verifyBuffer(*termTb, til::rect{ term->_GetMutableViewport().ToInclusive() }, Frame::InMainBufferBefore);

Log::Comment(L"========== Switch to the alt buffer ==========");
Expand All @@ -3875,6 +3878,7 @@ void ConptyRoundtripTests::SimpleAltBufferTest()
Log::Comment(L"Painting the frame");
VERIFY_SUCCEEDED(renderer.PaintFrame());
Log::Comment(L"========== Checking the terminal buffer state (InAltBufferBefore) ==========");
VERIFY_ARE_EQUAL(0, term->_GetMutableViewport().Top());
verifyBuffer(*termAltTb, til::rect{ term->_GetMutableViewport().ToInclusive() }, Frame::InAltBufferBefore);

Log::Comment(L"========== Add some text to the alt buffer ==========");
Expand All @@ -3886,6 +3890,7 @@ void ConptyRoundtripTests::SimpleAltBufferTest()
VERIFY_SUCCEEDED(renderer.PaintFrame());

Log::Comment(L"========== Checking the terminal buffer state (InAltBufferAfter) ==========");
VERIFY_ARE_EQUAL(0, term->_GetMutableViewport().Top());
verifyBuffer(*termAltTb, til::rect{ term->_GetMutableViewport().ToInclusive() }, Frame::InAltBufferAfter);

Log::Comment(L"========== Back to the main buffer ==========");
Expand All @@ -3897,12 +3902,13 @@ void ConptyRoundtripTests::SimpleAltBufferTest()
VERIFY_SUCCEEDED(renderer.PaintFrame());

Log::Comment(L"========== Checking the terminal buffer state (InMainBufferAfter) ==========");
VERIFY_ARE_EQUAL(0, term->_GetMutableViewport().Top());
verifyBuffer(*termTb, til::rect{ term->_GetMutableViewport().ToInclusive() }, Frame::InMainBufferAfter);
}

void ConptyRoundtripTests::AltBufferToAltBufferTest()
{
Log::Comment(L"TODO");
Log::Comment(L"When we request the alt buffer when we're already in the alt buffer, we should still clear it out and replace it.");
auto& g = ServiceLocator::LocateGlobals();
auto& renderer = *g.pRender;
auto& gci = g.getConsoleInformation();
Expand Down

1 comment on commit 9453aa5

@github-actions

This comment was marked as duplicate.

Please sign in to comment.