5
5
using BMDSwitcherAPI ;
6
6
using LibAtem . Commands ;
7
7
using LibAtem . Commands . Settings . Multiview ;
8
+ using LibAtem . Commands . SuperSource ;
8
9
using LibAtem . Common ;
9
10
using LibAtem . MockTests . SdkState ;
10
11
using LibAtem . MockTests . Util ;
@@ -67,7 +68,7 @@ public void TestLayout()
67
68
stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . Properties . Layout = newValue ;
68
69
helper . SendAndWaitForChange ( stateBefore , ( ) =>
69
70
{
70
- mv . Item2 . SetLayout ( ( _BMDSwitcherMultiViewLayout ) newValue ) ;
71
+ mv . Item2 . SetLayout ( ( _BMDSwitcherMultiViewLayout ) newValue ) ;
71
72
} ) ;
72
73
}
73
74
}
@@ -86,7 +87,7 @@ public void TestSwapProgramPreview()
86
87
Assert . Equal ( 1 , supportsSwap ) ;
87
88
88
89
AtemState stateBefore = helper . Helper . BuildLibState ( ) ;
89
- MultiViewerState mvState = stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] ;
90
+ MultiViewerState mvState = stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] ;
90
91
91
92
for ( int i = 0 ; i < 5 ; i ++ )
92
93
{
@@ -123,7 +124,7 @@ public void TestToggleSafeAreaEnabled()
123
124
mv . Item2 . SupportsQuadrantLayout ( out int supportsQuadrant ) ;
124
125
125
126
int [ ] windows = supportsQuadrant == 0
126
- ? new [ ] { 0 , 1 }
127
+ ? new [ ] { 0 , 1 }
127
128
: Randomiser . SelectionOfGroup ( Enumerable . Range ( 0 , 16 ) . ToList ( ) ) . ToArray ( ) ;
128
129
129
130
foreach ( int window in windows )
@@ -132,10 +133,10 @@ public void TestToggleSafeAreaEnabled()
132
133
for ( int i = 0 ; i < 5 ; i ++ )
133
134
{
134
135
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 ;
136
137
137
138
helper . SendAndWaitForChange ( stateBefore ,
138
- ( ) => { mv . Item2 . SetSafeAreaEnabled ( ( uint ) window , newValue ? 1 : 0 ) ; } ) ;
139
+ ( ) => { mv . Item2 . SetSafeAreaEnabled ( ( uint ) window , newValue ? 1 : 0 ) ; } ) ;
139
140
}
140
141
}
141
142
}
@@ -206,7 +207,7 @@ public void TestVuMeterOpacity()
206
207
for ( int i = 0 ; i < 5 ; i ++ )
207
208
{
208
209
double newValue = Randomiser . Range ( 0 , 100 ) ;
209
- stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . VuMeterOpacity = newValue ;
210
+ stateBefore . Settings . MultiViewers [ ( int ) mv . Item1 ] . VuMeterOpacity = newValue ;
210
211
211
212
helper . SendAndWaitForChange ( stateBefore ,
212
213
( ) => { mv . Item2 . SetVuMeterOpacity ( newValue / 100 ) ; } ) ;
@@ -264,7 +265,7 @@ public void TestWindowSupportsVuMeterEnabled()
264
265
foreach ( int window in windows )
265
266
{
266
267
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 ] ;
268
269
269
270
MultiviewWindowInputGetCommand cmd = cmds . Single ( c => c . WindowIndex == window && c . MultiviewIndex == mv . Item1 ) ;
270
271
@@ -368,7 +369,7 @@ public void TestSource()
368
369
369
370
helper . SendAndWaitForChange ( stateBefore , ( ) =>
370
371
{
371
- mv . Item2 . SetWindowInput ( ( uint ) window , ( long ) src ) ;
372
+ mv . Item2 . SetWindowInput ( ( uint ) window , ( long ) src ) ;
372
373
} ) ;
373
374
}
374
375
}
@@ -388,5 +389,120 @@ private static IEnumerable<ICommand> SourceCommandHandler(Lazy<ImmutableList<ICo
388
389
}
389
390
}
390
391
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
+ }
391
507
}
392
508
}
0 commit comments