예제 #1
0
        public void CreateExtendedSrgb()
        {
            if (!TestRuntime.CheckXcodeVersion(8, 0))
            {
                Assert.Ignore("Requires iOS 10+");
            }

            using (var cs = CGColorSpace.CreateWithName(CGColorSpaceNames.ExtendedSrgb)) {
                Assert.That(cs.Components, Is.EqualTo((nint)3), "3");
                Assert.That(cs.Model, Is.EqualTo(CGColorSpaceModel.RGB), "RGB");
                Assert.Null(cs.GetBaseColorSpace(), "GetBaseColorSpace");
                // not indexed so no color table
                Assert.That(cs.GetColorTable().Length, Is.EqualTo(0), "GetColorTable");

                using (var icc_profile = cs.GetICCProfile())
                    Assert.That(icc_profile.Length, Is.EqualTo(3144), "GetICCProfile");

                Assert.That(cs.Name, Is.EqualTo(CGColorSpaceNames.ExtendedSrgb.ToString()), "Name");
                Assert.True(cs.IsWideGamutRgb, "IsWideGamutRgb");
                Assert.True(cs.SupportsOutput, "SupportsOutput");

                using (var icc_data = cs.GetIccData())
                    Assert.That(icc_data.Length, Is.EqualTo(3144), "GetIccData");
            }
        }
예제 #2
0
        public void Disposed()
        {
            if (!TestRuntime.CheckXcodeVersion(8, 0))
            {
                Assert.Ignore("Requires iOS 10+");
            }

            var cs = CGColorSpace.CreateWithName(CGColorSpaceNames.ExtendedSrgb);

            cs.Dispose();

            Assert.That(cs.Components, Is.EqualTo((nint)0), "0");
            Assert.That(cs.Model, Is.EqualTo(CGColorSpaceModel.Unknown), "Unknown");
            Assert.Null(cs.GetBaseColorSpace(), "GetBaseColorSpace");
            Assert.That(cs.GetColorTable().Length, Is.EqualTo(0), "GetColorTable");
#if NET
            Assert.Null(cs.GetIccProfile(), "GetIccProfile");
#else
            Assert.Null(cs.GetICCProfile(), "GetICCProfile");
#endif
            Assert.Null(cs.Name, "Name");
            Assert.False(cs.IsWideGamutRgb, "IsWideGamutRgb");
            Assert.False(cs.SupportsOutput, "SupportsOutput");
            Assert.Null(cs.GetIccData(), "GetIccData");
            // IOW all safe to call with a `nil` handle
        }
예제 #3
0
 public void CGColorSpaceUsesITUR_2100TFTest()
 {
     TestRuntime.AssertXcodeVersion(12, TestRuntime.MinorXcode12APIMismatch);
     using (var cs = CGColorSpace.CreateWithName(CGColorSpaceNames.DisplayP3_Hlg))
         Assert.True(cs.UsesItur2100TF, "DisplayP3_Hlg");
     using (var cs = CGColorSpace.CreateWithName(CGColorSpaceNames.GenericRgb))
         Assert.False(cs.UsesItur2100TF, "GenericRgb");
 }
예제 #4
0
 public void IsHdr()
 {
     TestRuntime.AssertXcodeVersion(11, 0);
     using (var cs = CGColorSpace.CreateWithName(CGColorSpaceNames.GenericRgb))
         Assert.False(cs.IsHdr, "GenericRgb");
     using (var cs = CGColorSpace.CreateWithName(CGColorSpaceNames.DisplayP3_Hlg))
         Assert.True(cs.IsHdr, "DisplayP3_Hlg");
 }
예제 #5
0
 public void CreateExtendedLinearizedTest()
 {
     TestRuntime.AssertXcodeVersion(12, TestRuntime.MinorXcode12APIMismatch);
     using (var cs = CGColorSpace.CreateWithName(CGColorSpaceNames.GenericRgb)) {
         var csl = cs.CreateExtendedLinearized();
         Assert.NotNull(csl, "not null");
         Assert.That((nint)TestRuntime.CFGetRetainCount(csl.Handle), Is.EqualTo((nint)1));
     }
 }