55using BMDSwitcherAPI ;
66using LibAtem . Commands ;
77using LibAtem . Commands . Settings . Multiview ;
8+ using LibAtem . Commands . SuperSource ;
89using LibAtem . Common ;
910using LibAtem . MockTests . SdkState ;
1011using LibAtem . MockTests . Util ;
@@ -67,7 +68,7 @@ public void TestLayout()
6768 stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . Properties . Layout = newValue ;
6869 helper . SendAndWaitForChange ( stateBefore , ( ) =>
6970 {
70- mv . Item2 . SetLayout ( ( _BMDSwitcherMultiViewLayout ) newValue ) ;
71+ mv . Item2 . SetLayout ( ( _BMDSwitcherMultiViewLayout ) newValue ) ;
7172 } ) ;
7273 }
7374 }
@@ -86,7 +87,7 @@ public void TestSwapProgramPreview()
8687 Assert . Equal ( 1 , supportsSwap ) ;
8788
8889 AtemState stateBefore = helper . Helper . BuildLibState ( ) ;
89- MultiViewerState mvState = stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] ;
90+ MultiViewerState mvState = stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] ;
9091
9192 for ( int i = 0 ; i < 5 ; i ++ )
9293 {
@@ -123,7 +124,7 @@ public void TestToggleSafeAreaEnabled()
123124 mv . Item2 . SupportsQuadrantLayout ( out int supportsQuadrant ) ;
124125
125126 int [ ] windows = supportsQuadrant == 0
126- ? new [ ] { 0 , 1 }
127+ ? new [ ] { 0 , 1 }
127128 : Randomiser . SelectionOfGroup ( Enumerable . Range ( 0 , 16 ) . ToList ( ) ) . ToArray ( ) ;
128129
129130 foreach ( int window in windows )
@@ -132,10 +133,10 @@ public void TestToggleSafeAreaEnabled()
132133 for ( int i = 0 ; i < 5 ; i ++ )
133134 {
134135 bool newValue = i % 2 == 0 ;
135- stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . Windows [ window ] . SafeAreaEnabled = newValue ;
136+ stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . Windows [ window ] . SafeAreaEnabled = newValue ;
136137
137138 helper . SendAndWaitForChange ( stateBefore ,
138- ( ) => { mv . Item2 . SetSafeAreaEnabled ( ( uint ) window , newValue ? 1 : 0 ) ; } ) ;
139+ ( ) => { mv . Item2 . SetSafeAreaEnabled ( ( uint ) window , newValue ? 1 : 0 ) ; } ) ;
139140 }
140141 }
141142 }
@@ -206,7 +207,7 @@ public void TestVuMeterOpacity()
206207 for ( int i = 0 ; i < 5 ; i ++ )
207208 {
208209 double newValue = Randomiser . Range ( 0 , 100 ) ;
209- stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . VuMeterOpacity = newValue ;
210+ stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . VuMeterOpacity = newValue ;
210211
211212 helper . SendAndWaitForChange ( stateBefore ,
212213 ( ) => { mv . Item2 . SetVuMeterOpacity ( newValue / 100 ) ; } ) ;
@@ -264,7 +265,7 @@ public void TestWindowSupportsVuMeterEnabled()
264265 foreach ( int window in windows )
265266 {
266267 AtemState stateBefore = helper . Helper . BuildLibState ( ) ;
267- MultiViewerState . WindowState windowState = stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . Windows [ window ] ;
268+ MultiViewerState . WindowState windowState = stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . Windows [ window ] ;
268269
269270 MultiviewWindowInputGetCommand cmd = cmds . Single ( c => c . WindowIndex == window && c . MultiviewIndex == mv . Item1 ) ;
270271
@@ -368,7 +369,7 @@ public void TestSource()
368369
369370 helper . SendAndWaitForChange ( stateBefore , ( ) =>
370371 {
371- mv . Item2 . SetWindowInput ( ( uint ) window , ( long ) src ) ;
372+ mv . Item2 . SetWindowInput ( ( uint ) window , ( long ) src ) ;
372373 } ) ;
373374 }
374375 }
@@ -388,5 +389,120 @@ private static IEnumerable<ICommand> SourceCommandHandler(Lazy<ImmutableList<ICo
388389 }
389390 }
390391
392+ [ Fact ]
393+ public void TestWindowLabelVisible ( )
394+ {
395+ var handler = CommandGenerator . CreateAutoCommandHandler < MultiviewWindowOverlaySetCommand , MultiviewWindowOverlayGetCommand > ( "LabelVisible" , true ) ;
396+
397+ AtemMockServerWrapper . Each ( _output , _pool , handler , DeviceTestCases . MultiviewBorders , helper =>
398+ {
399+ foreach ( Tuple < uint , IBMDSwitcherMultiView > mv in GetMultiviewers ( helper ) )
400+ {
401+ // TODO: re-enable this
402+ // mv.Item2.CanChangeOverlayProperties(out int supported);
403+ // Assert.Equal(1, supported);
404+
405+ int [ ] windows = Randomiser
406+ . SelectionOfGroup ( Enumerable . Range ( 0 , 16 ) . ToList ( ) ) . ToArray ( ) ;
407+
408+ foreach ( int window in windows )
409+ {
410+ AtemState stateBefore = helper . Helper . BuildLibState ( ) ;
411+ MultiViewerState . WindowState windowState = stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . Windows [ window ] ;
412+
413+ for ( int i = 0 ; i < 5 ; i ++ )
414+ {
415+ bool newValue = i % 2 == 0 ;
416+ windowState . LabelVisible = newValue ;
417+
418+ helper . SendAndWaitForChange ( stateBefore , ( ) =>
419+ {
420+ mv . Item2 . SetLabelVisible ( ( uint ) window , newValue ? 1 : 0 ) ;
421+ } ) ;
422+ }
423+ }
424+ }
425+ } ) ;
426+ }
427+
428+ [ Fact ]
429+ public void TestWindowBorderVisible ( )
430+ {
431+ var handler = CommandGenerator . CreateAutoCommandHandler < MultiviewWindowOverlaySetCommand , MultiviewWindowOverlayGetCommand > ( "BorderVisible" , true ) ;
432+
433+ AtemMockServerWrapper . Each ( _output , _pool , handler , DeviceTestCases . MultiviewBorders , helper =>
434+ {
435+ foreach ( Tuple < uint , IBMDSwitcherMultiView > mv in GetMultiviewers ( helper ) )
436+ {
437+ // TODO: re-enable this
438+ // mv.Item2.CanChangeOverlayProperties(out int supported);
439+ // Assert.Equal(1, supported);
440+
441+ int [ ] windows = Randomiser
442+ . SelectionOfGroup ( Enumerable . Range ( 0 , 16 ) . ToList ( ) ) . ToArray ( ) ;
443+
444+ foreach ( int window in windows )
445+ {
446+ AtemState stateBefore = helper . Helper . BuildLibState ( ) ;
447+ MultiViewerState . WindowState windowState = stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . Windows [ window ] ;
448+
449+ for ( int i = 0 ; i < 5 ; i ++ )
450+ {
451+ bool newValue = i % 2 == 0 ;
452+ windowState . BorderVisible = newValue ;
453+
454+ helper . SendAndWaitForChange ( stateBefore , ( ) =>
455+ {
456+ mv . Item2 . SetBorderVisible ( ( uint ) window , newValue ? 1 : 0 ) ;
457+ } ) ;
458+ }
459+ }
460+ }
461+ } ) ;
462+ }
463+
464+ [ Fact ]
465+ public void TestBorderColor ( )
466+ {
467+ var expectedCmd = new MultiviewBorderColorGetCommand ( ) ;
468+ var handler = CommandGenerator . EchoCommand ( expectedCmd ) ;
469+
470+ AtemMockServerWrapper . Each ( _output , _pool , handler , DeviceTestCases . MultiviewBorders , helper =>
471+ {
472+ foreach ( Tuple < uint , IBMDSwitcherMultiView > mv in GetMultiviewers ( helper ) )
473+ {
474+ // TODO: re-enable this
475+ // mv.Item2.CanChangeOverlayProperties(out int supported);
476+ // Assert.Equal(1, supported);
477+
478+
479+ AtemState stateBefore = helper . Helper . BuildLibState ( ) ;
480+ MultiViewerState mvState = stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] ;
481+
482+ for ( int i = 0 ; i < 5 ; i ++ )
483+ {
484+ expectedCmd . MultiviewIndex = mv . Item1 ;
485+ expectedCmd . Red = Randomiser . Range ( 0 , 1 , 100 ) ;
486+ expectedCmd . Green = Randomiser . Range ( 0 , 1 , 100 ) ;
487+ expectedCmd . Blue = Randomiser . Range ( 0 , 1 , 100 ) ;
488+ expectedCmd . Alpha = Randomiser . Range ( 0 , 1 , 100 ) ;
489+
490+ mvState . BorderColor = new MultiViewerState . BorderColorState
491+ {
492+ Red = expectedCmd . Red ,
493+ Green = expectedCmd . Green ,
494+ Blue = expectedCmd . Blue ,
495+ Alpha = expectedCmd . Alpha
496+ } ;
497+
498+ helper . SendAndWaitForChange ( stateBefore , ( ) =>
499+ {
500+ mv . Item2 . SetBorderColor ( expectedCmd . Red , expectedCmd . Green , expectedCmd . Blue , expectedCmd . Alpha ) ;
501+ } ) ;
502+
503+ }
504+ }
505+ } ) ;
506+ }
391507 }
392508}
0 commit comments