Ejemplo n.º 1
0
        public void MarkerHashCodeIsUnique()
        {
            AdobeMarker.TryParse(this.bytes, out var marker);
            AdobeMarker.TryParse(this.bytes2, out var marker2);

            Assert.False(marker.GetHashCode().Equals(marker2.GetHashCode()));
        }
Ejemplo n.º 2
0
        public void MarkerHashCodeIsReplicable()
        {
            AdobeMarker.TryParse(this.bytes, out var marker);
            AdobeMarker.TryParse(this.bytes, out var marker2);

            Assert.True(marker.GetHashCode().Equals(marker2.GetHashCode()));
        }
Ejemplo n.º 3
0
        public void MarkerInEqualityIsCorrect()
        {
            AdobeMarker.TryParse(this.bytes, out var marker);
            AdobeMarker.TryParse(this.bytes2, out var marker2);

            Assert.False(marker.Equals(marker2));
        }
Ejemplo n.º 4
0
        public void MarkerIgnoresIncorrectValue()
        {
            bool isAdobe = AdobeMarker.TryParse(new byte[] { 0, 0, 0, 0 }, out var marker);

            Assert.False(isAdobe);
            Assert.Equal(default(AdobeMarker), marker);
        }
Ejemplo n.º 5
0
        public void MarkerReturnsCorrectParsedValue()
        {
            bool isAdobe = AdobeMarker.TryParse(this.bytes, out AdobeMarker marker);

            Assert.True(isAdobe);
            Assert.Equal(100, marker.DCTEncodeVersion);
            Assert.Equal(0, marker.APP14Flags0);
            Assert.Equal(0, marker.APP14Flags1);
            Assert.Equal(JpegConstants.Adobe.ColorTransformYcck, marker.ColorTransform);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Processes the application header containing the Adobe identifier
        /// which stores image encoding information for DCT filters.
        /// </summary>
        /// <param name="remaining">The remaining bytes in the segment block.</param>
        private void ProcessApp14Marker(int remaining)
        {
            const int MarkerLength = AdobeMarker.Length;

            if (remaining < MarkerLength)
            {
                // Skip the application header length
                this.InputProcessor.Skip(remaining);
                return;
            }

            this.InputProcessor.ReadFull(this.Temp, 0, MarkerLength);
            remaining -= MarkerLength;

            this.isAdobe = AdobeMarker.TryParse(this.Temp, out this.adobe);

            if (remaining > 0)
            {
                this.InputProcessor.Skip(remaining);
            }
        }