Esempio n. 1
0
        public void Empty()
        {
            TestRuntime.AssertSystemVersion(PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
            TestRuntime.AssertSystemVersion(PlatformName.TvOS, 9, 0, throwIfOtherPlatform: false);
            TestRuntime.AssertSystemVersion(PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
            TestRuntime.AssertSystemVersion(PlatformName.WatchOS, 3, 0, throwIfOtherPlatform: false);

            using (var atlas = new SKTextureAtlas()) {
                Assert.That(atlas.TextureNames, Is.Empty, "TextureNames");

                // this completionHandler is *NOT* optional -> crash if null
                SKTextureAtlas.PreloadTextures(new [] { atlas }, CrashAvoider);

                // this completionHandler is *NOT* optional -> crash if null
                atlas.Preload(CrashAvoider);

                // that returns a texture, calling 'MissingResource.png' (128 x 128)
                using (var texture = atlas.TextureNamed("ship")) {
                    Assert.That(texture.Handle, Is.Not.EqualTo(IntPtr.Zero), "valid");
                }
            }
        }
Esempio n. 2
0
        public void Empty()
        {
            if (!TestRuntime.CheckSystemAndSDKVersion(7, 0))
            {
                Assert.Ignore("Requires iOS7");
            }

            using (var atlas = new SKTextureAtlas()) {
                Assert.That(atlas.TextureNames, Is.Empty, "TextureNames");

                // this completionHandler is *NOT* optional -> crash if null
                SKTextureAtlas.PreloadTextures(new [] { atlas }, CrashAvoider);

                // this completionHandler is *NOT* optional -> crash if null
                atlas.Preload(CrashAvoider);

                // that returns a texture, calling 'MissingResource.png' (128 x 128)
                using (var texture = atlas.TextureNamed("ship")) {
                    Assert.That(texture.Handle, Is.Not.EqualTo(IntPtr.Zero), "valid");
                }
            }
        }