public void TestPattern()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <TransitionWipeSetCommand, TransitionWipeGetCommand>("Pattern");

            AtemMockServerWrapper.Each(Output, Pool, handler, DeviceTestCases.All, helper =>
            {
                EachMixEffect <IBMDSwitcherTransitionWipeParameters>(helper, (stateBefore, meBefore, sdk, meId, i) =>
                {
                    tested = true;
                    Assert.NotNull(meBefore.Transition.Wipe);

                    Pattern target = Randomiser.EnumValue <Pattern>();
                    _BMDSwitcherPatternStyle target2 = AtemEnumMaps.PatternMap[target];
                    meBefore.Transition.Wipe.Pattern = target;
                    helper.SendAndWaitForChange(stateBefore, () => { sdk.SetPattern(target2); });
                });
            });
            Assert.True(tested);
        }
示例#2
0
        public void TestSupportedShapes()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.FairlightMain, helper =>
            {
                var eqCommands = helper.Server.GetParsedDataDump()
                                 .OfType <FairlightMixerSourceEqualizerBandGetCommand>().ToList();
                ForSampleOfBands(helper, (stateBefore, bandState, band, inputId, sourceId, index) =>
                {
                    var cmd = eqCommands.Single(c =>
                                                c.Band == index && c.SourceId == sourceId && (long)c.Index == inputId);

                    for (int i = 0; i < 3; i++)
                    {
                        var target = Randomiser.EnumValue <FairlightEqualizerBandShape>();
                        bandState.SupportedShapes = cmd.SupportedShapes = target;
                        helper.SendFromServerAndWaitForChange(stateBefore, cmd);
                    }
                });
            });
        }
示例#3
0
        public void TestFrequencyRange()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerSourceEqualizerBandSetCommand, FairlightMixerSourceEqualizerBandGetCommand>("FrequencyRange");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                ForSampleOfBands(helper, (stateBefore, bandState, band, inputId, sourceId, index) =>
                {
                    for (int i = 0; i < 3; i++)
                    {
                        var target = Randomiser.EnumValue <FairlightEqualizerFrequencyRange>();
                        bandState.FrequencyRange = target;
                        helper.SendAndWaitForChange(stateBefore, () =>
                        {
                            band.SetFrequencyRange(AtemEnumMaps.FairlightEqualizerFrequencyRangeMap[target]);
                        });
                    }
                });
            });
        }
        public void TestStorageMediaStatus()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.HyperDecks, helper =>
            {
                List <HyperDeckSettingsGetCommand> settingsCommands = helper.Server.GetParsedDataDump().OfType <HyperDeckSettingsGetCommand>().ToList();

                foreach (IBMDSwitcherHyperDeck deck in GetHyperDecks(helper))
                {
                    deck.GetId(out long id);
                    HyperDeckSettingsGetCommand cmd = settingsCommands.Single(c => c.Id == id);

                    // Force it to be connected
                    AtemState stateBefore = helper.Helper.BuildLibState();
                    cmd.Status            = HyperDeckConnectionStatus.Connected;
                    stateBefore.Hyperdecks[(int)id].Settings.Status = HyperDeckConnectionStatus.Connected;
                    stateBefore.Hyperdecks[(int)id].Player.State    = HyperDeckPlayerState.Idle;
                    helper.SendFromServerAndWaitForChange(stateBefore, cmd);

                    stateBefore = helper.Helper.BuildLibState();
                    HyperdeckState hyperdeckState             = stateBefore.Hyperdecks[(int)id];
                    hyperdeckState.Storage.ActiveStorageMedia = 0;

                    var storageCmd = new HyperDeckStorageGetCommand
                    {
                        Id = (uint)id,
                        ActiveStorageMedia = hyperdeckState.Storage.ActiveStorageMedia,
                        CurrentClipId      = hyperdeckState.Storage.CurrentClipId,
                        FrameRate          = hyperdeckState.Storage.FrameRate,
                        TimeScale          = hyperdeckState.Storage.TimeScale,
                    };

                    for (int i = 0; i < 5; i++)
                    {
                        hyperdeckState.Storage.ActiveStorageStatus = storageCmd.ActiveStorageStatus =
                            Randomiser.EnumValue <HyperDeckStorageStatus>();

                        helper.SendFromServerAndWaitForChange(stateBefore, storageCmd);
                    }
                }
            });
        }
