Skip to content

Commit

Permalink
Remove color tables from the VT render engines that are no longer nee…
Browse files Browse the repository at this point in the history
…ded.
  • Loading branch information
j4james committed Jun 16, 2020
1 parent 8cad1d1 commit 1e1579a
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 100 deletions.
3 changes: 1 addition & 2 deletions src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ class TerminalCoreUnitTests::ConptyRoundtripTests final
Viewport initialViewport = currentBuffer.GetViewport();

auto vtRenderEngine = std::make_unique<Xterm256Engine>(std::move(hFile),
initialViewport,
gci.Get16ColorTable());
initialViewport);
auto pfn = std::bind(&ConptyRoundtripTests::_writeCallback, this, std::placeholders::_1, std::placeholders::_2);
vtRenderEngine->SetTestCallback(pfn);

Expand Down
8 changes: 2 additions & 6 deletions src/host/VtIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,25 +160,21 @@ VtIo::VtIo() :
{
case VtIoMode::XTERM_256:
_pVtRenderEngine = std::make_unique<Xterm256Engine>(std::move(_hOutput),
initialViewport,
gci.Get16ColorTable());
initialViewport);
break;
case VtIoMode::XTERM:
_pVtRenderEngine = std::make_unique<XtermEngine>(std::move(_hOutput),
initialViewport,
gci.Get16ColorTable(),
false);
break;
case VtIoMode::XTERM_ASCII:
_pVtRenderEngine = std::make_unique<XtermEngine>(std::move(_hOutput),
initialViewport,
gci.Get16ColorTable(),
true);
break;
case VtIoMode::WIN_TELNET:
_pVtRenderEngine = std::make_unique<WinTelnetEngine>(std::move(_hOutput),
initialViewport,
gci.Get16ColorTable());
initialViewport);
break;
default:
return E_FAIL;
Expand Down
3 changes: 1 addition & 2 deletions src/host/ut_host/ConptyOutputTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class ConptyOutputTests
Viewport initialViewport = currentBuffer.GetViewport();

auto vtRenderEngine = std::make_unique<Xterm256Engine>(std::move(hFile),
initialViewport,
gci.Get16ColorTable());
initialViewport);
auto pfn = std::bind(&ConptyOutputTests::_writeCallback, this, std::placeholders::_1, std::placeholders::_2);
vtRenderEngine->SetTestCallback(pfn);

Expand Down
44 changes: 10 additions & 34 deletions src/host/ut_host/VtIoTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ void VtIoTests::DtorTestJustEngine()
L"It's here because of the strange nature of VtEngine having members\n"
L"that are only defined in UNIT_TESTING"));

const WORD colorTableSize = 16;
COLORREF colorTable[colorTableSize];

Log::Comment(NoThrowString().Format(
L"New some engines and delete them"));
for (int i = 0; i < 25; ++i)
Expand All @@ -112,28 +109,28 @@ void VtIoTests::DtorTestJustEngine()

wil::unique_hfile hOutputFile;
hOutputFile.reset(INVALID_HANDLE_VALUE);
auto pRenderer256 = new Xterm256Engine(std::move(hOutputFile), SetUpViewport(), colorTable);
auto pRenderer256 = new Xterm256Engine(std::move(hOutputFile), SetUpViewport());
Log::Comment(NoThrowString().Format(L"Made Xterm256Engine"));
delete pRenderer256;
Log::Comment(NoThrowString().Format(L"Deleted."));

hOutputFile.reset(INVALID_HANDLE_VALUE);

auto pRenderEngineXterm = new XtermEngine(std::move(hOutputFile), SetUpViewport(), colorTable, false);
auto pRenderEngineXterm = new XtermEngine(std::move(hOutputFile), SetUpViewport(), false);
Log::Comment(NoThrowString().Format(L"Made XtermEngine"));
delete pRenderEngineXterm;
Log::Comment(NoThrowString().Format(L"Deleted."));

hOutputFile.reset(INVALID_HANDLE_VALUE);

auto pRenderEngineXtermAscii = new XtermEngine(std::move(hOutputFile), SetUpViewport(), colorTable, true);
auto pRenderEngineXtermAscii = new XtermEngine(std::move(hOutputFile), SetUpViewport(), true);
Log::Comment(NoThrowString().Format(L"Made XtermEngine"));
delete pRenderEngineXtermAscii;
Log::Comment(NoThrowString().Format(L"Deleted."));

hOutputFile.reset(INVALID_HANDLE_VALUE);

auto pRenderEngineWinTelnet = new WinTelnetEngine(std::move(hOutputFile), SetUpViewport(), colorTable);
auto pRenderEngineWinTelnet = new WinTelnetEngine(std::move(hOutputFile), SetUpViewport());
Log::Comment(NoThrowString().Format(L"Made WinTelnetEngine"));
delete pRenderEngineWinTelnet;
Log::Comment(NoThrowString().Format(L"Deleted."));
Expand All @@ -148,9 +145,6 @@ void VtIoTests::DtorTestDeleteVtio()
L"It's here because of the strange nature of VtEngine having members\n"
L"that are only defined in UNIT_TESTING"));

const WORD colorTableSize = 16;
COLORREF colorTable[colorTableSize];

Log::Comment(NoThrowString().Format(
L"New some engines and delete them"));
for (int i = 0; i < 25; ++i)
Expand All @@ -165,8 +159,7 @@ void VtIoTests::DtorTestDeleteVtio()
VtIo* vtio = new VtIo();
Log::Comment(NoThrowString().Format(L"Made VtIo"));
vtio->_pVtRenderEngine = std::make_unique<Xterm256Engine>(std::move(hOutputFile),
SetUpViewport(),
colorTable);
SetUpViewport());
Log::Comment(NoThrowString().Format(L"Made Xterm256Engine"));
delete vtio;
Log::Comment(NoThrowString().Format(L"Deleted."));
Expand All @@ -176,7 +169,6 @@ void VtIoTests::DtorTestDeleteVtio()
Log::Comment(NoThrowString().Format(L"Made VtIo"));
vtio->_pVtRenderEngine = std::make_unique<XtermEngine>(std::move(hOutputFile),
SetUpViewport(),
colorTable,
false);
Log::Comment(NoThrowString().Format(L"Made XtermEngine"));
delete vtio;
Expand All @@ -187,7 +179,6 @@ void VtIoTests::DtorTestDeleteVtio()
Log::Comment(NoThrowString().Format(L"Made VtIo"));
vtio->_pVtRenderEngine = std::make_unique<XtermEngine>(std::move(hOutputFile),
SetUpViewport(),
colorTable,
true);
Log::Comment(NoThrowString().Format(L"Made XtermEngine"));
delete vtio;
Expand All @@ -197,8 +188,7 @@ void VtIoTests::DtorTestDeleteVtio()
vtio = new VtIo();
Log::Comment(NoThrowString().Format(L"Made VtIo"));
vtio->_pVtRenderEngine = std::make_unique<WinTelnetEngine>(std::move(hOutputFile),
SetUpViewport(),
colorTable);
SetUpViewport());
Log::Comment(NoThrowString().Format(L"Made WinTelnetEngine"));
delete vtio;
Log::Comment(NoThrowString().Format(L"Deleted."));
Expand All @@ -213,9 +203,6 @@ void VtIoTests::DtorTestStackAlloc()
L"It's here because of the strange nature of VtEngine having members\n"
L"that are only defined in UNIT_TESTING"));

const WORD colorTableSize = 16;
COLORREF colorTable[colorTableSize];

Log::Comment(NoThrowString().Format(
L"make some engines and let them fall out of scope"));
for (int i = 0; i < 25; ++i)
Expand All @@ -229,16 +216,14 @@ void VtIoTests::DtorTestStackAlloc()
{
VtIo vtio;
vtio._pVtRenderEngine = std::make_unique<Xterm256Engine>(std::move(hOutputFile),
SetUpViewport(),
colorTable);
SetUpViewport());
}

hOutputFile.reset(INVALID_HANDLE_VALUE);
{
VtIo vtio;
vtio._pVtRenderEngine = std::make_unique<XtermEngine>(std::move(hOutputFile),
SetUpViewport(),
colorTable,
false);
}

Expand All @@ -247,16 +232,14 @@ void VtIoTests::DtorTestStackAlloc()
VtIo vtio;
vtio._pVtRenderEngine = std::make_unique<XtermEngine>(std::move(hOutputFile),
SetUpViewport(),
colorTable,
true);
}

hOutputFile.reset(INVALID_HANDLE_VALUE);
{
VtIo vtio;
vtio._pVtRenderEngine = std::make_unique<WinTelnetEngine>(std::move(hOutputFile),
SetUpViewport(),
colorTable);
SetUpViewport());
}
}
}
Expand All @@ -269,9 +252,6 @@ void VtIoTests::DtorTestStackAllocMany()
L"It's here because of the strange nature of VtEngine having members\n"
L"that are only defined in UNIT_TESTING"));

const WORD colorTableSize = 16;
COLORREF colorTable[colorTableSize];

Log::Comment(NoThrowString().Format(
L"Try an make a whole bunch all at once, and have them all fall out of scope at once."));
for (int i = 0; i < 25; ++i)
Expand All @@ -284,28 +264,24 @@ void VtIoTests::DtorTestStackAllocMany()
hOutputFile.reset(INVALID_HANDLE_VALUE);
VtIo vtio1;
vtio1._pVtRenderEngine = std::make_unique<Xterm256Engine>(std::move(hOutputFile),
SetUpViewport(),
colorTable);
SetUpViewport());

hOutputFile.reset(INVALID_HANDLE_VALUE);
VtIo vtio2;
vtio2._pVtRenderEngine = std::make_unique<XtermEngine>(std::move(hOutputFile),
SetUpViewport(),
colorTable,
false);

hOutputFile.reset(INVALID_HANDLE_VALUE);
VtIo vtio3;
vtio3._pVtRenderEngine = std::make_unique<XtermEngine>(std::move(hOutputFile),
SetUpViewport(),
colorTable,
true);

hOutputFile.reset(INVALID_HANDLE_VALUE);
VtIo vtio4;
vtio4._pVtRenderEngine = std::make_unique<WinTelnetEngine>(std::move(hOutputFile),
SetUpViewport(),
colorTable);
SetUpViewport());
}
}
}
Expand Down
Loading

0 comments on commit 1e1579a

Please sign in to comment.