public void Atlas_MissingResource() { if (!TestRuntime.CheckSystemAndSDKVersion(7, 0)) { Assert.Ignore("Requires iOS7"); } using (var atlas = new SKTextureAtlas()) { // that returns a texture, calling 'MissingResource.png' (128 x 128) using (var texture = atlas.TextureNamed("ship")) { // this completionHandler is *NOT* optional -> crash if null SKTexture.PreloadTextures(new [] { texture }, CrashAvoider); // this completionHandler is *NOT* optional -> crash if null texture.Preload(CrashAvoider); Assert.That(texture.FilteringMode, Is.EqualTo(SKTextureFilteringMode.Linear), "FilteringMode"); // FIXME: bug in iOS9 - it will randomly return 0,0 (but almost always on the first try) if (!UIDevice.CurrentDevice.CheckSystemVersion(9, 0)) { Assert.That(texture.Size, Is.EqualTo(new SizeF(128, 128)), "Size"); } Assert.That(texture.TextureRect, Is.EqualTo(new RectangleF(0, 0, 1, 1)), "TextureRect"); Assert.False(texture.UsesMipmaps, "UsesMipmaps"); } } }
public void Atlas_MissingResource() { 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()) { // that returns a texture, calling 'MissingResource.png' (128 x 128) using (var texture = atlas.TextureNamed("ship")) { // this completionHandler is *NOT* optional -> crash if null SKTexture.PreloadTextures(new [] { texture }, CrashAvoider); // this completionHandler is *NOT* optional -> crash if null texture.Preload(CrashAvoider); Assert.That(texture.FilteringMode, Is.EqualTo(SKTextureFilteringMode.Linear), "FilteringMode"); #if !MONOMAC // FIXME: bug in iOS9 - it will randomly return 0,0 (but almost always on the first try) if (!TestRuntime.CheckSystemVersion(PlatformName.iOS, 9, 0, throwIfOtherPlatform: false)) { Assert.That(texture.Size, Is.EqualTo(new CGSize(128, 128)), "Size"); } #endif Assert.That(texture.TextureRect, Is.EqualTo(new CGRect(0, 0, 1, 1)), "TextureRect"); Assert.False(texture.UsesMipmaps, "UsesMipmaps"); } } }