public void TestActiveConfiguration()
        {
            var  handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerInputSetCommand, FairlightMixerInputGetCommand>("ActiveConfiguration");
            bool tested  = false;

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                IEnumerable <long> useIds = Randomiser.SelectionOfGroup(helper.Helper.BuildLibState().Fairlight.Inputs.Keys.ToList());
                foreach (long id in useIds)
                {
                    IBMDSwitcherFairlightAudioInput input = GetInput(helper, id);

                    AtemState stateBefore = helper.Helper.BuildLibState();
                    FairlightAudioState.InputState inputState = stateBefore.Fairlight.Inputs[id];

                    var testConfigs = AtemSDKConverter.GetFlagsValues(input.GetSupportedConfigurations,
                                                                      AtemEnumMaps.FairlightInputConfigurationMap);
                    // Need more than 1 config to allow for switching around
                    if (1 == testConfigs.Count)
                    {
                        continue;
                    }
                    tested = true;

                    for (int i = 0; i < 5; i++)
                    {
                        var target = testConfigs[i % testConfigs.Count];
                        inputState.ActiveConfiguration = target.Item2;
                        helper.SendAndWaitForChange(stateBefore, () => { input.SetConfiguration(target.Item1); });
                    }
                }
            });
            Assert.True(tested);
        }
Ejemplo n.º 2
0
        public void TestMixOption()
        {
            var  handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerSourceSetCommand, FairlightMixerSourceGetCommand>("MixOption");
            bool tested  = false;

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) =>
                {
                    var testConfigs = AtemSDKConverter.GetFlagsValues(src.GetSupportedMixOptions,
                                                                      AtemEnumMaps.FairlightAudioMixOptionMap);
                    // Need more than 1 config to allow for switching around
                    if (1 == testConfigs.Count)
                    {
                        return;
                    }
                    tested     = true;
                    var target = testConfigs[i % testConfigs.Count];

                    srcState.MixOption = target.Item2;
                    helper.SendAndWaitForChange(stateBefore, () => { src.SetMixOption(target.Item1); });
                });
            });
            Assert.True(tested);
        }
        public void TestAnalogInputLevel()
        {
            var  handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerAnalogAudioSetCommand, FairlightMixerAnalogAudioGetCommand>("InputLevel", true);
            bool tested  = false;

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightAnalog, helper =>
            {
                IEnumerable <long> useIds = helper.Helper.BuildLibState().Fairlight.Inputs.Keys.ToList();
                foreach (long id in useIds)
                {
                    IBMDSwitcherFairlightAudioInput input = GetInput(helper, id);
                    if (input is IBMDSwitcherFairlightAnalogAudioInput analogInput)
                    {
                        AtemState stateBefore = helper.Helper.BuildLibState();
                        FairlightAudioState.AnalogState inputState = stateBefore.Fairlight.Inputs[id].Analog;

                        var testConfigs = AtemSDKConverter.GetFlagsValues(analogInput.GetSupportedInputLevels,
                                                                          AtemEnumMaps.FairlightAnalogInputLevelMap);
                        // Need more than 1 config to allow for switching around
                        if (1 == testConfigs.Count)
                        {
                            continue;
                        }
                        tested = true;

                        for (int i = 0; i < 5; i++)
                        {
                            var target            = testConfigs[i % testConfigs.Count];
                            inputState.InputLevel = target.Item2;
                            helper.SendAndWaitForChange(stateBefore, () => { analogInput.SetInputLevel(target.Item1); });
                        }
                    }
                }
            });
            Assert.True(tested);
        }