public void Encode_UseCompression_WhenTextIsGreaterThenThreshold_Works <TPixel>(TestImageProvider <TPixel> provider)
            where TPixel : unmanaged, IPixel <TPixel>
        {
            var decoder = new PngDecoder();

            using (Image <TPixel> input = provider.GetImage(decoder))
                using (var memoryStream = new MemoryStream())
                {
                    // This will be a zTXt chunk.
                    var expectedText = new PngTextData("large-text", new string('c', 100), string.Empty, string.Empty);

                    // This will be a iTXt chunk.
                    var         expectedTextNoneLatin = new PngTextData("large-text-non-latin", new string('Ф', 100), "language-tag", "translated-keyword");
                    PngMetadata inputMetadata         = input.Metadata.GetFormatMetadata(PngFormat.Instance);
                    inputMetadata.TextData.Add(expectedText);
                    inputMetadata.TextData.Add(expectedTextNoneLatin);
                    input.Save(memoryStream, new PngEncoder
                    {
                        TextCompressionThreshold = 50
                    });

                    memoryStream.Position = 0;
                    using (Image <Rgba32> image = decoder.Decode <Rgba32>(Configuration.Default, memoryStream))
                    {
                        PngMetadata meta = image.Metadata.GetFormatMetadata(PngFormat.Instance);
                        Assert.Contains(meta.TextData, m => m.Equals(expectedText));
                        Assert.Contains(meta.TextData, m => m.Equals(expectedTextNoneLatin));
                    }
                }
        }
        public void AreEqual()
        {
            var property1 = new PngTextData("Foo", "Bar", "foo", "bar");
            var property2 = new PngTextData("Foo", "Bar", "foo", "bar");

            Assert.Equal(property1, property2);
            Assert.True(property1 == property2);
        }
        public void AreNotEqual()
        {
            var property1 = new PngTextData("Foo", "Bar", "foo", "bar");
            var property2 = new PngTextData("Foo", "Foo", string.Empty, string.Empty);
            var property3 = new PngTextData("Bar", "Bar", "unit", "test");
            var property4 = new PngTextData("Foo", null, "test", "case");

            Assert.NotEqual(property1, property2);
            Assert.True(property1 != property2);

            Assert.NotEqual(property1, property3);
            Assert.NotEqual(property1, property4);
        }
        public void ConstructorAssignsProperties()
        {
            var property = new PngTextData("Foo", null, "unit", "test");

            Assert.Equal("Foo", property.Keyword);
            Assert.Null(property.Value);
            Assert.Equal("unit", property.LanguageTag);
            Assert.Equal("test", property.TranslatedKeyword);

            property = new PngTextData("Foo", string.Empty, string.Empty, null);
            Assert.Equal("Foo", property.Keyword);
            Assert.Equal(string.Empty, property.Value);
            Assert.Equal(string.Empty, property.LanguageTag);
            Assert.Null(property.TranslatedKeyword);
        }