зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1207830 (Part 3) - Add a test that downscaling ICOs with AND mask transparency doesn't cause disaster. r=njn
This commit is contained in:
Родитель
4638631ed9
Коммит
9b08bf373b
|
@ -550,5 +550,15 @@ ImageTestCase DownscaledIconTestCase()
|
|||
IntSize(20, 20), TEST_CASE_IS_TRANSPARENT);
|
||||
}
|
||||
|
||||
ImageTestCase DownscaledTransparentICOWithANDMaskTestCase()
|
||||
{
|
||||
// This test case is an ICO with AND mask transparency. We want to ensure that
|
||||
// we can downscale it without crashing or triggering ASAN failures, but its
|
||||
// content isn't simple to verify, so for now we don't check the output.
|
||||
return ImageTestCase("transparent-ico-with-and-mask.ico", "image/x-icon",
|
||||
IntSize(32, 32), IntSize(20, 20),
|
||||
TEST_CASE_IS_TRANSPARENT | TEST_CASE_IGNORE_OUTPUT);
|
||||
}
|
||||
|
||||
} // namespace image
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -33,6 +33,7 @@ enum TestCaseFlags
|
|||
TEST_CASE_HAS_ERROR = 1 << 1,
|
||||
TEST_CASE_IS_TRANSPARENT = 1 << 2,
|
||||
TEST_CASE_IS_ANIMATED = 1 << 3,
|
||||
TEST_CASE_IGNORE_OUTPUT = 1 << 4,
|
||||
};
|
||||
|
||||
struct ImageTestCase
|
||||
|
@ -332,6 +333,7 @@ ImageTestCase DownscaledJPGTestCase();
|
|||
ImageTestCase DownscaledBMPTestCase();
|
||||
ImageTestCase DownscaledICOTestCase();
|
||||
ImageTestCase DownscaledIconTestCase();
|
||||
ImageTestCase DownscaledTransparentICOWithANDMaskTestCase();
|
||||
|
||||
} // namespace image
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -90,6 +90,10 @@ CheckDecoderResults(const ImageTestCase& aTestCase, Decoder* aDecoder)
|
|||
return;
|
||||
}
|
||||
|
||||
if (aTestCase.mFlags & TEST_CASE_IGNORE_OUTPUT) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the output.
|
||||
EXPECT_TRUE(IsSolidColor(surface, BGRAColor::Green(),
|
||||
aTestCase.mFlags & TEST_CASE_IS_FUZZY ? 1 : 0));
|
||||
|
@ -206,6 +210,10 @@ CheckDownscaleDuringDecode(const ImageTestCase& aTestCase)
|
|||
// set, so we expect to always get a surface here.
|
||||
EXPECT_TRUE(surface != nullptr);
|
||||
|
||||
if (aTestCase.mFlags & TEST_CASE_IGNORE_OUTPUT) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that the downscaled image is correct. Note that we skip rows near
|
||||
// the transitions between colors, since the downscaler does not produce a
|
||||
// sharp boundary at these points. Even some of the rows we test need a
|
||||
|
@ -292,6 +300,11 @@ TEST(ImageDecoders, ICODownscaleDuringDecode)
|
|||
CheckDownscaleDuringDecode(DownscaledICOTestCase());
|
||||
}
|
||||
|
||||
TEST(ImageDecoders, ICOWithANDMaskDownscaleDuringDecode)
|
||||
{
|
||||
CheckDownscaleDuringDecode(DownscaledTransparentICOWithANDMaskTestCase());
|
||||
}
|
||||
|
||||
TEST(ImageDecoders, IconSingleChunk)
|
||||
{
|
||||
CheckDecoderSingleChunk(GreenIconTestCase());
|
||||
|
|
|
@ -49,6 +49,7 @@ TEST_HARNESS_FILES.gtest += [
|
|||
'no-frame-delay.gif',
|
||||
'rle4.bmp',
|
||||
'rle8.bmp',
|
||||
'transparent-ico-with-and-mask.ico',
|
||||
'transparent-if-within-ico.bmp',
|
||||
'transparent.gif',
|
||||
'transparent.png',
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 3.2 KiB |
Загрузка…
Ссылка в новой задаче