@@ -130,6 +130,7 @@ protected ReadLine(ConsoleFixture fixture, ITestOutputHelper output, string lang
130
130
internal virtual bool KeyboardHasGreaterThan => true ;
131
131
internal virtual bool KeyboardHasCtrlRBracket => true ;
132
132
internal virtual bool KeyboardHasCtrlAt => true ;
133
+ internal virtual bool ScreenReaderModeEnabled => false ;
133
134
134
135
static ReadLine ( )
135
136
{
@@ -444,8 +445,13 @@ private void AssertScreenIs(int top, int lines, params object[] items)
444
445
// that shouldn't be and aren't ever set by any code in PSReadLine, so we'll
445
446
// ignore those bits and just check the stuff we do set.
446
447
Assert . Equal ( expectedBuffer [ i ] . UnicodeChar , consoleBuffer [ i ] . UnicodeChar ) ;
447
- Assert . Equal ( expectedBuffer [ i ] . ForegroundColor , consoleBuffer [ i ] . ForegroundColor ) ;
448
- Assert . Equal ( expectedBuffer [ i ] . BackgroundColor , consoleBuffer [ i ] . BackgroundColor ) ;
448
+ if ( ! ScreenReaderModeEnabled )
449
+ {
450
+ // Changing colors is not supported in screen reader mode,
451
+ // and this is the simplest way to disable checking that in all the tests.
452
+ Assert . Equal ( expectedBuffer [ i ] . ForegroundColor , consoleBuffer [ i ] . ForegroundColor ) ;
453
+ Assert . Equal ( expectedBuffer [ i ] . BackgroundColor , consoleBuffer [ i ] . BackgroundColor ) ;
454
+ }
449
455
}
450
456
}
451
457
@@ -582,6 +588,7 @@ private void TestSetup(TestConsole console, KeyMode keyMode, params KeyHandler[]
582
588
ContinuationPrompt = PSConsoleReadLineOptions . DefaultContinuationPrompt ,
583
589
DingDuration = 1 , // Make tests virtually silent when they ding
584
590
DingTone = 37 , // Make tests virtually silent when they ding
591
+ EnableScreenReaderMode = ScreenReaderModeEnabled ,
585
592
ExtraPromptLineCount = PSConsoleReadLineOptions . DefaultExtraPromptLineCount ,
586
593
HistoryNoDuplicates = PSConsoleReadLineOptions . DefaultHistoryNoDuplicates ,
587
594
HistorySaveStyle = HistorySaveStyle . SaveNothing ,
@@ -668,4 +675,14 @@ public fr_FR_Windows(ConsoleFixture fixture, ITestOutputHelper output)
668
675
internal override bool KeyboardHasCtrlRBracket => false ;
669
676
internal override bool KeyboardHasCtrlAt => false ;
670
677
}
678
+
679
+ public class ScreenReader : Test . ReadLine , IClassFixture < ConsoleFixture >
680
+ {
681
+ public ScreenReader ( ConsoleFixture fixture , ITestOutputHelper output )
682
+ : base ( fixture , output , "en-US" , "windows" )
683
+ {
684
+ }
685
+
686
+ internal override bool ScreenReaderModeEnabled => true ;
687
+ }
671
688
}
0 commit comments