示例#5
0
        public void TestSupportedShapes()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.FairlightMain, helper =>
            {
                var eqCommands = helper.Server.GetParsedDataDump()
                                 .OfType <FairlightMixerMasterEqualizerBandGetCommand>().ToList();
                ForSampleOfBands(helper, (band, index) =>
                {
                    AtemState stateBefore = helper.Helper.BuildLibState();
                    var bandState         = stateBefore.Fairlight.ProgramOut.Equalizer.Bands[(int)index];
                    var cmd = eqCommands.Single(c => c.Band == index);

                    for (int i = 0; i < 5; i++)
                    {
                        var target = Randomiser.EnumValue <FairlightEqualizerBandShape>();
                        bandState.SupportedShapes = cmd.SupportedShapes = target;
                        helper.SendFromServerAndWaitForChange(stateBefore, cmd);
                    }
                });
            });
        }
        public void TestDiskStatus()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <RecordingStatusSetCommand, RecordingStatusGetCommand>("IsRecording", true);

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.Streaming, helper =>
            {
                var switcher = helper.SdkClient.SdkSwitcher as IBMDSwitcherStreamRTMP;
                Assert.NotNull(switcher);

                AtemState stateBefore = helper.Helper.BuildLibState();

                var cmd = InitDisk(helper, stateBefore);

                for (int i = 0; i < 10; i++)
                {
                    stateBefore.Recording.Disks[cmd.DiskId].Status =
                        cmd.Status = Randomiser.EnumValue <RecordingDiskStatus>();

                    helper.SendFromServerAndWaitForChange(stateBefore, cmd);
                }
            });
        }
        public void TestTimeCodeMode()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <TimeCodeConfigSetCommand, TimeCodeConfigGetCommand>("Mode", true);

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.TimeCodeMode, helper =>
            {
                IBMDSwitcher switcher = helper.SdkClient.SdkSwitcher;

                AtemState stateBefore = helper.Helper.BuildLibState();

                for (int i = 0; i < 5; i++)
                {
                    var target = Randomiser.EnumValue <TimeCodeMode>();
                    stateBefore.Settings.TimeCodeMode = target;

                    helper.SendAndWaitForChange(stateBefore,
                                                () =>
                    {
                        switcher.SetTimeCodeMode(AtemEnumMaps.TimeCodeModeMap[target]);
                    });
                }
            });
        }
示例#8
0
        public void TestFrequencyRange()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerMasterEqualizerBandSetCommand, FairlightMixerMasterEqualizerBandGetCommand>("FrequencyRange");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                ForSampleOfBands(helper, (band, index) =>
                {
                    AtemState stateBefore = helper.Helper.BuildLibState();
                    var bandState         = stateBefore.Fairlight.ProgramOut.Equalizer.Bands[(int)index];

                    for (int i = 0; i < 5; i++)
                    {
                        var target = Randomiser.EnumValue <FairlightEqualizerFrequencyRange>();
                        bandState.FrequencyRange = target;
                        helper.SendAndWaitForChange(stateBefore, () =>
                        {
                            band.SetFrequencyRange(AtemEnumMaps.FairlightEqualizerFrequencyRangeMap[target]);
                        });
                    }
                });
            });
        }
        public void TestAvailableAudioModes()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <MixMinusOutputSetCommand, MixMinusOutputGetCommand>("Mode");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.MixMinusOutputs, helper =>
            {
                var previousCommands = helper.Server.GetParsedDataDump().OfType <MixMinusOutputGetCommand>().ToList();

                for (int i = 0; i < 5; i++)
                {
                    AtemState stateBefore = helper.Helper.BuildLibState();
                    uint id = Randomiser.RangeInt((uint)stateBefore.Settings.MixMinusOutputs.Count - 1);
                    SettingsState.MixMinusOutputState mixMinusState = stateBefore.Settings.MixMinusOutputs[(int)id];

                    MixMinusOutputGetCommand cmd = previousCommands.Single(c => c.Id == id);
                    MixMinusMode newValue        = Randomiser.EnumValue <MixMinusMode>();
                    cmd.SupportedModes           = newValue;

                    mixMinusState.SupportedModes = newValue;

                    helper.SendFromServerAndWaitForChange(stateBefore, cmd);
                }
            });
        }
