From 74f9d7567800584e9b2905e20c17dbd78dd339b0 Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Thu, 15 Jan 2004 01:59:31 +0000 Subject: [PATCH] Changed the test to not care about dubious values in the fileSize field git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6090 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../translators/bmptranslator/BMPTranslatorTest.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tests/add-ons/translators/bmptranslator/BMPTranslatorTest.cpp b/src/tests/add-ons/translators/bmptranslator/BMPTranslatorTest.cpp index 83ad4fc655..7f5f3d53dd 100644 --- a/src/tests/add-ons/translators/bmptranslator/BMPTranslatorTest.cpp +++ b/src/tests/add-ons/translators/bmptranslator/BMPTranslatorTest.cpp @@ -185,6 +185,7 @@ BMPTranslatorTest::IdentifyTest() NextSubTest(); fheader.magic = 'MB'; fheader.fileSize = 53; // bad value, too small to contain all of MS header data + // bad values in this field can be, and are ignored by some Windows image viewers fheader.reserved = 0; fheader.dataOffset = 54; MSInfoHeader msheader; @@ -205,7 +206,7 @@ BMPTranslatorTest::IdentifyTest() CPPUNIT_ASSERT(mallbadfs.Write(&fheader.reserved, 4) == 4); CPPUNIT_ASSERT(mallbadfs.Write(&fheader.dataOffset, 4) == 4); CPPUNIT_ASSERT(mallbadfs.Write(&msheader, 40) == 40); - CPPUNIT_ASSERT(proster->Identify(&mallbadfs, NULL, &ti) == B_NO_TRANSLATOR); + CPPUNIT_ASSERT(proster->Identify(&mallbadfs, NULL, &ti) == B_OK); NextSubTest(); fheader.magic = 'MB'; @@ -279,6 +280,9 @@ BMPTranslatorTest::IdentifyTest() fheader.fileSize = 1028; fheader.reserved = 0; fheader.dataOffset = 1029; // bad value, larger than the fileSize + // Ignore the fileSize: if it is the case that the actual file size is + // less than the dataOffset field, the translation will error out appropriately. + // Assume the fileSize has nothing to do with the actual size of the file os2header.size = 12; os2header.width = 5; os2header.height = 5; @@ -290,7 +294,7 @@ BMPTranslatorTest::IdentifyTest() CPPUNIT_ASSERT(mallbaddo3.Write(&fheader.reserved, 4) == 4); CPPUNIT_ASSERT(mallbaddo3.Write(&fheader.dataOffset, 4) == 4); CPPUNIT_ASSERT(mallbaddo3.Write(&os2header, 12) == 12); - CPPUNIT_ASSERT(proster->Identify(&mallbaddo3, NULL, &ti) == B_NO_TRANSLATOR); + CPPUNIT_ASSERT(proster->Identify(&mallbaddo3, NULL, &ti) == B_OK); NextSubTest(); fheader.magic = 'MB';