Beispiel #1
0
        public void AnimatableRemovePropertyNotifications()
        {
            tlog.Debug(tag, $"AnimatableRemovePropertyNotifications START");

            var testingTarget = new Animatable();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <Animatable>(testingTarget, "should be an instance of Animatable class!");

            testingTarget.RegisterProperty("dummy", new PropertyValue(6));
            var dummy = testingTarget.AddPropertyNotification("dummy", PropertyCondition.GreaterThan(5));

            Assert.IsNotNull(dummy, "should be not null");
            Assert.IsInstanceOf <PropertyNotification>(dummy, "should be an instance of PropertyNotification class!");

            var dummy2 = testingTarget.AddPropertyNotification("dummy", PropertyCondition.LessThan(10));

            Assert.IsNotNull(dummy2, "should be not null");
            Assert.IsInstanceOf <PropertyNotification>(dummy2, "should be an instance of PropertyNotification class!");

            try
            {
                testingTarget.RemovePropertyNotifications();
            }
            catch (Exception e)
            {
                tlog.Error(tag, "Caught Exception" + e.ToString());
                LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
                Assert.Fail("Caught Exception" + e.ToString());
            }

            dummy.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"AnimatableRemovePropertyNotifications END (OK)");
        }
        public async Task PropertyNotificationNotified()
        {
            tlog.Debug(tag, $"PropertyNotificationNotified START");

            View view = new View();
            Window.Instance.Add(view);
            var testingTarget = view.AddPropertyNotification("positionX", PropertyCondition.GreaterThan(100.0f));
            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(testingTarget, "should be an instance of PropertyNotification class!");

            testingTarget.SetNotifyMode(PropertyNotification.NotifyMode.NotifyOnChanged);
            bool flag = false;
            testingTarget.Notified += (obj, e) =>
            {
                flag = true;
            };

            view.Position = new Position(300.0f, 0.0f, 0.0f);
            await Task.Delay(200);
            Assert.AreEqual(true, flag, "Should be equal!");

            Window.Instance.Remove(view);
            testingTarget.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotificationNotified END (OK)");
        }
        public void PropertyNotificationAssign()
        {
            tlog.Debug(tag, $"PropertyNotificationAssign START");

            var view = new View();
            Assert.IsNotNull(view, "should not be null.");
            Assert.IsInstanceOf<View>(view, "should be an instance of View class!");
            Window.Instance.Add(view);

            var dummy1 = view.AddPropertyNotification("positionX", PropertyCondition.GreaterThan(100.0f));
            Assert.IsNotNull(dummy1, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(dummy1, "should be an instance of PropertyNotification class!");

            var dummy2 = view.AddPropertyNotification("positionY", PropertyCondition.GreaterThan(100.0f));
            Assert.IsNotNull(dummy2, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(dummy2, "should be an instance of PropertyNotification class!");

            var testingTarget = dummy2.Assign(dummy1);
            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(testingTarget, "should be an instance of PropertyNotification class!");

            Window.Instance.Remove(view);
            testingTarget.Dispose();
            dummy2.Dispose();
            dummy1.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotificationAssign END (OK)");
        }
        public void PropertyNotificationAssignNegative()
        {
            tlog.Debug(tag, $"PropertyNotificationAssignNegative START");

            var view = new View();
            Assert.IsNotNull(view, "should not be null.");
            Assert.IsInstanceOf<View>(view, "should be an instance of View class!");
            Window.Instance.Add(view);

            var testingTarget = view.AddPropertyNotification("positionX", PropertyCondition.GreaterThan(100.0f));
            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(testingTarget, "should be an instance of PropertyNotification class!");

            try
            {
                testingTarget.Assign(null);
                Assert.Fail("Should throw the System.ArgumentNullException!");
            }
            catch (ArgumentNullException e)
            {
                Assert.True(true);
            }

            Window.Instance.Remove(view);
            testingTarget.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotificationAssignNegative END (OK)");
        }
        public void PropertyNotificationGetCondition()
        {
            tlog.Debug(tag, $"PropertyNotificationGetCondition START");

            var dummyView = new View();
            Assert.IsNotNull(dummyView, "should not be null.");
            Assert.IsInstanceOf<View>(dummyView, "should be an instance of View class!");

            var dummycondition = PropertyCondition.GreaterThan(100.0f);
            Assert.IsNotNull(dummycondition, "should not be null.");
            Assert.IsInstanceOf<PropertyCondition>(dummycondition, "should be an instance of PropertyCondition class!");

            var dummyNotification = dummyView.AddPropertyNotification("PositionX", dummycondition);
            Assert.IsNotNull(dummyNotification, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(dummyNotification, "should be an instance of PropertyNotification class!");

            var result = dummyNotification.GetCondition();
            Assert.IsNotNull(result, "should not be null.");
            Assert.IsInstanceOf<PropertyCondition>(result, "should be an instance of PropertyCondition class!");

            Assert.IsTrue(result == dummycondition);

            result.Dispose();
            dummyNotification.Dispose();
            dummycondition.Dispose();
            dummyView.Dispose();
            tlog.Debug(tag, $"PropertyNotificationGetCondition END (OK)");
        }
        public void PropertyNotifySignalEmit()
        {
            tlog.Debug(tag, $"PropertyNotifySignalEmit START");

            var testingTarget = new PropertyNotifySignal();

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyNotifySignal>(testingTarget, "Should be an Instance of PropertyNotifySignal!");

            View view = new View()
            {
                Size            = new Size(200, 200),
                BackgroundColor = Color.Red
            };

            Window.Instance.Add(view);

            var dummy = view.AddPropertyNotification("PositionX", PropertyCondition.GreaterThan(100.0f));

            Assert.IsNotNull(dummy, "Should be not null!");
            Assert.IsInstanceOf <PropertyNotification>(dummy, "Should be an Instance of PropertyNotification!");

            testingTarget.Emit(dummy);

            testingTarget.Dispose();
            dummy.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotifySignalEmit END (OK)");
        }
        public void PropertyNotificationNotifyEventArgsGetTargetProperty()
        {
            tlog.Debug(tag, $"PropertyNotificationNotifyEventArgsGetTargetProperty START");

            var view = new View();

            Assert.IsNotNull(view, "should not be null.");
            Assert.IsInstanceOf <View>(view, "should be an instance of View class!");

            var dummy = view.AddPropertyNotification("PositionX", PropertyCondition.GreaterThan(100.0f));

            Assert.IsNotNull(dummy, "should not be null.");
            Assert.IsInstanceOf <PropertyNotification>(dummy, "should be an instance of PropertyNotification class!");

            var testingTarget = new PropertyNotification.NotifyEventArgs();

            Assert.NotNull(testingTarget, "Should be not null");
            Assert.IsInstanceOf <PropertyNotification.NotifyEventArgs>(testingTarget, "Should be an instance of PropertyNotification.PropertyNotificationNotifyEventArgs");

            testingTarget.PropertyNotification = dummy;
            Assert.AreEqual(13, testingTarget.PropertyNotification.GetTargetProperty(), "Should be equal!");

            dummy.Dispose();
            view.Dispose();

            tlog.Debug(tag, $"PropertyNotificationNotifyEventArgsGetTargetProperty END (OK)");
        }
        public void PropertyNotificationDownCast()
        {
            tlog.Debug(tag, $"PropertyNotificationDownCast START");

            var view = new View();

            Assert.IsNotNull(view, "should not be null.");
            Assert.IsInstanceOf <View>(view, "should be an instance of View class!");

            Window.Instance.Add(view);
            var testingTarget = view.AddPropertyNotification("positionX", PropertyCondition.GreaterThan(100.0f));

            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf <PropertyNotification>(testingTarget, "should be an instance of PropertyNotification class!");

            var result = PropertyNotification.DownCast(testingTarget);

            Assert.IsNotNull(result, "should not be null.");
            Assert.IsInstanceOf <PropertyNotification>(result, "should be an instance of PropertyNotification class!");

            Window.Instance.Remove(view);
            testingTarget.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotificationDownCast END (OK)");
        }
        public void PropertyNotificationGetNotifyResult()
        {
            tlog.Debug(tag, $"PropertyNotificationGetNotifyResult START");

            var view = new View();

            Assert.IsNotNull(view, "should not be null.");
            Assert.IsInstanceOf <View>(view, "should be an instance of View class!");

            var testingTarget = view.AddPropertyNotification("PositionX", PropertyCondition.GreaterThan(100.0f));

            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf <PropertyNotification>(testingTarget, "should be an instance of PropertyNotification class!");

            testingTarget.SetNotifyMode(PropertyNotification.NotifyMode.NotifyOnChanged);
            testingTarget.Notified += (obj, e) =>
            {
                tlog.Fatal("TCT", "Notified!");
            };
            view.Position = new Position(0.0f, 0.0f, 0.0f);
            Assert.AreEqual(false, testingTarget.GetNotifyResult(), "Should be equal!");

            testingTarget.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotificationGetNotifyResult END (OK)");
        }
Beispiel #10
0
        public void PropertyConditionGetArgument()
        {
            tlog.Debug(tag, $"PropertyConditionGetArgument START");

            var testingTarget = PropertyCondition.GreaterThan(100);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <PropertyCondition>(testingTarget, "should be an instance of testing target class!");

            Assert.AreEqual(1, testingTarget.GetArgumentCount(), $"Should be 1");
            Assert.AreEqual(100, testingTarget.GetArgument(0), $"Should be 100");

            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyConditionGetArgument END (OK)");
        }
        public void PropertyNotificationGetNotifyMode()
        {
            tlog.Debug(tag, $"PropertyNotificationGetNotifyMode START");

            View view = new View();
            var testingTarget = view.AddPropertyNotification("PositionX", PropertyCondition.GreaterThan(100.0f));
            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(testingTarget, "should be an instance of PropertyNotification class!");

            var result = testingTarget.GetNotifyMode();
            Assert.IsNotNull(result, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification.NotifyMode>(result, "should be an instance of PropertyNotification.NotifyMode class!");
            Assert.IsTrue(PropertyNotification.NotifyMode.NotifyOnTrue == result);

            testingTarget.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotificationGetNotifyMode END (OK)");
        }
        public void PropertyNotificationGetTargetProperty()
        {
            tlog.Debug(tag, $"PropertyNotificationGetTargetProperty START");

            var view = new View();
            Assert.IsNotNull(view, "should not be null.");
            Assert.IsInstanceOf<View>(view, "should be an instance of View class!");

            var testingTarget = view.AddPropertyNotification("PositionX", PropertyCondition.GreaterThan(100.0f));
            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(testingTarget, "should be an instance of PropertyNotification class!");

            Assert.AreEqual(13, testingTarget.GetTargetProperty(), "Retrive testingTarget.GetTargetProperty() should equal to 13.");

            testingTarget.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotificationGetTargetProperty END (OK)");
        }
Beispiel #13
0
        public void AnimatableAddPropertyNotification()
        {
            tlog.Debug(tag, $"AnimatableAddPropertyNotification START");

            var testingTarget = new Animatable();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <Animatable>(testingTarget, "should be an instance of Animatable class!");

            testingTarget.RegisterProperty("dummy", new PropertyValue(6));
            var result = testingTarget.AddPropertyNotification("dummy", PropertyCondition.GreaterThan(5));

            Assert.IsNotNull(result, "should be not null");
            Assert.IsInstanceOf <PropertyNotification>(result, "should be an instance of PropertyNotification class!");

            result.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"AnimatableAddPropertyNotification END (OK)");
        }
        public void PropertyNotificationGetTarget()
        {
            tlog.Debug(tag, $"PropertyNotificationGetTarget START");

            var view = new View();
            Assert.IsNotNull(view, "should not be null.");
            Assert.IsInstanceOf<View>(view, "should be an instance of View class!");

            var testingTarget = view.AddPropertyNotification("PositionX", PropertyCondition.GreaterThan(100.0f));
            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(testingTarget, "should be an instance of PropertyNotification class!");

            var result = testingTarget.GetTarget();
            Assert.IsNotNull(result, "Should be not null!");
            Assert.IsInstanceOf<Animatable>(result, "should be an instance of Animatable class!");

            result.Dispose();
            testingTarget.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotificationGetTarget END (OK)");
        }
        public void PropertyNotificationConstructorWithPropertyNotification()
        {
            tlog.Debug(tag, $"PropertyNotificationConstructorWithPropertyNotification START");

            var view = new View();
            Assert.IsNotNull(view, "should not be null.");
            Assert.IsInstanceOf<View>(view, "should be an instance of View class!");

            var dummy = view.AddPropertyNotification("PositionX", PropertyCondition.GreaterThan(100.0f));
            Assert.IsNotNull(dummy, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(dummy, "should be an instance of PropertyNotification class!");

            var testingTarget = new Tizen.NUI.PropertyNotification(dummy);
            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf<PropertyNotification>(testingTarget, "should be an instance of PropertyNotification class!");

            testingTarget.Dispose();
            dummy.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"PropertyNotificationConstructorWithPropertyNotification END (OK)");
        }