-
Notifications
You must be signed in to change notification settings - Fork 328
Expand file tree
/
Copy pathGifExiftoolLongCommentTest.cs
More file actions
48 lines (43 loc) · 2.73 KB
/
GifExiftoolLongCommentTest.cs
File metadata and controls
48 lines (43 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using NUnit.Framework;
using TagLib;
using TaglibSharp.Tests.Images.Validators;
namespace TaglibSharp.Tests.Images
{
[TestFixture]
public class GifExiftoolLongCommentTest
{
static readonly string long_comment_orig = "This is a very long comment, because long comments must be stored in mutiple sub-blocks. This comment is used to check that long comments are parsed correctly and that they are written back correctly. So what else to say? taglib rocks - 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz";
static readonly string long_comment_test = "ABCD " + long_comment_orig + " CDEF " + long_comment_orig;
[Test]
public void Test ()
{
// This file is originally created with GIMP and the metadata was modified
// by exiftool. A very long comment is added by exiftool because such comments
// are stored in multiple sub-blocks. This should be handled by taglib.
ImageTest.Run ("sample_exiftool_long_comment.gif",
true,
new GifExiftoolLongCommentTestInvariantValidator (),
NoModificationValidator.Instance,
new TagKeywordsModificationValidator (Array.Empty<string> (), TagTypes.XMP, true),
new CommentModificationValidator (long_comment_orig),
new CommentModificationValidator (long_comment_orig, long_comment_test),
new TagCommentModificationValidator (long_comment_orig, TagTypes.GifComment, true),
new TagCommentModificationValidator (long_comment_orig, long_comment_test, TagTypes.GifComment, true),
new RemoveMetadataValidator (TagTypes.GifComment | TagTypes.XMP),
new RemoveMetadataValidator (TagTypes.GifComment | TagTypes.XMP, TagTypes.GifComment),
new RemoveMetadataValidator (TagTypes.GifComment | TagTypes.XMP, TagTypes.XMP)
);
}
}
public class GifExiftoolLongCommentTestInvariantValidator : IMetadataInvariantValidator
{
public void ValidateMetadataInvariants (TagLib.Image.File file)
{
Assert.IsNotNull (file);
Assert.IsNotNull (file.Properties);
Assert.AreEqual (12, file.Properties.PhotoWidth);
Assert.AreEqual (37, file.Properties.PhotoHeight);
}
}
}