Add unit tests

master
Les De Ridder 7 years ago
parent 63ed580d58
commit f0454ee16b
No known key found for this signature in database
GPG Key ID: 5EC132DFA85DB372

1
.gitignore vendored

@ -4,3 +4,4 @@ __dummy.html
*.o
*.obj
libexempi-d.a
__test__unittest__

@ -3,3 +3,14 @@ description "D bindings for exempi"
authors "Les De Ridder"
license "BSD 3-clause"
targetType "library"
libs "exempi"
configuration "library" {
sourcePaths "source"
importPaths "source"
}
configuration "unittest" {
sourcePaths "tests"
importPaths "source" "tests"
}

@ -0,0 +1,65 @@
/*
* exempi-d - tests/init.d
*
* Bindings by Les De Ridder <les@lesderid.net>
*
* Copyright (C) 2007-2016 Hubert Figuiere
* Copyright 2002-2007 Adobe Systems Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1 Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2 Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* 3 Neither the name of the Authors, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software wit hout specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
unittest
{
import exempi.xmp;
import std.file;
auto file = read("tests/samples/test1.xmp");
auto len = file.length;
auto buffer = cast(const char*)file.ptr;
assert(xmp_init());
assert(xmp_init());
XmpPtr xmp = xmp_new_empty();
assert(xmp_parse(xmp, buffer, len));
assert(xmp !is null);
assert(xmp_free(xmp));
xmp_terminate();
xmp = xmp_new_empty();
assert(xmp_parse(xmp, buffer, len));
assert(xmp !is null);
assert(xmp_free(xmp));
xmp_terminate();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

@ -0,0 +1,255 @@
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Public XMP Toolkit Core 3.5">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
<tiff:Make>Canon</tiff:Make>
<tiff:Model>Canon EOS 20D</tiff:Model>
<tiff:Orientation>1</tiff:Orientation>
<tiff:ImageWidth>3504</tiff:ImageWidth>
<tiff:ImageLength>2336</tiff:ImageLength>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:exif="http://ns.adobe.com/exif/1.0/">
<exif:ExifVersion>0221</exif:ExifVersion>
<exif:ExposureTime>15/1</exif:ExposureTime>
<exif:ShutterSpeedValue>-3906891/1000000</exif:ShutterSpeedValue>
<exif:FNumber>8/1</exif:FNumber>
<exif:ApertureValue>6/1</exif:ApertureValue>
<exif:ExposureProgram>1</exif:ExposureProgram>
<exif:DateTimeOriginal>2006-12-07T23:20:43-05:00</exif:DateTimeOriginal>
<exif:DateTimeDigitized>2006-12-07T23:20:43-05:00</exif:DateTimeDigitized>
<exif:ExposureBiasValue>0/2</exif:ExposureBiasValue>
<exif:MaxApertureValue>3625/1000</exif:MaxApertureValue>
<exif:MeteringMode>5</exif:MeteringMode>
<exif:FocalLength>32/1</exif:FocalLength>
<exif:CustomRendered>0</exif:CustomRendered>
<exif:ExposureMode>1</exif:ExposureMode>
<exif:WhiteBalance>0</exif:WhiteBalance>
<exif:SceneCaptureType>0</exif:SceneCaptureType>
<exif:FocalPlaneXResolution>3504000/885</exif:FocalPlaneXResolution>
<exif:FocalPlaneYResolution>2336000/590</exif:FocalPlaneYResolution>
<exif:FocalPlaneResolutionUnit>2</exif:FocalPlaneResolutionUnit>
<exif:ISOSpeedRatings>
<rdf:Seq>
<rdf:li>100</rdf:li>
</rdf:Seq>
</exif:ISOSpeedRatings>
<exif:Flash rdf:parseType="Resource">
<exif:Fired>False</exif:Fired>
<exif:Return>0</exif:Return>
<exif:Mode>2</exif:Mode>
<exif:Function>False</exif:Function>
<exif:RedEyeMode>False</exif:RedEyeMode>
</exif:Flash>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xap="http://ns.adobe.com/xap/1.0/">
<xap:ModifyDate>2006-12-07T23:20:43-05:00</xap:ModifyDate>
<xap:Rating>3</xap:Rating>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:creator>
<rdf:Seq>
<rdf:li>unknown</rdf:li>
</rdf:Seq>
</dc:creator>
<dc:rights>
<rdf:Alt>
<rdf:li xml:lang="x-default">2006, Hubert Figuiere</rdf:li>
</rdf:Alt>
</dc:rights>
<dc:subject>
<rdf:Bag>
<rdf:li>night</rdf:li>
<rdf:li>ontario</rdf:li>
<rdf:li>ottawa</rdf:li>
<rdf:li>parliament of canada</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:aux="http://ns.adobe.com/exif/1.0/aux/">
<aux:SerialNumber>420103070</aux:SerialNumber>
<aux:LensInfo>24/1 85/1 0/0 0/0</aux:LensInfo>
<aux:Lens>24.0-85.0 mm</aux:Lens>
<aux:ImageNumber>176</aux:ImageNumber>
<aux:FlashCompensation>-2/1</aux:FlashCompensation>
<aux:OwnerName>unknown</aux:OwnerName>
<aux:Firmware>1.1.0</aux:Firmware>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/">
<crs:AlreadyApplied>False</crs:AlreadyApplied>
<crs:WhiteBalance>As Shot</crs:WhiteBalance>
<crs:Exposure>0.00</crs:Exposure>
<crs:Shadows>5</crs:Shadows>
<crs:Brightness>+50</crs:Brightness>
<crs:Contrast>+25</crs:Contrast>
<crs:Saturation>0</crs:Saturation>
<crs:Sharpness>25</crs:Sharpness>
<crs:LuminanceSmoothing>0</crs:LuminanceSmoothing>
<crs:ColorNoiseReduction>25</crs:ColorNoiseReduction>
<crs:ChromaticAberrationR>0</crs:ChromaticAberrationR>
<crs:ChromaticAberrationB>0</crs:ChromaticAberrationB>
<crs:VignetteAmount>0</crs:VignetteAmount>
<crs:ShadowTint>0</crs:ShadowTint>
<crs:RedHue>0</crs:RedHue>
<crs:RedSaturation>0</crs:RedSaturation>
<crs:GreenHue>0</crs:GreenHue>
<crs:GreenSaturation>0</crs:GreenSaturation>
<crs:BlueHue>0</crs:BlueHue>
<crs:BlueSaturation>0</crs:BlueSaturation>
<crs:FillLight>0</crs:FillLight>
<crs:Vibrance>0</crs:Vibrance>
<crs:HighlightRecovery>0</crs:HighlightRecovery>
<crs:Clarity>0</crs:Clarity>
<crs:Defringe>0</crs:Defringe>
<crs:HueAdjustmentRed>0</crs:HueAdjustmentRed>
<crs:HueAdjustmentOrange>0</crs:HueAdjustmentOrange>
<crs:HueAdjustmentYellow>0</crs:HueAdjustmentYellow>
<crs:HueAdjustmentGreen>0</crs:HueAdjustmentGreen>
<crs:HueAdjustmentAqua>0</crs:HueAdjustmentAqua>
<crs:HueAdjustmentBlue>0</crs:HueAdjustmentBlue>
<crs:HueAdjustmentPurple>0</crs:HueAdjustmentPurple>
<crs:HueAdjustmentMagenta>0</crs:HueAdjustmentMagenta>
<crs:SaturationAdjustmentRed>0</crs:SaturationAdjustmentRed>
<crs:SaturationAdjustmentOrange>0</crs:SaturationAdjustmentOrange>
<crs:SaturationAdjustmentYellow>0</crs:SaturationAdjustmentYellow>
<crs:SaturationAdjustmentGreen>0</crs:SaturationAdjustmentGreen>
<crs:SaturationAdjustmentAqua>0</crs:SaturationAdjustmentAqua>
<crs:SaturationAdjustmentBlue>0</crs:SaturationAdjustmentBlue>
<crs:SaturationAdjustmentPurple>0</crs:SaturationAdjustmentPurple>
<crs:SaturationAdjustmentMagenta>0</crs:SaturationAdjustmentMagenta>
<crs:LuminanceAdjustmentRed>0</crs:LuminanceAdjustmentRed>
<crs:LuminanceAdjustmentOrange>0</crs:LuminanceAdjustmentOrange>
<crs:LuminanceAdjustmentYellow>0</crs:LuminanceAdjustmentYellow>
<crs:LuminanceAdjustmentGreen>0</crs:LuminanceAdjustmentGreen>
<crs:LuminanceAdjustmentAqua>0</crs:LuminanceAdjustmentAqua>
<crs:LuminanceAdjustmentBlue>0</crs:LuminanceAdjustmentBlue>
<crs:LuminanceAdjustmentPurple>0</crs:LuminanceAdjustmentPurple>
<crs:LuminanceAdjustmentMagenta>0</crs:LuminanceAdjustmentMagenta>
<crs:SplitToningShadowHue>0</crs:SplitToningShadowHue>
<crs:SplitToningShadowSaturation>0</crs:SplitToningShadowSaturation>
<crs:SplitToningHighlightHue>0</crs:SplitToningHighlightHue>
<crs:SplitToningHighlightSaturation>0</crs:SplitToningHighlightSaturation>
<crs:SplitToningBalance>0</crs:SplitToningBalance>
<crs:ParametricShadows>0</crs:ParametricShadows>
<crs:ParametricDarks>0</crs:ParametricDarks>
<crs:ParametricLights>0</crs:ParametricLights>
<crs:ParametricHighlights>0</crs:ParametricHighlights>
<crs:ParametricShadowSplit>25</crs:ParametricShadowSplit>
<crs:ParametricMidtoneSplit>50</crs:ParametricMidtoneSplit>
<crs:ParametricHighlightSplit>75</crs:ParametricHighlightSplit>
<crs:SharpenRadius>+1.0</crs:SharpenRadius>
<crs:SharpenDetail>25</crs:SharpenDetail>
<crs:SharpenEdgeMasking>0</crs:SharpenEdgeMasking>
<crs:ConvertToGrayscale>False</crs:ConvertToGrayscale>
<crs:ToneCurveName>Medium Contrast</crs:ToneCurveName>
<crs:ToneCurve>
<rdf:Seq>
<rdf:li>0, 0</rdf:li>
<rdf:li>32, 22</rdf:li>
<rdf:li>64, 56</rdf:li>
<rdf:li>128, 128</rdf:li>
<rdf:li>192, 196</rdf:li>
<rdf:li>255, 255</rdf:li>
</rdf:Seq>
</crs:ToneCurve>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:crx="http://ns.adobe.com/lightroom-settings-experimental/1.0/">
<crx:ConvertToGrayscale>false</crx:ConvertToGrayscale>
<crx:SplitToningHighlightHue>0</crx:SplitToningHighlightHue>
<crx:Sharpness>25</crx:Sharpness>
<crx:CropBottom>1</crx:CropBottom>
<crx:GreenSaturation>0</crx:GreenSaturation>
<crx:Exposure>0</crx:Exposure>
<crx:LuminanceAdjustmentGreens>0</crx:LuminanceAdjustmentGreens>
<crx:SplitToningShadowHue>0</crx:SplitToningShadowHue>
<crx:BlueHue>0</crx:BlueHue>
<crx:GreenHue>0</crx:GreenHue>
<crx:FillLight>0</crx:FillLight>
<crx:HueAdjustmentCyans>0</crx:HueAdjustmentCyans>
<crx:SaturationAdjustmentGreens>0</crx:SaturationAdjustmentGreens>
<crx:Saturation>0</crx:Saturation>
<crx:SaturationAdjustmentBlues>0</crx:SaturationAdjustmentBlues>
<crx:VignetteMidpoint>50</crx:VignetteMidpoint>
<crx:ToneHighlightSplit>75</crx:ToneHighlightSplit>
<crx:ToneShadowSplit>25</crx:ToneShadowSplit>
<crx:Contrast>25</crx:Contrast>
<crx:WhiteBalance>As Shot</crx:WhiteBalance>
<crx:HueAdjustmentMagentas>0</crx:HueAdjustmentMagentas>
<crx:HighlightRecovery>0</crx:HighlightRecovery>
<crx:SaturationAdjustmentCyans>0</crx:SaturationAdjustmentCyans>
<crx:GrayMixerYellows>100</crx:GrayMixerYellows>
<crx:HueAdjustmentGreens>0</crx:HueAdjustmentGreens>
<crx:ToneShadows>0</crx:ToneShadows>
<crx:GrayMixerGreens>71</crx:GrayMixerGreens>
<crx:GrayMixerBlues>0</crx:GrayMixerBlues>
<crx:ColorNoiseReduction>25</crx:ColorNoiseReduction>
<crx:ShadowTint>0</crx:ShadowTint>
<crx:Shadows>5</crx:Shadows>
<crx:RedHue>0</crx:RedHue>
<crx:Brightness>50</crx:Brightness>
<crx:BlueSaturation>0</crx:BlueSaturation>
<crx:CropTop>0</crx:CropTop>
<crx:SaturationAdjustmentMagentas>0</crx:SaturationAdjustmentMagentas>
<crx:GrayMixerReds>29</crx:GrayMixerReds>
<crx:AutoBrightness>false</crx:AutoBrightness>
<crx:AutoTonality>false</crx:AutoTonality>
<crx:AutoExposure>false</crx:AutoExposure>
<crx:RedSaturation>0</crx:RedSaturation>
<crx:LuminanceAdjustmentMagentas>0</crx:LuminanceAdjustmentMagentas>
<crx:LuminanceAdjustmentBlues>0</crx:LuminanceAdjustmentBlues>
<crx:HueAdjustmentBlues>0</crx:HueAdjustmentBlues>
<crx:SaturationAdjustmentReds>0</crx:SaturationAdjustmentReds>
<crx:LuminanceAdjustmentYellows>0</crx:LuminanceAdjustmentYellows>
<crx:SplitToningShadowSaturation>0</crx:SplitToningShadowSaturation>
<crx:ChromaticAberrationR>0</crx:ChromaticAberrationR>
<crx:LuminanceAdjustmentCyans>0</crx:LuminanceAdjustmentCyans>
<crx:CropAngle>0</crx:CropAngle>
<crx:ChromaticAberrationB>0</crx:ChromaticAberrationB>
<crx:AutoShadows>false</crx:AutoShadows>
<crx:CropRight>1</crx:CropRight>
<crx:ToneLights>0</crx:ToneLights>
<crx:HueAdjustmentReds>0</crx:HueAdjustmentReds>
<crx:Vibrance>0</crx:Vibrance>
<crx:ToneDarks>0</crx:ToneDarks>
<crx:GrayMixerMagentas>29</crx:GrayMixerMagentas>
<crx:LuminanceSmoothing>0</crx:LuminanceSmoothing>
<crx:SplitToningHighlightSaturation>0</crx:SplitToningHighlightSaturation>
<crx:HueAdjustmentYellows>0</crx:HueAdjustmentYellows>
<crx:GrayMixerCyans>71</crx:GrayMixerCyans>
<crx:ToneMidtoneSplit>50</crx:ToneMidtoneSplit>
<crx:VignetteAmount>0</crx:VignetteAmount>
<crx:AutoContrast>false</crx:AutoContrast>
<crx:CropLeft>0</crx:CropLeft>
<crx:ToneHighlights>0</crx:ToneHighlights>
<crx:AutoGrayscaleWeights>true</crx:AutoGrayscaleWeights>
<crx:SaturationAdjustmentYellows>0</crx:SaturationAdjustmentYellows>
<crx:LuminanceAdjustmentReds>0</crx:LuminanceAdjustmentReds>
<crx:Tint>1</crx:Tint>
<crx:Temperature>4350</crx:Temperature>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:lr="http://ns.adobe.com/lightroom/1.0/">
<lr:hierarchicalKeywords>aGllcmFyY2hpY2FsS2V5d29yZHMgPSB7Cgl7CgkJZmxhdCA9IHsKCQkJIm5pZ2h0IiwKCQl9LAoJCXBhdGggPSB7CgkJCSJuaWdodCIsCgkJfSwKCQlwcmltYXJ5ID0gIm5pZ2h0IiwKCQl1dWlkID0gIkU1RDEwQTFELTU3QUYtMTFEQi04RTMzLTAwMEQ5MzVDODY5QSIsCgl9LAoJewoJCWZsYXQgPSB7CgkJCSJvbnRhcmlvIiwKCQkJIm90dGF3YSIsCgkJfSwKCQlwYXRoID0gewoJCQkib250YXJpbyIsCgkJCSJvdHRhd2EiLAoJCX0sCgkJcHJpbWFyeSA9ICJvdHRhd2EiLAoJCXV1aWQgPSAiQjgzMTc4RkItNTdBRi0xMURCLThFMzMtMDAwRDkzNUM4NjlBIiwKCX0sCgl7CgkJZmxhdCA9IHsKCQkJInBhcmxpYW1lbnQgb2YgY2FuYWRhIiwKCQkJIm9udGFyaW8iLAoJCQkib3R0YXdhIiwKCQl9LAoJCXBhdGggPSB7CgkJCSJvbnRhcmlvIiwKCQkJIm90dGF3YSIsCgkJCSJwYXJsaWFtZW50IG9mIGNhbmFkYSIsCgkJfSwKCQlwcmltYXJ5ID0gInBhcmxpYW1lbnQgb2YgY2FuYWRhIiwKCQl1dWlkID0gIkU1RDMzMEZDLTU3QUYtMTFEQi04RTMzLTAwMEQ5MzVDODY5QSIsCgl9LAp9Cg==</lr:hierarchicalKeywords>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/">
<xmpTPg:MaxPageSize>
<rdf:Description
xmlns:stDim="http:ns.adobe.com/xap/1.0/sType/Dimensions#">
<stDim:w>4</stDim:w>
<stDim:h>3</stDim:h>
<stDim:unit>inches</stDim:unit>
</rdf:Description>
</xmpTPg:MaxPageSize>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">
<Iptc4xmpCore:Location>Parliament Hill, Ottawa, Ontario, Canada</Iptc4xmpCore:Location>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>

@ -0,0 +1,115 @@
/*
* exempi-d - tests/xmpfiles.d
*
* Bindings by Les De Ridder <les@lesderid.net>
*
* Copyright (C) 2007-2016 Hubert Figuiere
* Copyright 2002-2007 Adobe Systems Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1 Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2 Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* 3 Neither the name of the Authors, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software wit hout specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
unittest
{
import exempi.xmp;
import exempi.xmpconsts;
import std.string;
enum sampleFile = "tests/samples/BlueSquare.jpg";
assert(xmp_init());
XmpFilePtr f = xmp_files_open_new(sampleFile.toStringz(), XmpOpenFileOptions.XMP_OPEN_READ);
assert(f !is null);
assert(xmp_files_check_file_format(sampleFile.toStringz()) == XmpFileType.XMP_FT_JPEG);
XmpStringPtr file_path = xmp_string_new();
XmpOpenFileOptions options;
XmpFileType file_format;
XmpFileFormatOptions handler_flags;
assert(xmp_files_get_file_info(f, file_path, &options, &file_format,
&handler_flags));
assert(options == XmpOpenFileOptions.XMP_OPEN_READ);
assert(file_format == XmpFileType.XMP_FT_JPEG);
// the value check might break at each SDK update. You have been warned.
assert(handler_flags == 0x27f);
//assert(sampleFile.toStringz() == xmp_string_cstr(file_path));
xmp_string_free(file_path);
XmpPtr xmp = xmp_new_empty();
assert(xmp !is null);
assert(xmp_files_get_xmp(f, xmp));
{
XmpStringPtr thestring = xmp_string_new();
XmpPacketInfo packet_info;
assert(xmp_files_get_xmp_xmpstring(f, thestring, &packet_info));
assert(packet_info.offset == 2189);
assert(packet_info.length == 4782);
assert(packet_info.padSize == 2049);
assert(packet_info.hasWrapper);
const char *xmp_str = xmp_string_cstr(thestring);
assert(xmp_str);
xmp_string_free(thestring);
}
XmpStringPtr the_prop = xmp_string_new();
assert(
xmp_get_property(xmp, NS_PHOTOSHOP.ptr, "ICCProfile", the_prop, null));
assert("sRGB IEC61966-2.1" == fromStringz(xmp_string_cstr(the_prop)));
xmp_string_free(the_prop);
assert(xmp_free(xmp));
assert(xmp_files_free(f));
XmpFileFormatOptions formatOptions;
// the value check might break at each SDK update. You have been warned.
assert(xmp_files_get_format_info(XmpFileType.XMP_FT_JPEG, &formatOptions));
assert(formatOptions == 0x27f);
assert(xmp_files_get_format_info(XmpFileType.XMP_FT_GIF, &formatOptions));
assert(formatOptions == 0x46b);
assert(xmp_files_get_format_info(XmpFileType.XMP_FT_PNG, &formatOptions));
assert(formatOptions == 0x46b);
// PDF doesn't have a smart handler.
assert(!xmp_files_get_format_info(XmpFileType.XMP_FT_PDF, &formatOptions));
xmp_terminate();
}
Loading…
Cancel
Save