Backed out changeset acbbb2038fdd (bug 1207830)

This commit is contained in:
Carsten "Tomcat" Book 2016-05-27 09:04:48 +02:00
Родитель 2f5ff9300f
Коммит 1a05e03bf8
10 изменённых файлов: 9 добавлений и 156 удалений

Просмотреть файл

@ -510,45 +510,5 @@ ImageTestCase NoFrameDelayGIFTestCase()
return ImageTestCase("no-frame-delay.gif", "image/gif", IntSize(100, 100));
}
ImageTestCase DownscaledPNGTestCase()
{
// This testcase (and all the other "downscaled") testcases) consists of 25
// lines of green, followed by 25 lines of red, followed by 25 lines of green,
// followed by 25 more lines of red. It's intended that tests downscale it
// from 100x100 to 20x20, so we specify a 20x20 output size.
return ImageTestCase("downscaled.png", "image/png", IntSize(100, 100),
IntSize(20, 20));
}
ImageTestCase DownscaledGIFTestCase()
{
return ImageTestCase("downscaled.gif", "image/gif", IntSize(100, 100),
IntSize(20, 20));
}
ImageTestCase DownscaledJPGTestCase()
{
return ImageTestCase("downscaled.jpg", "image/jpeg", IntSize(100, 100),
IntSize(20, 20));
}
ImageTestCase DownscaledBMPTestCase()
{
return ImageTestCase("downscaled.bmp", "image/bmp", IntSize(100, 100),
IntSize(20, 20));
}
ImageTestCase DownscaledICOTestCase()
{
return ImageTestCase("downscaled.ico", "image/x-icon", IntSize(100, 100),
IntSize(20, 20), TEST_CASE_IS_TRANSPARENT);
}
ImageTestCase DownscaledIconTestCase()
{
return ImageTestCase("downscaled.icon", "image/icon", IntSize(100, 100),
IntSize(20, 20), TEST_CASE_IS_TRANSPARENT);
}
} // namespace image
} // namespace mozilla

Просмотреть файл

@ -44,26 +44,12 @@ struct ImageTestCase
: mPath(aPath)
, mMimeType(aMimeType)
, mSize(aSize)
, mOutputSize(aSize)
, mFlags(aFlags)
{ }
ImageTestCase(const char* aPath,
const char* aMimeType,
gfx::IntSize aSize,
gfx::IntSize aOutputSize,
uint32_t aFlags = TEST_CASE_DEFAULT_FLAGS)
: mPath(aPath)
, mMimeType(aMimeType)
, mSize(aSize)
, mOutputSize(aOutputSize)
, mFlags(aFlags)
{ }
const char* mPath;
const char* mMimeType;
gfx::IntSize mSize;
gfx::IntSize mOutputSize;
uint32_t mFlags;
};
@ -326,13 +312,6 @@ ImageTestCase TransparentBMPWhenBMPAlphaEnabledTestCase();
ImageTestCase RLE4BMPTestCase();
ImageTestCase RLE8BMPTestCase();
ImageTestCase DownscaledPNGTestCase();
ImageTestCase DownscaledGIFTestCase();
ImageTestCase DownscaledJPGTestCase();
ImageTestCase DownscaledBMPTestCase();
ImageTestCase DownscaledICOTestCase();
ImageTestCase DownscaledIconTestCase();
} // namespace image
} // namespace mozilla

Просмотреть файл

