public void MultiplyByRatio() { TestRuntime.AssertXcodeVersion(5, 1); TestRuntime.AssertSystemVersion(PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false); var t = new CMTime(1000, 1); t = CMTime.Multiply(t, 20, 10); Assert.That(t.Value, Is.EqualTo(2000), "Value"); }
public void MethodsTest() { CMTime v, w, x, y; v = new CMTime(1, 2); w = new CMTime(1, 2); x = new CMTime(2, 1); y = new CMTime(2, 2); // equality operators Assert.That(v == w, "Equality #1"); Assert.That(!(v == x), "Equality #2"); Assert.That(v != x, "Inequality #1"); Assert.That(!(v != w), "Inequality #2"); Assert.That(CMTime.Compare(v, w), Is.EqualTo(0), "Compare #1"); Assert.That(CMTime.Compare(v, x) != 0, "Compare #2"); Assert.That(v.Equals(w), "Equals #1"); Assert.That(!x.Equals(v), "Equals #2"); // addition operator Assert.That(v + w == new CMTime(2, 2), "Addition #1"); Assert.That(CMTime.Add(v, w) == new CMTime(2, 2), "Addition #2"); // subtraction operator Assert.That(v - w == new CMTime(0, 2), "Subtraction #1"); Assert.That(CMTime.Subtract(v, w) == new CMTime(0, 2), "Subtraction #2"); // multiplication operators Assert.That(v * 2 == new CMTime(2, 2), "Multiplication * int, #1"); Assert.That(CMTime.Multiply(v, 3) == new CMTime(3, 2), "Multiplication * int, #2"); Assert.That(v * 4.0 == new CMTime(4, 2), "Multiplication * double, #1"); Assert.That(CMTime.Multiply(v, 5.0) == new CMTime(5, 2), "Multiplication * double, #2"); // ConvertScale Assert.That(new CMTime(10, 2).ConvertScale(1, CMTimeRoundingMethod.Default) == new CMTime(5, 1), "ConvertScale #1"); // FromSeconds Assert.That(CMTime.FromSeconds(20, 1) == new CMTime(20, 1), "FromSeconds #1"); // GetMaximum Assert.That(CMTime.GetMaximum(v, y) == y, "GetMaximum #1"); // GetMinimum Assert.That(CMTime.GetMinimum(v, y) == v, "GetMinimum #1"); #if XAMCORE_2_0 using (var d = x.ToDictionary()) { Assert.That(d.RetainCount, Is.EqualTo((nint)1), "RetainCount"); Assert.That(d.Count, Is.EqualTo((nuint)4), "Count"); var time = CMTime.FromDictionary(d); Assert.That(time, Is.EqualTo(x), "FromDictionary"); } #endif }
public void MultiplyByRatio() { if (!UIDevice.CurrentDevice.CheckSystemVersion(7, 1)) { Assert.Inconclusive("Requires 7.1+"); } var t = new CMTime(1000, 1); t = CMTime.Multiply(t, 20, 10); Assert.That(t.Value, Is.EqualTo(2000), "Value"); }
public void MultiplyByRatio() { if (!TestRuntime.CheckXcodeVersion(5, 1)) { Assert.Inconclusive("Requires iOS 7.1+ or macOS 10.9+"); } var t = new CMTime(1000, 1); t = CMTime.Multiply(t, 20, 10); Assert.That(t.Value, Is.EqualTo(2000), "Value"); }