Exemplo n.º 1
0
        private static SuperSourceState.BoxState BuildBox(IBMDSwitcherSuperSourceBox props)
        {
            var state = new SuperSourceState.BoxState();

            props.GetEnabled(out int enabled);
            state.Enabled = enabled != 0;
            props.GetInputSource(out long input);
            state.Source = (VideoSource)input;
            props.GetPositionX(out double xPos);
            state.PositionX = xPos;
            props.GetPositionY(out double yPos);
            state.PositionY = yPos;
            props.GetSize(out double size);
            state.Size = size;
            props.GetCropped(out int cropped);
            state.Cropped = cropped != 0;
            props.GetCropTop(out double top);
            state.CropTop = top;
            props.GetCropBottom(out double bottom);
            state.CropBottom = bottom;
            props.GetCropLeft(out double left);
            state.CropLeft = left;
            props.GetCropRight(out double right);
            state.CropRight = right;

            return(state);
        }
        protected static void EachSuperSourceBox(AtemMockServerWrapper helper, Action <AtemState, SuperSourceState.BoxState, IBMDSwitcherSuperSourceBox, SuperSourceId, SuperSourceBoxId, int> fcn, int iterations = 5)
        {
            var allBoxes = new List <Tuple <SuperSourceId, SuperSourceBoxId, IBMDSwitcherSuperSourceBox> >();

            foreach (KeyValuePair <VideoSource, IBMDSwitcherInputSuperSource> ssrc in helper.GetSdkInputsOfType <IBMDSwitcherInputSuperSource>())
            {
                SuperSourceId id       = (SuperSourceId)(ssrc.Key - VideoSource.SuperSource);
                var           iterator = AtemSDKConverter.CastSdk <IBMDSwitcherSuperSourceBoxIterator>(ssrc.Value.CreateIterator);
                AtemSDKConverter.Iterate <IBMDSwitcherSuperSourceBox>(iterator.Next, (box, i) =>
                {
                    allBoxes.Add(Tuple.Create(id, (SuperSourceBoxId)i, box));
                });
            }

            var boxes = Randomiser.SelectionOfGroup(allBoxes);

            foreach (Tuple <SuperSourceId, SuperSourceBoxId, IBMDSwitcherSuperSourceBox> box in boxes)
            {
                AtemState stateBefore = helper.Helper.BuildLibState();

                SuperSourceState.BoxState boxBefore = stateBefore.SuperSources[(int)box.Item1].Boxes[(int)box.Item2];
                Assert.NotNull(boxBefore);

                for (int i = 0; i < iterations; i++)
                {
                    fcn(stateBefore, boxBefore, box.Item3, box.Item1, box.Item2, i);
                }
            }
        }