1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <sal/config.h>
12 #include <string_view>
14 #include <cppunit/TestAssert.h>
15 #include <cppunit/extensions/HelperMacros.h>
16 #include <unotest/bootstrapfixturebase.hxx>
18 #include <graphic/GraphicFormatDetector.hxx>
19 #include <graphic/DetectorTools.hxx>
21 #include <tools/stream.hxx>
22 #include <o3tl/string_view.hxx>
28 class GraphicFormatDetectorTest
: public test::BootstrapFixtureBase
30 OUString
getFullUrl(std::u16string_view sFileName
)
32 return m_directories
.getURLFromSrc(u
"/vcl/qa/cppunit/data/") + sFileName
;
42 void testDetectAPNG();
44 void testDetectGIFMetadata();
51 void testDetectSVGZ();
54 void testDetectWEBP();
57 void testMatchArray();
58 void testCheckArrayForMatchingStrings();
60 CPPUNIT_TEST_SUITE(GraphicFormatDetectorTest
);
61 CPPUNIT_TEST(testDetectMET
);
62 CPPUNIT_TEST(testDetectBMP
);
63 CPPUNIT_TEST(testDetectWMF
);
64 CPPUNIT_TEST(testDetectWMZ
);
65 CPPUNIT_TEST(testDetectPCX
);
66 CPPUNIT_TEST(testDetectJPG
);
67 CPPUNIT_TEST(testDetectPNG
);
68 CPPUNIT_TEST(testDetectAPNG
);
69 CPPUNIT_TEST(testDetectGIF
);
70 CPPUNIT_TEST(testDetectGIFMetadata
);
71 CPPUNIT_TEST(testDetectPSD
);
72 CPPUNIT_TEST(testDetectTGA
);
73 CPPUNIT_TEST(testDetectTIF
);
74 CPPUNIT_TEST(testDetectXBM
);
75 CPPUNIT_TEST(testDetectXPM
);
76 CPPUNIT_TEST(testDetectSVG
);
77 CPPUNIT_TEST(testDetectSVGZ
);
78 CPPUNIT_TEST(testDetectPDF
);
79 CPPUNIT_TEST(testDetectEPS
);
80 CPPUNIT_TEST(testDetectWEBP
);
81 CPPUNIT_TEST(testDetectEMF
);
82 CPPUNIT_TEST(testDetectEMZ
);
83 CPPUNIT_TEST(testMatchArray
);
84 CPPUNIT_TEST(testCheckArrayForMatchingStrings
);
85 CPPUNIT_TEST_SUITE_END();
88 void GraphicFormatDetectorTest::testDetectMET()
90 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.met"), StreamMode::READ
);
91 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"MET"_ustr
);
93 CPPUNIT_ASSERT(aDetector
.detect());
94 CPPUNIT_ASSERT(aDetector
.checkMET());
96 aFileStream
.Seek(aDetector
.mnStreamPosition
);
98 OUString rFormatExtension
;
99 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
100 CPPUNIT_ASSERT_EQUAL(u
"MET"_ustr
, rFormatExtension
);
103 void GraphicFormatDetectorTest::testDetectBMP()
105 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.bmp"), StreamMode::READ
);
106 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"BMP"_ustr
);
108 CPPUNIT_ASSERT(aDetector
.detect());
109 CPPUNIT_ASSERT(aDetector
.checkBMP());
111 aFileStream
.Seek(aDetector
.mnStreamPosition
);
113 OUString rFormatExtension
;
114 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
115 CPPUNIT_ASSERT_EQUAL(u
"BMP"_ustr
, rFormatExtension
);
118 void GraphicFormatDetectorTest::testDetectWMF()
120 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.wmf"), StreamMode::READ
);
121 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"WMF"_ustr
);
123 CPPUNIT_ASSERT(aDetector
.detect());
124 CPPUNIT_ASSERT(aDetector
.checkWMF());
126 aFileStream
.Seek(aDetector
.mnStreamPosition
);
128 OUString rFormatExtension
;
129 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
130 CPPUNIT_ASSERT_EQUAL(u
"WMF"_ustr
, rFormatExtension
);
133 void GraphicFormatDetectorTest::testDetectWMZ()
135 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.wmz"), StreamMode::READ
);
136 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"WMZ"_ustr
);
138 CPPUNIT_ASSERT(aDetector
.detect());
139 CPPUNIT_ASSERT(aDetector
.checkWMF());
141 aFileStream
.Seek(aDetector
.mnStreamPosition
);
143 OUString rFormatExtension
;
144 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
145 CPPUNIT_ASSERT_EQUAL(u
"WMZ"_ustr
, rFormatExtension
);
148 void GraphicFormatDetectorTest::testDetectPCX()
150 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.pcx"), StreamMode::READ
);
151 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"PCX"_ustr
);
153 CPPUNIT_ASSERT(aDetector
.detect());
154 CPPUNIT_ASSERT(aDetector
.checkPCX());
156 aFileStream
.Seek(aDetector
.mnStreamPosition
);
158 OUString rFormatExtension
;
159 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
160 CPPUNIT_ASSERT_EQUAL(u
"PCX"_ustr
, rFormatExtension
);
163 void GraphicFormatDetectorTest::testDetectJPG()
165 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.jpg"), StreamMode::READ
);
166 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"JPG"_ustr
);
168 CPPUNIT_ASSERT(aDetector
.detect());
169 CPPUNIT_ASSERT(aDetector
.checkJPG());
171 aFileStream
.Seek(aDetector
.mnStreamPosition
);
173 OUString rFormatExtension
;
174 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
175 CPPUNIT_ASSERT_EQUAL(u
"JPG"_ustr
, rFormatExtension
);
178 void GraphicFormatDetectorTest::testDetectPNG()
180 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.png"), StreamMode::READ
);
181 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"PNG"_ustr
);
183 CPPUNIT_ASSERT(aDetector
.detect());
184 CPPUNIT_ASSERT(aDetector
.checkPNG());
186 aFileStream
.Seek(aDetector
.mnStreamPosition
);
188 OUString rFormatExtension
;
189 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
190 CPPUNIT_ASSERT_EQUAL(u
"PNG"_ustr
, rFormatExtension
);
193 void GraphicFormatDetectorTest::testDetectAPNG()
195 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.apng"), StreamMode::READ
);
196 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"APNG"_ustr
);
198 CPPUNIT_ASSERT(aDetector
.detect());
199 CPPUNIT_ASSERT(aDetector
.checkAPNG());
201 aFileStream
.Seek(aDetector
.mnStreamPosition
);
203 OUString rFormatExtension
;
204 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
205 CPPUNIT_ASSERT_EQUAL(u
"APNG"_ustr
, rFormatExtension
);
208 void GraphicFormatDetectorTest::testDetectGIF()
210 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.gif"), StreamMode::READ
);
211 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"GIF"_ustr
);
213 CPPUNIT_ASSERT(aDetector
.detect());
214 CPPUNIT_ASSERT(aDetector
.checkGIF());
216 aFileStream
.Seek(aDetector
.mnStreamPosition
);
218 OUString rFormatExtension
;
219 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
220 CPPUNIT_ASSERT_EQUAL(u
"GIF"_ustr
, rFormatExtension
);
223 void GraphicFormatDetectorTest::testDetectGIFMetadata()
225 SvFileStream
aFileStream(getFullUrl(u
"123_Numbers.gif"), StreamMode::READ
);
226 vcl::GraphicFormatDetector
aDetector(aFileStream
, "GIF", true);
228 CPPUNIT_ASSERT(aDetector
.detect());
229 CPPUNIT_ASSERT(aDetector
.checkGIF());
230 auto const& rMetadata
= aDetector
.getMetadata();
232 CPPUNIT_ASSERT_EQUAL(Size(124, 146), rMetadata
.maPixSize
);
233 CPPUNIT_ASSERT_EQUAL(sal_uInt16(5), rMetadata
.mnBitsPerPixel
);
235 CPPUNIT_ASSERT_EQUAL(Size(), rMetadata
.maLogSize
);
236 CPPUNIT_ASSERT_EQUAL(true, rMetadata
.mbIsAnimated
);
239 void GraphicFormatDetectorTest::testDetectPSD()
241 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.psd"), StreamMode::READ
);
242 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"PSD"_ustr
);
244 CPPUNIT_ASSERT(aDetector
.detect());
245 CPPUNIT_ASSERT(aDetector
.checkPSD());
247 aFileStream
.Seek(aDetector
.mnStreamPosition
);
249 OUString rFormatExtension
;
250 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
251 CPPUNIT_ASSERT_EQUAL(u
"PSD"_ustr
, rFormatExtension
);
254 void GraphicFormatDetectorTest::testDetectTGA()
256 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.tga"), StreamMode::READ
);
257 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"TGA"_ustr
);
259 CPPUNIT_ASSERT(aDetector
.detect());
260 CPPUNIT_ASSERT(aDetector
.checkTGA());
262 aFileStream
.Seek(aDetector
.mnStreamPosition
);
264 OUString
rFormatExtension(u
"TGA"_ustr
); // detection is based on extension only
265 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
266 CPPUNIT_ASSERT_EQUAL(u
"TGA"_ustr
, rFormatExtension
);
269 void GraphicFormatDetectorTest::testDetectTIF()
271 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.tif"), StreamMode::READ
);
272 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"TIF"_ustr
);
274 CPPUNIT_ASSERT(aDetector
.detect());
275 CPPUNIT_ASSERT(aDetector
.checkTIF());
277 aFileStream
.Seek(aDetector
.mnStreamPosition
);
279 OUString rFormatExtension
;
280 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
281 CPPUNIT_ASSERT_EQUAL(u
"TIF"_ustr
, rFormatExtension
);
284 void GraphicFormatDetectorTest::testDetectXBM()
286 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.xbm"), StreamMode::READ
);
287 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"XBM"_ustr
);
289 CPPUNIT_ASSERT(aDetector
.detect());
290 CPPUNIT_ASSERT(aDetector
.checkXBM());
292 aFileStream
.Seek(aDetector
.mnStreamPosition
);
294 OUString rFormatExtension
;
295 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
296 CPPUNIT_ASSERT_EQUAL(u
"XBM"_ustr
, rFormatExtension
);
299 void GraphicFormatDetectorTest::testDetectXPM()
301 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.xpm"), StreamMode::READ
);
302 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"XPM"_ustr
);
304 CPPUNIT_ASSERT(aDetector
.detect());
305 CPPUNIT_ASSERT(aDetector
.checkXPM());
307 aFileStream
.Seek(aDetector
.mnStreamPosition
);
309 OUString rFormatExtension
;
310 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
311 CPPUNIT_ASSERT_EQUAL(u
"XPM"_ustr
, rFormatExtension
);
314 void GraphicFormatDetectorTest::testDetectSVG()
316 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.svg"), StreamMode::READ
);
317 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"SVG"_ustr
);
319 CPPUNIT_ASSERT(aDetector
.detect());
320 CPPUNIT_ASSERT(aDetector
.checkSVG());
322 aFileStream
.Seek(aDetector
.mnStreamPosition
);
324 OUString rFormatExtension
;
325 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
326 CPPUNIT_ASSERT_EQUAL(u
"SVG"_ustr
, rFormatExtension
);
329 void GraphicFormatDetectorTest::testDetectSVGZ()
331 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.svgz"), StreamMode::READ
);
332 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"SVGZ"_ustr
);
334 CPPUNIT_ASSERT(aDetector
.detect());
335 CPPUNIT_ASSERT(aDetector
.checkSVG());
337 aFileStream
.Seek(aDetector
.mnStreamPosition
);
339 OUString rFormatExtension
;
340 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
341 CPPUNIT_ASSERT_EQUAL(u
"SVGZ"_ustr
, rFormatExtension
);
344 void GraphicFormatDetectorTest::testDetectPDF()
346 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.pdf"), StreamMode::READ
);
347 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"PDF"_ustr
);
349 CPPUNIT_ASSERT(aDetector
.detect());
350 CPPUNIT_ASSERT(aDetector
.checkPDF());
352 aFileStream
.Seek(aDetector
.mnStreamPosition
);
354 OUString rFormatExtension
;
355 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
356 CPPUNIT_ASSERT_EQUAL(u
"PDF"_ustr
, rFormatExtension
);
359 void GraphicFormatDetectorTest::testDetectEPS()
361 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.eps"), StreamMode::READ
);
362 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"EPS"_ustr
);
364 CPPUNIT_ASSERT(aDetector
.detect());
365 CPPUNIT_ASSERT(aDetector
.checkEPS());
367 aFileStream
.Seek(aDetector
.mnStreamPosition
);
369 OUString rFormatExtension
;
370 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
371 CPPUNIT_ASSERT_EQUAL(u
"EPS"_ustr
, rFormatExtension
);
374 void GraphicFormatDetectorTest::testDetectWEBP()
376 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.webp"), StreamMode::READ
);
377 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"WEBP"_ustr
);
379 CPPUNIT_ASSERT(aDetector
.detect());
380 CPPUNIT_ASSERT(aDetector
.checkWEBP());
382 aFileStream
.Seek(aDetector
.mnStreamPosition
);
384 OUString rFormatExtension
;
385 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
386 CPPUNIT_ASSERT_EQUAL(u
"WEBP"_ustr
, rFormatExtension
);
389 void GraphicFormatDetectorTest::testDetectEMF()
391 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.emf"), StreamMode::READ
);
392 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"EMF"_ustr
);
394 CPPUNIT_ASSERT(aDetector
.detect());
395 CPPUNIT_ASSERT(aDetector
.checkEMF());
397 aFileStream
.Seek(aDetector
.mnStreamPosition
);
399 OUString rFormatExtension
;
400 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
401 CPPUNIT_ASSERT_EQUAL(u
"EMF"_ustr
, rFormatExtension
);
404 void GraphicFormatDetectorTest::testDetectEMZ()
406 SvFileStream
aFileStream(getFullUrl(u
"TypeDetectionExample.emz"), StreamMode::READ
);
407 vcl::GraphicFormatDetector
aDetector(aFileStream
, u
"EMZ"_ustr
);
409 CPPUNIT_ASSERT(aDetector
.detect());
410 CPPUNIT_ASSERT(aDetector
.checkEMF());
412 aFileStream
.Seek(aDetector
.mnStreamPosition
);
414 OUString rFormatExtension
;
415 CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream
, rFormatExtension
, false));
416 CPPUNIT_ASSERT_EQUAL(u
"EMZ"_ustr
, rFormatExtension
);
419 void GraphicFormatDetectorTest::testMatchArray()
421 std::string
aString("<?xml version=\"1.0\" standalone=\"no\"?>\n"
422 "<svg width=\"5cm\" height=\"4cm\" version=\"1.1\"\n"
423 "xmlns=\"http://www.w3.org/2000/svg\">\n"
426 const char* pCompleteStringPointer
= aString
.c_str();
427 const char* pMatchPointer
;
428 int nCheckSize
= aString
.size();
430 // Check beginning of the input string
431 pMatchPointer
= vcl::matchArrayWithString(pCompleteStringPointer
, nCheckSize
, "<?xml"_ostr
);
432 CPPUNIT_ASSERT(pMatchPointer
!= nullptr);
433 CPPUNIT_ASSERT_EQUAL(0, int(pMatchPointer
- pCompleteStringPointer
));
434 CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer
, "<?xml"));
436 // Check middle of the input string
437 pMatchPointer
= vcl::matchArrayWithString(aString
.c_str(), nCheckSize
, "version"_ostr
);
438 CPPUNIT_ASSERT(pMatchPointer
!= nullptr);
439 CPPUNIT_ASSERT_EQUAL(6, int(pMatchPointer
- pCompleteStringPointer
));
440 CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer
, "version"));
442 pMatchPointer
= vcl::matchArrayWithString(aString
.c_str(), nCheckSize
, "<svg"_ostr
);
443 CPPUNIT_ASSERT(pMatchPointer
!= nullptr);
444 CPPUNIT_ASSERT_EQUAL(38, int(pMatchPointer
- pCompleteStringPointer
));
445 CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer
, "<svg"));
447 // Check end of the input string
448 pMatchPointer
= vcl::matchArrayWithString(aString
.c_str(), nCheckSize
, "/svg>"_ostr
);
449 CPPUNIT_ASSERT(pMatchPointer
!= nullptr);
450 CPPUNIT_ASSERT_EQUAL(119, int(pMatchPointer
- pCompleteStringPointer
));
451 CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer
, "/svg>"));
453 // Check that non-existing search string
454 pMatchPointer
= vcl::matchArrayWithString(aString
.c_str(), nCheckSize
, "none"_ostr
);
455 CPPUNIT_ASSERT(pMatchPointer
== nullptr);
458 void GraphicFormatDetectorTest::testCheckArrayForMatchingStrings()
460 std::string
aString("<?xml version=\"1.0\" standalone=\"no\"?>\n"
461 "<svg width=\"5cm\" height=\"4cm\" version=\"1.1\"\n"
462 "xmlns=\"http://www.w3.org/2000/svg\">\n"
464 const char* pCompleteStringPointer
= aString
.c_str();
465 int nCheckSize
= aString
.size();
468 // check beginning string
470 = vcl::checkArrayForMatchingStrings(pCompleteStringPointer
, nCheckSize
, { "<?xml"_ostr
});
471 CPPUNIT_ASSERT_EQUAL(true, bResult
);
473 // check ending string
475 = vcl::checkArrayForMatchingStrings(pCompleteStringPointer
, nCheckSize
, { "/svg>"_ostr
});
476 CPPUNIT_ASSERT_EQUAL(true, bResult
);
478 // check middle string
480 = vcl::checkArrayForMatchingStrings(pCompleteStringPointer
, nCheckSize
, { "version"_ostr
});
481 CPPUNIT_ASSERT_EQUAL(true, bResult
);
483 // check beginning and then ending string
484 bResult
= vcl::checkArrayForMatchingStrings(pCompleteStringPointer
, nCheckSize
,
485 { "<?xml"_ostr
, "/svg>"_ostr
});
486 CPPUNIT_ASSERT_EQUAL(true, bResult
);
488 // check ending and then beginning string
489 bResult
= vcl::checkArrayForMatchingStrings(pCompleteStringPointer
, nCheckSize
,
490 { "/svg>"_ostr
, "<?xml"_ostr
});
491 CPPUNIT_ASSERT_EQUAL(false, bResult
);
493 // check middle strings
494 bResult
= vcl::checkArrayForMatchingStrings(pCompleteStringPointer
, nCheckSize
,
495 { "version"_ostr
, "<svg"_ostr
});
496 CPPUNIT_ASSERT_EQUAL(true, bResult
);
498 // check beginning, middle and ending strings
499 bResult
= vcl::checkArrayForMatchingStrings(
500 pCompleteStringPointer
, nCheckSize
,
501 { "<?xml"_ostr
, "version"_ostr
, "<svg"_ostr
, "/svg>"_ostr
});
502 CPPUNIT_ASSERT_EQUAL(true, bResult
);
504 // check non-existing
506 = vcl::checkArrayForMatchingStrings(pCompleteStringPointer
, nCheckSize
, { "none"_ostr
});
507 CPPUNIT_ASSERT_EQUAL(false, bResult
);
509 // check non-existing on the beginning
510 bResult
= vcl::checkArrayForMatchingStrings(
511 pCompleteStringPointer
, nCheckSize
,
512 { "none"_ostr
, "version"_ostr
, "<svg"_ostr
, "/svg>"_ostr
});
513 CPPUNIT_ASSERT_EQUAL(false, bResult
);
515 // check non-existing on the end
516 bResult
= vcl::checkArrayForMatchingStrings(
517 pCompleteStringPointer
, nCheckSize
,
518 { "<?xml"_ostr
, "version"_ostr
, "<svg"_ostr
, "none"_ostr
});
519 CPPUNIT_ASSERT_EQUAL(false, bResult
);
521 // check non-existing after the end
522 bResult
= vcl::checkArrayForMatchingStrings(pCompleteStringPointer
, nCheckSize
,
523 { "<?xml"_ostr
, "/svg>"_ostr
, "none"_ostr
});
524 CPPUNIT_ASSERT_EQUAL(false, bResult
);
529 CPPUNIT_TEST_SUITE_REGISTRATION(GraphicFormatDetectorTest
);
531 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */