diff --git a/src/terminal/adapter/ut_adapter/adapterTest.cpp b/src/terminal/adapter/ut_adapter/adapterTest.cpp index fe836e2f12ee..e97ca42e8c2e 100644 --- a/src/terminal/adapter/ut_adapter/adapterTest.cpp +++ b/src/terminal/adapter/ut_adapter/adapterTest.cpp @@ -1684,6 +1684,40 @@ class AdapterTest _testGetSet->ValidateInputEvent(L"\033P0$r\033\\"); } + TEST_METHOD(RequestModeTests) + { + BEGIN_TEST_METHOD_PROPERTIES() + TEST_METHOD_PROPERTY(L"Data:modeNumber", L"{1, 3, 5, 6, 8, 12, 25, 40, 66, 67, 1000, 1002, 1003, 1004, 1005, 1006, 1007, 1049, 9001}") + END_TEST_METHOD_PROPERTIES() + + VTInt modeNumber; + VERIFY_SUCCEEDED_RETURN(TestData::TryGetValue(L"modeNumber", modeNumber)); + const auto mode = DispatchTypes::DECPrivateMode(modeNumber); + + if (mode == DispatchTypes::DECCOLM_SetNumberOfColumns) + { + Log::Comment(L"Make sure DECCOLM is allowed"); + VERIFY_IS_TRUE(_pDispatch->SetMode(DispatchTypes::XTERM_EnableDECCOLMSupport)); + } + + Log::Comment(NoThrowString().Format(L"Setting private mode %d", modeNumber)); + _testGetSet->PrepData(); + VERIFY_IS_TRUE(_pDispatch->SetMode(mode)); + VERIFY_IS_TRUE(_pDispatch->RequestMode(mode)); + + wchar_t expectedResponse[20]; + swprintf_s(expectedResponse, ARRAYSIZE(expectedResponse), L"\x1b[?%d;1$y", modeNumber); + _testGetSet->ValidateInputEvent(expectedResponse); + + Log::Comment(NoThrowString().Format(L"Resetting private mode %d", modeNumber)); + _testGetSet->PrepData(); + VERIFY_IS_TRUE(_pDispatch->ResetMode(mode)); + VERIFY_IS_TRUE(_pDispatch->RequestMode(mode)); + + swprintf_s(expectedResponse, ARRAYSIZE(expectedResponse), L"\x1b[?%d;2$y", modeNumber); + _testGetSet->ValidateInputEvent(expectedResponse); + } + TEST_METHOD(CursorKeysModeTest) { Log::Comment(L"Starting test...");