@ -38,8 +38,8 @@ TEST(ImageDecoders, ImageModuleAvailable)
EXPECT_TRUE(imgTools != nullptr);
}
static already_AddRefed<SourceSurface>
CheckDecoderState(const ImageTestCase& aTestCase, Decoder* aDecoder)
static void
CheckDecoderResults(const ImageTestCase& aTestCase, Decoder* aDecoder)
{
EXPECT_TRUE(aDecoder->GetDecodeDone());
EXPECT_EQ(bool(aTestCase.mFlags & TEST_CASE_HAS_ERROR),
@ -52,7 +52,7 @@ CheckDecoderState(const ImageTestCase& aTestCase, Decoder* aDecoder)
bool(progress & FLAG_HAS_ERROR));
if (aTestCase.mFlags & TEST_CASE_HAS_ERROR) {
return nullptr; // That's all we can check for bad images.
return; // That's all we can check for bad images.
}
EXPECT_TRUE(bool(progress & FLAG_SIZE_AVAILABLE));
@ -77,28 +77,13 @@ CheckDecoderState(const ImageTestCase& aTestCase, Decoder* aDecoder)
EXPECT_EQ(SurfaceType::DATA, surface->GetType());
EXPECT_TRUE(surface->GetFormat() == SurfaceFormat::B8G8R8X8 ||
surface->GetFormat() == SurfaceFormat::B8G8R8A8);
EXPECT_EQ(aTestCase.mOutputSize, surface->GetSize());
return surface.forget();
}
static void
CheckDecoderResults(const ImageTestCase& aTestCase, Decoder* aDecoder)
{
RefPtr<SourceSurface> surface = CheckDecoderState(aTestCase, aDecoder);
if (!surface) {
return;
}
// Check the output.
EXPECT_EQ(aTestCase.mSize, surface->GetSize());
EXPECT_TRUE(IsSolidColor(surface, BGRAColor::Green(),
aTestCase.mFlags & TEST_CASE_IS_FUZZY ? 1 : 0));
}
template <typename Func>
void WithSingleChunkDecode(const ImageTestCase& aTestCase,
const Maybe<IntSize>& aOutputSize,
Func aResultChecker)
static void
CheckDecoderSingleChunk(const ImageTestCase& aTestCase)
{
nsCOMPtr<nsIInputStream> inputStream = LoadFile(aTestCase.mPath);
ASSERT_TRUE(inputStream != nullptr);
@ -119,23 +104,14 @@ void WithSingleChunkDecode(const ImageTestCase& aTestCase,
DecoderType decoderType =
DecoderFactory::GetDecoderType(aTestCase.mMimeType);
RefPtr<Decoder> decoder =
DecoderFactory::CreateAnonymousDecoder(decoderType, sourceBuffer, aOutputSize,
DecoderFactory::CreateAnonymousDecoder(decoderType, sourceBuffer, Nothing(),
DefaultSurfaceFlags());
ASSERT_TRUE(decoder != nullptr);
// Run the full decoder synchronously.
decoder->Decode();
// Call the lambda to verify the expected results.
aResultChecker(decoder);
}
static void
CheckDecoderSingleChunk(const ImageTestCase& aTestCase)
{
WithSingleChunkDecode(aTestCase, Nothing(), [&](Decoder* aDecoder) {
CheckDecoderResults(aTestCase, aDecoder);
});
CheckDecoderResults(aTestCase, decoder);
}
class NoResume : public IResumable
@ -191,32 +167,6 @@ CheckDecoderMultiChunk(const ImageTestCase& aTestCase)
CheckDecoderResults(aTestCase, decoder);
}
static void
CheckDownscaleDuringDecode(const ImageTestCase& aTestCase)
{
// This function expects that |aTestCase| consists of 25 lines of green,
// followed by 25 lines of red, followed by 25 lines of green, followed by 25
// more lines of red. We'll downscale it from 100x100 to 20x20.
IntSize outputSize(20, 20);
WithSingleChunkDecode(aTestCase, Some(outputSize), [&](Decoder* aDecoder) {
RefPtr<SourceSurface> surface = CheckDecoderState(aTestCase, aDecoder);
// There are no downscale-during-decode tests that have TEST_CASE_HAS_ERROR
// set, so we expect to always get a surface here.
EXPECT_TRUE(surface != nullptr);
// 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
// small amount of fuzz; this is just the nature of Lanczos downscaling.
EXPECT_TRUE(RowsAreSolidColor(surface, 0, 4, BGRAColor::Green(), /* aFuzz = */ 3));
EXPECT_TRUE(RowsAreSolidColor(surface, 6, 3, BGRAColor::Red(), /* aFuzz = */ 4));
EXPECT_TRUE(RowsAreSolidColor(surface, 11, 3, BGRAColor::Green(), /* aFuzz = */ 3));
EXPECT_TRUE(RowsAreSolidColor(surface, 16, 4, BGRAColor::Red(), /* aFuzz = */ 3));
});
}
TEST(ImageDecoders, PNGSingleChunk)
{
CheckDecoderSingleChunk(GreenPNGTestCase());
@ -227,11 +177,6 @@ TEST(ImageDecoders, PNGMultiChunk)
CheckDecoderMultiChunk(GreenPNGTestCase());
}
TEST(ImageDecoders, PNGDownscaleDuringDecode)
{
CheckDownscaleDuringDecode(DownscaledPNGTestCase());
}
TEST(ImageDecoders, GIFSingleChunk)
{
CheckDecoderSingleChunk(GreenGIFTestCase());
@ -242,11 +187,6 @@ TEST(ImageDecoders, GIFMultiChunk)
CheckDecoderMultiChunk(GreenGIFTestCase());
}
TEST(ImageDecoders, GIFDownscaleDuringDecode)
{
CheckDownscaleDuringDecode(DownscaledGIFTestCase());
}
TEST(ImageDecoders, JPGSingleChunk)
{
CheckDecoderSingleChunk(GreenJPGTestCase());
@ -257,11 +197,6 @@ TEST(ImageDecoders, JPGMultiChunk)
CheckDecoderMultiChunk(GreenJPGTestCase());
}
TEST(ImageDecoders, JPGDownscaleDuringDecode)
{
CheckDownscaleDuringDecode(DownscaledJPGTestCase());
}
TEST(ImageDecoders, BMPSingleChunk)
{
CheckDecoderSingleChunk(GreenBMPTestCase());
@ -272,11 +207,6 @@ TEST(ImageDecoders, BMPMultiChunk)
CheckDecoderMultiChunk(GreenBMPTestCase());
}
TEST(ImageDecoders, BMPDownscaleDuringDecode)
{
CheckDownscaleDuringDecode(DownscaledBMPTestCase());
}
TEST(ImageDecoders, ICOSingleChunk)
{
CheckDecoderSingleChunk(GreenICOTestCase());
@ -287,11 +217,6 @@ TEST(ImageDecoders, ICOMultiChunk)
CheckDecoderMultiChunk(GreenICOTestCase());
}
TEST(ImageDecoders, ICODownscaleDuringDecode)
{
CheckDownscaleDuringDecode(DownscaledICOTestCase());
}
TEST(ImageDecoders, IconSingleChunk)
{
CheckDecoderSingleChunk(GreenIconTestCase());
@ -302,11 +227,6 @@ TEST(ImageDecoders, IconMultiChunk)
CheckDecoderMultiChunk(GreenIconTestCase());
}
TEST(ImageDecoders, IconDownscaleDuringDecode)
{
CheckDownscaleDuringDecode(DownscaledIconTestCase());
}
TEST(ImageDecoders, AnimatedGIFSingleChunk)
{
CheckDecoderSingleChunk(GreenFirstFrameAnimatedGIFTestCase());

Двоичные данные
image/test/gtest/downscaled.bmp

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 29 KiB

Двоичные данные
image/test/gtest/downscaled.gif

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 223 B

Двоичные данные
image/test/gtest/downscaled.ico

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 41 KiB

Двоичные данные
image/test/gtest/downscaled.icon

Двоичный файл не отображается.

Двоичные данные
image/test/gtest/downscaled.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.9 KiB

Двоичные данные
image/test/gtest/downscaled.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1015 B

Просмотреть файл

@ -31,12 +31,6 @@ SOURCES += [
TEST_HARNESS_FILES.gtest += [
'corrupt.jpg',
'downscaled.bmp',
'downscaled.gif',
'downscaled.ico',
'downscaled.icon',
'downscaled.jpg',
'downscaled.png',
'first-frame-green.gif',
'first-frame-green.png',
'first-frame-padding.gif',