public unsafe void TestPropagateGroupUpdateToChildren() { // this test verifies if group state changes are updating its children correctly var group = new QParallelAnimationGroup(); var o = new QObject(); o.SetProperty("ole", new QVariant(42)); Assert.AreEqual(42, o.Property("ole").ToInt()); var anim1 = new QPropertyAnimation(o, new QByteArray("ole")); anim1.EndValue = new QVariant(42); anim1.SetDuration(100); Assert.IsFalse(anim1.CurrentValue.IsValid); Assert.AreEqual(0, anim1.CurrentValue.ToInt()); Assert.AreEqual(42, o.Property("ole").ToInt()); var anim2 = new TestAnimation(); anim2.StartValue = new QVariant(0); anim2.EndValue = new QVariant(100); anim2.SetDuration(200); Assert.IsTrue(anim2.CurrentValue.IsValid); Assert.AreEqual(0, anim2.CurrentValue.ToInt()); Assert.AreEqual(QAbstractAnimation.State.Stopped, group.state); Assert.AreEqual(QAbstractAnimation.State.Stopped, anim1.state); Assert.AreEqual(QAbstractAnimation.State.Stopped, anim2.state); group.AddAnimation(anim1); group.AddAnimation(anim2); group.Start(); Assert.AreEqual(QAbstractAnimation.State.Running, group.state); Assert.AreEqual(QAbstractAnimation.State.Running, anim1.state); Assert.AreEqual(QAbstractAnimation.State.Running, anim2.state); group.Pause(); Assert.AreEqual(QAbstractAnimation.State.Paused, group.state); Assert.AreEqual(QAbstractAnimation.State.Paused, anim1.state); Assert.AreEqual(QAbstractAnimation.State.Paused, anim2.state); group.Stop(); Assert.AreEqual(QAbstractAnimation.State.Stopped, group.state); Assert.AreEqual(QAbstractAnimation.State.Stopped, anim1.state); Assert.AreEqual(QAbstractAnimation.State.Stopped, anim2.state); }
public unsafe void TestLoopWithoutStartValue() { QAnimationGroup parent = new QSequentialAnimationGroup(); var o = new QObject(); o.SetProperty("ole", new QVariant(0)); Assert.AreEqual(0, o.Property("ole").ToInt()); var anim1 = new QPropertyAnimation(o, new QByteArray("ole")); anim1.EndValue = new QVariant(-50); anim1.SetDuration(100); var anim2 = new QPropertyAnimation(o, new QByteArray("ole")); anim2.EndValue = new QVariant(50); anim2.SetDuration(100); parent.AddAnimation(anim1); parent.AddAnimation(anim2); parent.LoopCount = -1; parent.Start(); Assert.IsTrue(anim1.StartValue.IsNull); Assert.AreEqual(0, anim1.CurrentValue.ToInt()); Assert.AreEqual(0, parent.CurrentLoop); parent.CurrentTime = 200; Assert.AreEqual(1, parent.CurrentLoop); Assert.AreEqual(50, anim1.CurrentValue.ToInt()); parent.Stop(); }