示例#10
0
        public void TestRunToKeyFrame()
        {
            bool tested         = false;
            var  expectedCmd    = new MixEffectKeyFlyRunSetCommand();
            bool ignoreInfinite = false;
            Func <Lazy <ImmutableList <ICommand> >, ICommand, IEnumerable <ICommand> > handler = (previousCommands, cmd) =>
            {
                string[] ignoreProps = ignoreInfinite ? new[] { "RunToInfinite" } : new string[] { };
                if (CommandGenerator.ValidateCommandMatches(cmd, expectedCmd, false, ignoreProps))
                {
                    // Accept it
                    return(new ICommand[] { null });
                }

                return(new ICommand[0]);
            };

            AtemMockServerWrapper.Each(Output, Pool, handler, DeviceTestCases.All, helper =>
            {
                SelectionOfKeyers <IBMDSwitcherKeyFlyParameters>(helper, (stateBefore, keyerBefore, sdkKeyer, meId, keyId, i) =>
                {
                    tested = true;

                    expectedCmd.MixEffectIndex = meId;
                    expectedCmd.KeyerIndex     = keyId;

                    for (int o = 0; o < 5; o++)
                    {
                        var targetFrame = Randomiser.RangeInt(2) > 0
                            ? FlyKeyKeyFrameType.RunToInfinite
                            : Randomiser.EnumValue <FlyKeyKeyFrameType>(FlyKeyKeyFrameType.None);
                        var targetInfinite = Randomiser.EnumValue <FlyKeyLocation>();

                        ignoreInfinite = targetFrame != FlyKeyKeyFrameType.RunToInfinite;

                        expectedCmd.KeyFrame      = targetFrame;
                        expectedCmd.RunToInfinite = targetInfinite;

                        /*expectedCmd.Mask = targetFrame == FlyKeyKeyFrameType.RunToInfinite
                         *  ? MixEffectKeyFlyRunSetCommand.MaskFlags.RunToInfinite |
                         *    MixEffectKeyFlyRunSetCommand.MaskFlags.KeyFrame
                         *  : MixEffectKeyFlyRunSetCommand.MaskFlags.KeyFrame;*/

                        helper.SendAndWaitForChange(stateBefore, () =>
                        {
                            _BMDSwitcherFlyKeyFrame destination;
                            switch (targetFrame)
                            {
                            case FlyKeyKeyFrameType.None:
                            case FlyKeyKeyFrameType.A:
                                destination = _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameA;
                                break;

                            case FlyKeyKeyFrameType.B:
                                destination = _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameB;
                                break;

                            case FlyKeyKeyFrameType.Full:
                                destination = _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameFull;
                                break;

                            case FlyKeyKeyFrameType.RunToInfinite:
                                switch (targetInfinite)
                                {
                                case FlyKeyLocation.CentreOfKey:
                                    destination = _BMDSwitcherFlyKeyFrame
                                                  .bmdSwitcherFlyKeyFrameInfinityCentreOfKey;
                                    break;

                                case FlyKeyLocation.TopLeft:
                                    destination = _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityTopLeft;
                                    break;

                                case FlyKeyLocation.TopCentre:
                                    destination = _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityTop;
                                    break;

                                case FlyKeyLocation.TopRight:
                                    destination = _BMDSwitcherFlyKeyFrame
                                                  .bmdSwitcherFlyKeyFrameInfinityTopRight;
                                    break;

                                case FlyKeyLocation.MiddleLeft:
                                    destination = _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityLeft;
                                    break;

                                case FlyKeyLocation.MiddleCentre:
                                    destination = _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityCentre;
                                    break;

                                case FlyKeyLocation.MiddleRight:
                                    destination = _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityRight;
                                    break;

                                case FlyKeyLocation.BottomLeft:
                                    destination = _BMDSwitcherFlyKeyFrame
                                                  .bmdSwitcherFlyKeyFrameInfinityBottomLeft;
                                    break;

                                case FlyKeyLocation.BottomCentre:
                                    destination = _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityBottom;
                                    break;

                                case FlyKeyLocation.BottomRight:
                                    destination = _BMDSwitcherFlyKeyFrame
                                                  .bmdSwitcherFlyKeyFrameInfinityBottomRight;
                                    break;

                                default:
                                    throw new ArgumentOutOfRangeException();
                                }

                                break;

                            default:
                                throw new ArgumentOutOfRangeException();
                            }

                            sdkKeyer.RunToKeyFrame(destination);
                        });
                    }
                });
            });
            Assert.True(tested);
        }