Exemplo n.º 1
0
        static void testSingleCallbackAt(
            float insertCallbackAt, ImmutableList <float> otherPoints, ActionsToExecute actions
            )
        {
            var tsb = TweenTimeline.Builder.create().insert(
                insertCallbackAt,
                new TweenCallback(_ => stateSubject.push(_.playingForwards))
                );

            foreach (var otherPoint in otherPoints)
            {
                tsb.insert(otherPoint, emptyCallback);
            }
            var ts = tsb.build();

            var lastInvocation = 0f;

            foreach (var action in actions)
            {
                // Expected result correlates to playingForwards
                // as we are using playingforwards as the state variable
                var(setTimeTo, playingForwards, testResult) = action;
                Action execute = () => {
                    ts.setRelativeTimePassed(lastInvocation, setTimeTo, playingForwards, true);
                    lastInvocation = setTimeTo;
                };
                execute.shouldPushTo(stateSubject).resultIn(testResult);
            }
        }
        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>
        /// A deep copy of this instance.
        /// </returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public override ActionViewModelBase Clone()
        {
            var conditionalAction = new SendToWindowAction();

            return(new SendToWindowActionViewModel(conditionalAction, ActionDescriptor, _allDescriptors)
            {
                OutputWindowName = OutputWindowName,
                SendToAllWindows = SendToAllWindows,
                ActionsToExecute = ActionsToExecute.Clone(conditionalAction.ActionsToExecute)
            });
        }
        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>A deep copy of this instance.</returns>
        public override ActionViewModelBase Clone()
        {
            var conditionalAction = new ConditionalAction();

            return(new ConditionalActionViewModel(conditionalAction, ActionDescriptor, _allDescriptors, ParameterDescriptions)
            {
                LeftConditionParameter = LeftConditionParameter.Clone(),
                RightConditionParameter = RightConditionParameter.Clone(),
                Condition = Condition,
                ActionsToExecute = ActionsToExecute.Clone(conditionalAction.ActionsToExecute)
            });
        }
Exemplo n.º 4
0
 public void testCallbackAtTheEnd(ActionsToExecute testCases) => testSingleCallbackAt(
     insertCallbackAt: END,
     otherPoints: emptyOtherPoints,
     actions: testCases
     );
Exemplo n.º 5
0
 public void testCallbackAtTheStartNonZeroDuration(ActionsToExecute testCases) => testSingleCallbackAt(
     insertCallbackAt: 0f,
     otherPoints: emptyOtherPoints.Add(END),
     actions: testCases
     );
Exemplo n.º 6
0
 public void testCallbackAtTheMiddle(ActionsToExecute testCases) => testSingleCallbackAt(
     insertCallbackAt: MIDDLE,
     otherPoints: emptyOtherPoints.Add(END),
     actions: testCases
     );