示例#1
0
        public void CreateICCProfile()
        {
            // of all the .icc profiles I have on my Mac then only one I found working is
            // for my old 15" sharp (secondary) display. Added it to the test suite
            // that should work on the iOS simulator - at least some as I'm not sure every Mac
            // has the file(s) so we're not trying (and fialing) to copy it into the bundle
            using (var icc = NSData.FromFile(Path.Combine(NSBundle.MainBundle.ResourcePath, "LL-171A-B-B797E457-16AB-C708-1E0F-32C19DBD47B5.icc")))
                using (var cs = CGColorSpace.CreateICCProfile(icc)) {
                    Assert.That(cs.Components, Is.EqualTo((nint)3), "Components");
                    Assert.That(cs.Model, Is.EqualTo(CGColorSpaceModel.RGB), "Model");
                    Assert.Null(cs.GetBaseColorSpace(), "GetBaseColorSpace");
                    // not indexed so no color table
                    Assert.That(cs.GetColorTable().Length, Is.EqualTo(0), "GetColorTable");

                    if (TestRuntime.CheckXcodeVersion(5, 0))
                    {
                        using (var icc_profile = cs.GetICCProfile())
                            Assert.That(icc_profile.Length, Is.EqualTo(3284), "GetICCProfile");
                    }

                    if (TestRuntime.CheckXcodeVersion(8, 0))
                    {
                        Assert.Null(cs.Name, "Name");
                        Assert.False(cs.IsWideGamutRgb, "IsWideGamutRgb");
                        Assert.True(cs.SupportsOutput, "SupportsOutput");
                        using (var icc_data = cs.GetIccData())
                            Assert.That(icc_data.Length, Is.EqualTo(3284), "GetIccData");
                    }
                }
        }
示例#2
0
        public void CreateICCProfile()
        {
            // of all the .icc profiles I have on my Mac then only one I found working is
            // for my old 15" sharp (secondary) display. Added it to the test suite
            // that should work on the iOS simulator - at least some as I'm not sure every Mac
            // has the file(s) so we're not trying (and fialing) to copy it into the bundle
            using (var icc = NSData.FromFile(Path.Combine(NSBundle.MainBundle.ResourcePath, "LL-171A-B-B797E457-16AB-C708-1E0F-32C19DBD47B5.icc")))
#if NET
                using (var cs = CGColorSpace.CreateIccProfile(icc)) {
                    TestICC(cs);
                }

            using (var space = CGColorSpace.CreateIccProfile((NSData)null)) {
                Assert.IsNull(space, "null data");
            }
#else
                using (var cs = CGColorSpace.CreateICCProfile(icc)) {
                    TestICC(cs);
                }

            using (var space = CGColorSpace.CreateICCProfile((NSData)null)) {
                Assert.IsNull(space, "null data");
            }
#endif
        }