fpexif: Add AddOrReplaceTagByID and ..ByName methods to TExifData.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8773 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-03-24 11:08:35 +00:00
parent 8d0a937afc
commit bc05074d55
4 changed files with 46 additions and 6 deletions

View File

@ -345,6 +345,10 @@ begin
CheckTrue(lTag <> nil, 'Tag "ExifImageHeight" not found for writing');
lTag.AsInteger := 267;
lTag := imgInfo.ExifData.AddTagByName('EXIF.Artist');
Checktrue(lTag <> nil, 'Tag "EXIF.Artist" not found for writing');
lTag.AsString := 'fpexif-artist';
// Save to file;
// Takes the image data from WorkFile_WithExif, replaces its EXIF with the
// current EXIF structure and writes to WorkFile_NoExif.
@ -422,6 +426,10 @@ begin
CheckTrue(lTag <> nil, 'Tag "ExifImageHeight" not found');
CheckEquals(267, lTag.AsInteger, 'Value mismatch of tag "ExifImageHeight"');
lTag := ImgInfo.ExifData.TagByName['EXIF.Artist'];
CheckTrue(lTag <> nil, 'Tag "EXIF.Artist" not found');
CheckEquals('fpexif-artist', lTag.AsString, 'Value mismatch of tag "EXIF.Artist"');
// No thumbnail in dest file!
finally

View File

@ -496,6 +496,10 @@ begin
CheckTrue(lTag <> nil, 'Tag "ExifImageHeight" not found for writing');
lTag.AsInteger := 150;
lTag := imgInfo.ExifData.AddTagByName('EXIF.Artist');
Checktrue(lTag <> nil, 'Tag "EXIF.Artist" not found for writing');
lTag.AsString := 'fpexif-artist';
// Save to file;
// Takes the image data from WorkFile_WithExif, replaces its EXIF with the
// current EXIF structure and writes to WorkFile_NoExif.
@ -558,6 +562,10 @@ begin
CheckTrue(lTag <> nil, 'Tag "ExifImageHeight" not found for reading');
CheckEquals('150', lTag.AsString, 'Value mismatch of tag "ExifImageHeight"');
lTag := ImgInfo.ExifData.TagByName['EXIF.Artist'];
CheckTrue(lTag <> nil, 'Tag "EXIF.Artist" not found');
CheckEquals('fpexif-artist', lTag.AsString, 'Value mismatch of tag "EXIF.Artist"');
finally
imgInfo.Free;
end;