Example #1
0
        public void ToStringTest()
        {
            var rect = new CGRect((nfloat)1, (nfloat)2, (nfloat)3, (nfloat)4);

#if NET
            Assert.AreEqual("{{1, 2}, {3, 4}}", rect.ToString(), "ToString");
#else
            Assert.AreEqual("{X=1,Y=2,Width=3,Height=4}", rect.ToString(), "ToString");
#endif
        }
Example #2
0
        // Overridden from UIView
        public override void Draw(CGRect rect)
        {
            Log.D(this, rect.ToString());

            using (var context = UIGraphics.GetCurrentContext()) {
                DrawTrace(context);
            }
        }
Example #3
0
        public DeviceDetailController()
        {
            CGRect bounds = WKInterfaceDevice.CurrentDevice.ScreenBounds;
            nfloat scale  = WKInterfaceDevice.CurrentDevice.ScreenScale;

            boundsLabel.SetText(bounds.ToString());
            scaleLabel.SetText(scale.ToString());
            preferredContentSizeLabel.SetText(WKInterfaceDevice.CurrentDevice.PreferredContentSizeCategory);
        }
        public void InitWithFrame()
        {
#if !MONOMAC
            // Crashes with EXC_BAD_ACCESS (SIGABRT) if < iOS 7.0
            TestRuntime.AssertSystemVersion(PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
#endif

            var frame = new CGRect(10, 10, 100, 100);
            using (var av = new MKPinAnnotationView(frame)) {
                Assert.That(av.Frame.ToString(), Is.EqualTo(frame.ToString()), "Frame");                     // fp comparison fails
                Assert.Null(av.Annotation, "Annotation");
                Assert.False(av.AnimatesDrop, "AnimatesDrop");

                if (!TestRuntime.CheckXcodeVersion(7, 0))
                {
                    return;
                }

                Assert.That(av.PinColor, Is.EqualTo(MKPinAnnotationColor.Red), "PinColor");
#if MONOMAC
                if (TestRuntime.CheckSystemVersion(PlatformName.MacOSX, 10, 12))
                {
                    Assert.That(av.PinTintColor, Is.EqualTo(NSColor.SystemRedColor), "PinTintColor");
                }
                else
                {
                    Assert.Null(av.PinTintColor, "PinTintColor");                      // differs from the other init call
                }
#else
                bool not_null = TestRuntime.CheckSystemVersion(PlatformName.iOS, 10, 0);
                if (not_null)
                {
                    Assert.NotNull(av.PinTintColor, "PinTintColor");
                }
                else
                {
                    Assert.Null(av.PinTintColor, "PinTintColor");                      // differs from the other init call
                }
#endif
            }
        }