Search code examples
delphigpslazarus

Installing CCR.EXIF Package in lazarus


I have installed the package CCR.EXIF which I found here. But I have some issues with it.

I found the Code for reading GPS Information About a Image and I tried to use that Code but I get Errors on CheckTrue and now I'm not sure if thats a other programing language or if I made a installing mistake.

procedure TstExifLE.ReadGPSTest;

var
imgInfo: TImgInfo;
lTag: TTag;
begin
  imgInfo := TImgInfo.Create;
  try
imgInfo.LoadFromFile(WorkFile_JpegWithExif);

lTag := imgInfo.ExifData.TagByName['GPSVersionID'];
CheckTrue(lTag <> nil, 'Tag "GPSVersionID" not found');
CheckTrue(lTag is TVersionTag, 'Tag "GPSVersionID" is not TVersionTag');
TVersionTag(lTag).Separator := '.';
CheckEquals('2.3.0.0', lTag.AsString, 'Value mismatch of tag "GPSVersionID"');

lTag := imgInfo.ExifData.TagByName['GPSLatitude'];
CheckTrue(lTag <> nil, 'Tag "GPSLatitude" not found');
CheckTrue(lTag is TGPSPositionTag, 'Tag "GPSLatitude" is not a TGpsPositionTag');
TGpsPositionTag(lTag).FormatStr := '%0:.0f deg %1:.0f'' %2:.2f"';
CheckEquals('51 deg 33'' 48.28"', lTag.AsString, 'Value mismatch of tag "GPSLatitude"');

lTag := imgInfo.ExifData.TagByName['GPSLatitudeRef'];
CheckTrue(lTag <> nil, 'Tag "GPSLatitudeRef" not found');
CheckEquals('South', lTag.AsString, 'Value mismatch of tag "GPSLatitudeRef"');

lTag := imgInfo.ExifData.TagByName['GPSLongitude'];
CheckTrue(lTag <> nil, 'Tag "GPSLongitude" not found');
CheckTrue(lTag is TGPSPositionTag, 'Tag "GPSLongitude" is not a TGpsPositionTag');
TGpsPositionTag(lTag).FormatStr := '%0:.0f deg %1:.0f'' %2:.2f"';
CheckEquals('59 deg 49'' 53.55"', lTag.AsString, 'Value mismatch of tag "GPSLongitude"');

lTag := imgInfo.ExifData.TagByName['GPSLongitudeRef'];
CheckTrue(lTag <> nil, 'Tag "GPSLongitudeRef" not found');
CheckEquals('West', lTag.AsString, 'Value mismatch of tag "GPSLongitudeRef"');

finally
imgInfo.Free;
  end;
end; 

Error Message:

-Identifier not found 'TstExifLE'

-Identifier not found 'CheckTrue'

-Identifier not found 'CheckEquals'

Edit I made the class TstExifLe and that is the following error I get

Identifier not found 'TTestCase'


Solution

  • The code you have found is part of a DUnit test. All DUnit tests descend from TTestCase and use methods CheckTrue, CheckEquals etc as assertions that the test has passed. You will need to re-factor the code to eliminate the need for DUnit in order to compile it, or if you just want to see it in action download and install DUnit.