Skip to content

Commit

Permalink
Try adding a test, but I can't get the test to repro the original beh…
Browse files Browse the repository at this point in the history
…avior quite right
  • Loading branch information
zadjii-msft committed Jan 29, 2020
1 parent 9b6554b commit 0a98cce
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ class TerminalCoreUnitTests::ConptyRoundtripTests final
TEST_METHOD(WriteTwoLinesUsesNewline);
TEST_METHOD(WriteAFewSimpleLines);

TEST_METHOD(DelayEOLWrap);

private:
bool _writeCallback(const char* const pch, size_t const cch);
void _flushFirstFrame();
Expand Down Expand Up @@ -340,3 +342,56 @@ void ConptyRoundtripTests::WriteAFewSimpleLines()

verifyData(termTb);
}

void ConptyRoundtripTests::DelayEOLWrap()
{
auto& g = ServiceLocator::LocateGlobals();
auto& renderer = *g.pRender;
auto& gci = g.getConsoleInformation();
auto& si = gci.GetActiveOutputBuffer();
auto& hostSm = si.GetStateMachine();
auto& hostTb = si.GetTextBuffer();
auto& termTb = *term->_buffer;

_flushFirstFrame();

for (auto i = 0; i < TerminalViewWidth; i++)
{
hostSm.ProcessString(L"A");
}

auto verifyData0 = [](TextBuffer& tb) {
auto iter = tb.GetCellDataAt({ 0, 0 });
TestUtils::VerifySpanOfText(L"A", iter, 0, 80);
};

verifyData0(hostTb);

expectedOutput.push_back(std::string(80, 'A'));

// TODO:GH#405 - When conpty wrapped lines lands, this will behave
// differently, but this has been verified to test it's current behavior,
// and this change works even with conpty wrapped lines.

expectedOutput.push_back("\x1b[1;80H");
VERIFY_SUCCEEDED(renderer.PaintFrame());

verifyData0(termTb);

hostSm.ProcessString(L"\b");
hostSm.ProcessString(L" ");

auto verifyData1 = [](TextBuffer& tb) {
auto iter = tb.GetCellDataAt({ 0, 0 });
TestUtils::VerifySpanOfText(L"A", iter, 0, 79);
};
verifyData1(hostTb);

// expectedOutput.push_back("\x1b[1;79H");
expectedOutput.push_back("\b");
expectedOutput.push_back(" ");
// expectedOutput.push_back("\x1b[1;80H");

VERIFY_SUCCEEDED(renderer.PaintFrame());
verifyData1(termTb);
}

0 comments on commit 0a98cce

Please sign in to comment.