tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Common.h (22244B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef mozilla_image_test_gtest_Common_h
      7 #define mozilla_image_test_gtest_Common_h
      8 
      9 #include <vector>
     10 
     11 #include "gtest/gtest.h"
     12 
     13 #include "mozilla/Attributes.h"
     14 #include "mozilla/gtest/MozAssertions.h"
     15 #include "mozilla/Maybe.h"
     16 #include "mozilla/UniquePtr.h"
     17 #include "mozilla/gfx/2D.h"
     18 #include "Decoder.h"
     19 #include "gfxColor.h"
     20 #include "gfxPlatform.h"
     21 #include "nsCOMPtr.h"
     22 #include "SurfaceFlags.h"
     23 #include "SurfacePipe.h"
     24 #include "SurfacePipeFactory.h"
     25 
     26 class nsIInputStream;
     27 
     28 namespace mozilla {
     29 namespace image {
     30 
     31 ///////////////////////////////////////////////////////////////////////////////
     32 // Types
     33 ///////////////////////////////////////////////////////////////////////////////
     34 
     35 struct BGRAColor {
     36  BGRAColor() : BGRAColor(0, 0, 0, 0) {}
     37 
     38  BGRAColor(uint8_t aBlue, uint8_t aGreen, uint8_t aRed, uint8_t aAlpha,
     39            bool aPremultiplied = false, bool asRGB = true)
     40      : mBlue(aBlue),
     41        mGreen(aGreen),
     42        mRed(aRed),
     43        mAlpha(aAlpha),
     44        mPremultiplied(aPremultiplied),
     45        msRGB(asRGB) {}
     46 
     47  static BGRAColor Green() { return BGRAColor(0x00, 0xFF, 0x00, 0xFF); }
     48  static BGRAColor Red() { return BGRAColor(0x00, 0x00, 0xFF, 0xFF); }
     49  static BGRAColor Blue() { return BGRAColor(0xFF, 0x00, 0x00, 0xFF); }
     50  static BGRAColor Transparent() { return BGRAColor(0x00, 0x00, 0x00, 0x00); }
     51 
     52  static BGRAColor FromPixel(uint32_t aPixel) {
     53    uint8_t r, g, b, a;
     54    r = (aPixel >> gfx::SurfaceFormatBit::OS_R) & 0xFF;
     55    g = (aPixel >> gfx::SurfaceFormatBit::OS_G) & 0xFF;
     56    b = (aPixel >> gfx::SurfaceFormatBit::OS_B) & 0xFF;
     57    a = (aPixel >> gfx::SurfaceFormatBit::OS_A) & 0xFF;
     58    return BGRAColor(b, g, r, a, true);
     59  }
     60 
     61  BGRAColor DeviceColor() const {
     62    MOZ_RELEASE_ASSERT(!mPremultiplied);
     63    if (msRGB) {
     64      gfx::DeviceColor color = gfx::ToDeviceColor(
     65          gfx::sRGBColor(float(mRed) / 255.0f, float(mGreen) / 255.0f,
     66                         float(mBlue) / 255.0f, 1.0));
     67      return BGRAColor(uint8_t(color.b * 255.0f), uint8_t(color.g * 255.0f),
     68                       uint8_t(color.r * 255.0f), mAlpha, mPremultiplied,
     69                       /* asRGB */ false);
     70    }
     71    return *this;
     72  }
     73 
     74  BGRAColor sRGBColor() const {
     75    MOZ_RELEASE_ASSERT(msRGB);
     76    MOZ_RELEASE_ASSERT(!mPremultiplied);
     77    return *this;
     78  }
     79 
     80  BGRAColor Premultiply() const {
     81    if (!mPremultiplied) {
     82      return BGRAColor(gfxPreMultiply(mBlue, mAlpha),
     83                       gfxPreMultiply(mGreen, mAlpha),
     84                       gfxPreMultiply(mRed, mAlpha), mAlpha, true);
     85    }
     86    return *this;
     87  }
     88 
     89  uint32_t AsPixel() const {
     90    if (!mPremultiplied) {
     91      return gfxPackedPixel(mAlpha, mRed, mGreen, mBlue);
     92    }
     93    return gfxPackedPixelNoPreMultiply(mAlpha, mRed, mGreen, mBlue);
     94  }
     95 
     96  uint8_t mBlue;
     97  uint8_t mGreen;
     98  uint8_t mRed;
     99  uint8_t mAlpha;
    100  bool mPremultiplied;
    101  bool msRGB;
    102 };
    103 
    104 enum TestCaseFlags {
    105  TEST_CASE_DEFAULT_FLAGS = 0,
    106  TEST_CASE_IS_FUZZY = 1 << 0,
    107  TEST_CASE_HAS_ERROR = 1 << 1,
    108  TEST_CASE_IS_TRANSPARENT = 1 << 2,
    109  TEST_CASE_IS_ANIMATED = 1 << 3,
    110  TEST_CASE_IGNORE_OUTPUT = 1 << 4,
    111  TEST_CASE_ASSUME_SRGB_OUTPUT = 1 << 5,
    112 };
    113 
    114 struct ImageTestCase {
    115  ImageTestCase(const char* aPath, const char* aMimeType, gfx::IntSize aSize,
    116                uint32_t aFlags = TEST_CASE_DEFAULT_FLAGS,
    117                uint32_t aFrameCount = 1)
    118      : mPath(aPath),
    119        mMimeType(aMimeType),
    120        mSize(aSize),
    121        mOutputSize(aSize),
    122        mFrameCount(aFrameCount),
    123        mFlags(aFlags),
    124        mSurfaceFlags(DefaultSurfaceFlags()),
    125        mColor(BGRAColor::Green()) {}
    126 
    127  ImageTestCase(const char* aPath, const char* aMimeType, gfx::IntSize aSize,
    128                gfx::IntSize aOutputSize,
    129                uint32_t aFlags = TEST_CASE_DEFAULT_FLAGS)
    130      : mPath(aPath),
    131        mMimeType(aMimeType),
    132        mSize(aSize),
    133        mOutputSize(aOutputSize),
    134        mFlags(aFlags),
    135        mSurfaceFlags(DefaultSurfaceFlags()),
    136        mColor(BGRAColor::Green()) {}
    137 
    138  ImageTestCase WithSurfaceFlags(SurfaceFlags aSurfaceFlags) const {
    139    ImageTestCase self = *this;
    140    self.mSurfaceFlags = aSurfaceFlags;
    141    return self;
    142  }
    143 
    144  ImageTestCase WithFlags(uint32_t aFlags) const {
    145    ImageTestCase self = *this;
    146    self.mFlags = aFlags;
    147    return self;
    148  }
    149 
    150  BGRAColor ChooseColor(const BGRAColor& aColor) const {
    151    // If we are forcing the output to be sRGB via the surface flag, or the
    152    // test case is marked as assuming sRGB (used when the image itself is not
    153    // explicitly tagged, and as a result, imagelib won't perform any color
    154    // conversion), we should use the sRGB presentation of the color.
    155    if ((mSurfaceFlags & SurfaceFlags::TO_SRGB_COLORSPACE) ||
    156        (mFlags & TEST_CASE_ASSUME_SRGB_OUTPUT)) {
    157      return aColor.sRGBColor();
    158    }
    159    return aColor.DeviceColor();
    160  }
    161 
    162  BGRAColor Color() const { return ChooseColor(mColor); }
    163 
    164  uint8_t Fuzz() const {
    165    // If we are using device space, there can easily be off by 1 channel errors
    166    // depending on the color profile and how the rounding went.
    167    if (mFlags & TEST_CASE_IS_FUZZY ||
    168        !(mSurfaceFlags & SurfaceFlags::TO_SRGB_COLORSPACE)) {
    169      return 1;
    170    }
    171    return 0;
    172  }
    173 
    174  const char* mPath;
    175  const char* mMimeType;
    176  gfx::IntSize mSize;
    177  gfx::IntSize mOutputSize;
    178  uint32_t mFrameCount = 0;
    179  uint32_t mFlags;
    180  SurfaceFlags mSurfaceFlags;
    181  BGRAColor mColor;
    182 };
    183 
    184 ///////////////////////////////////////////////////////////////////////////////
    185 // General Helpers
    186 ///////////////////////////////////////////////////////////////////////////////
    187 
    188 /**
    189 * A RAII class that ensure that ImageLib services are available. Any tests that
    190 * require ImageLib to be initialized (for example, any test that uses the
    191 * SurfaceCache; see image::EnsureModuleInitialized() for the full list) can
    192 * use this class to ensure that ImageLib services are available. Failure to do
    193 * so can result in strange, non-deterministic failures.
    194 */
    195 class AutoInitializeImageLib {
    196 public:
    197  AutoInitializeImageLib();
    198 };
    199 
    200 /**
    201 * A test fixture class used for benchmark tests. It preloads the image data
    202 * from disk to avoid including that in the timing.
    203 */
    204 class ImageBenchmarkBase : public ::testing::Test {
    205 protected:
    206  ImageBenchmarkBase(const ImageTestCase& aTestCase) : mTestCase(aTestCase) {}
    207 
    208  void SetUp() override;
    209  void TearDown() override;
    210 
    211  AutoInitializeImageLib mInit;
    212  ImageTestCase mTestCase;
    213  RefPtr<SourceBuffer> mSourceBuffer;
    214 };
    215 
    216 /// Spins on the main thread to process any pending events.
    217 void SpinPendingEvents();
    218 
    219 /// Loads a file from the current directory. @return an nsIInputStream for it.
    220 already_AddRefed<nsIInputStream> LoadFile(const char* aRelativePath);
    221 
    222 /**
    223 * @returns true if every pixel of @aSurface is @aColor.
    224 *
    225 * If @aFuzz is nonzero, a tolerance of @aFuzz is allowed in each color
    226 * component. This may be necessary for tests that involve JPEG images or
    227 * downscaling.
    228 */
    229 bool IsSolidColor(gfx::SourceSurface* aSurface, BGRAColor aColor,
    230                  uint8_t aFuzz = 0);
    231 
    232 /**
    233 * @returns true if every pixel in the range of rows specified by @aStartRow and
    234 * @aRowCount of @aSurface is @aColor.
    235 *
    236 * If @aFuzz is nonzero, a tolerance of @aFuzz is allowed in each color
    237 * component. This may be necessary for tests that involve JPEG images or
    238 * downscaling.
    239 */
    240 bool RowsAreSolidColor(gfx::SourceSurface* aSurface, int32_t aStartRow,
    241                       int32_t aRowCount, BGRAColor aColor, uint8_t aFuzz = 0);
    242 
    243 /**
    244 * @returns true if every pixel in the rect specified by @aRect is @aColor.
    245 *
    246 * If @aFuzz is nonzero, a tolerance of @aFuzz is allowed in each color
    247 * component. This may be necessary for tests that involve JPEG images or
    248 * downscaling.
    249 */
    250 bool RectIsSolidColor(gfx::SourceSurface* aSurface, const gfx::IntRect& aRect,
    251                      BGRAColor aColor, uint8_t aFuzz = 0);
    252 
    253 /**
    254 * @returns true if the pixels in @aRow of @aSurface match the pixels given in
    255 * @aPixels.
    256 */
    257 bool RowHasPixels(gfx::SourceSurface* aSurface, int32_t aRow,
    258                  const std::vector<BGRAColor>& aPixels);
    259 
    260 // ExpectNoResume is an IResumable implementation for use by tests that expect
    261 // Resume() to never get called.
    262 class ExpectNoResume final : public IResumable {
    263 public:
    264  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ExpectNoResume, override)
    265 
    266  void Resume() override { FAIL() << "Resume() should not get called"; }
    267 
    268 private:
    269  ~ExpectNoResume() override {}
    270 };
    271 
    272 // CountResumes is an IResumable implementation for use by tests that expect
    273 // Resume() to get called a certain number of times.
    274 class CountResumes : public IResumable {
    275 public:
    276  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CountResumes, override)
    277 
    278  CountResumes() : mCount(0) {}
    279 
    280  void Resume() override { mCount++; }
    281  uint32_t Count() const { return mCount; }
    282 
    283 private:
    284  ~CountResumes() override {}
    285 
    286  uint32_t mCount;
    287 };
    288 
    289 ///////////////////////////////////////////////////////////////////////////////
    290 // SurfacePipe Helpers
    291 ///////////////////////////////////////////////////////////////////////////////
    292 
    293 /**
    294 * Creates a decoder with no data associated with, suitable for testing code
    295 * that requires a decoder to initialize or to allocate surfaces but doesn't
    296 * actually need the decoder to do any decoding.
    297 *
    298 * XXX(seth): We only need this because SurfaceSink defer to the decoder for
    299 * surface allocation. Once all decoders use SurfacePipe we won't need to do
    300 * that anymore and we can remove this function.
    301 */
    302 already_AddRefed<Decoder> CreateTrivialDecoder();
    303 
    304 /**
    305 * Creates a pipeline of SurfaceFilters from a list of Config structs and passes
    306 * it to the provided lambda @aFunc. Assertions that the pipeline is constructly
    307 * correctly and cleanup of any allocated surfaces is handled automatically.
    308 *
    309 * @param aDecoder The decoder to use for allocating surfaces.
    310 * @param aFunc The lambda function to pass the filter pipeline to.
    311 * @param aConfigs The configuration for the pipeline.
    312 */
    313 template <typename Func, typename... Configs>
    314 void WithFilterPipeline(Decoder* aDecoder, Func aFunc, bool aFinish,
    315                        const Configs&... aConfigs) {
    316  auto pipe = MakeUnique<typename detail::FilterPipeline<Configs...>::Type>();
    317  nsresult rv = pipe->Configure(aConfigs...);
    318  ASSERT_NS_SUCCEEDED(rv);
    319 
    320  aFunc(aDecoder, pipe.get());
    321 
    322  if (aFinish) {
    323    RawAccessFrameRef currentFrame = aDecoder->GetCurrentFrameRef();
    324    if (currentFrame) {
    325      currentFrame->Finish();
    326    }
    327  }
    328 }
    329 
    330 template <typename Func, typename... Configs>
    331 void WithFilterPipeline(Decoder* aDecoder, Func aFunc,
    332                        const Configs&... aConfigs) {
    333  WithFilterPipeline(aDecoder, aFunc, true, aConfigs...);
    334 }
    335 
    336 /**
    337 * Creates a pipeline of SurfaceFilters from a list of Config structs and
    338 * asserts that configuring it fails. Cleanup of any allocated surfaces is
    339 * handled automatically.
    340 *
    341 * @param aDecoder The decoder to use for allocating surfaces.
    342 * @param aConfigs The configuration for the pipeline.
    343 */
    344 template <typename... Configs>
    345 void AssertConfiguringPipelineFails(Decoder* aDecoder,
    346                                    const Configs&... aConfigs) {
    347  auto pipe = MakeUnique<typename detail::FilterPipeline<Configs...>::Type>();
    348  nsresult rv = pipe->Configure(aConfigs...);
    349 
    350  // Callers expect configuring the pipeline to fail.
    351  ASSERT_NS_FAILED(rv);
    352 
    353  RawAccessFrameRef currentFrame = aDecoder->GetCurrentFrameRef();
    354  if (currentFrame) {
    355    currentFrame->Finish();
    356  }
    357 }
    358 
    359 /**
    360 * Asserts that the provided filter pipeline is in the correct final state,
    361 * which is to say, the entire surface has been written to (IsSurfaceFinished()
    362 * returns true) and the invalid rects are as expected.
    363 *
    364 * @param aFilter The filter pipeline to check.
    365 * @param aInputSpaceRect The expect invalid rect, in input space.
    366 * @param aoutputSpaceRect The expect invalid rect, in output space.
    367 */
    368 void AssertCorrectPipelineFinalState(SurfaceFilter* aFilter,
    369                                     const gfx::IntRect& aInputSpaceRect,
    370                                     const gfx::IntRect& aOutputSpaceRect);
    371 
    372 /**
    373 * Checks a generated image for correctness. Reports any unexpected deviation
    374 * from the expected image as GTest failures.
    375 *
    376 * @param aDecoder The decoder which contains the image. The decoder's current
    377 *                 frame will be checked.
    378 * @param aRect The region in the space of the output surface that the filter
    379 *              pipeline will actually write to. It's expected that pixels in
    380 *              this region are green, while pixels outside this region are
    381 *              transparent.
    382 * @param aFuzz The amount of fuzz to use in pixel comparisons.
    383 */
    384 void CheckGeneratedImage(Decoder* aDecoder, const gfx::IntRect& aRect,
    385                         uint8_t aFuzz = 0);
    386 
    387 /**
    388 * Checks a generated surface for correctness. Reports any unexpected deviation
    389 * from the expected image as GTest failures.
    390 *
    391 * @param aSurface The surface to check.
    392 * @param aRect The region in the space of the output surface that the filter
    393 *              pipeline will actually write to.
    394 * @param aInnerColor Check that pixels inside of aRect are this color.
    395 * @param aOuterColor Check that pixels outside of aRect are this color.
    396 * @param aFuzz The amount of fuzz to use in pixel comparisons.
    397 */
    398 void CheckGeneratedSurface(gfx::SourceSurface* aSurface,
    399                           const gfx::IntRect& aRect,
    400                           const BGRAColor& aInnerColor,
    401                           const BGRAColor& aOuterColor, uint8_t aFuzz = 0);
    402 
    403 /**
    404 * Tests the result of calling WritePixels() using the provided SurfaceFilter
    405 * pipeline. The pipeline must be a normal (i.e., non-paletted) pipeline.
    406 *
    407 * The arguments are specified in the an order intended to minimize the number
    408 * of arguments that most test cases need to pass.
    409 *
    410 * @param aDecoder The decoder whose current frame will be written to.
    411 * @param aFilter The SurfaceFilter pipeline to use.
    412 * @param aOutputRect The region in the space of the output surface that will be
    413 *                    invalidated by the filter pipeline. Defaults to
    414 *                    (0, 0, 100, 100).
    415 * @param aInputRect The region in the space of the input image that will be
    416 *                   invalidated by the filter pipeline. Defaults to
    417 *                   (0, 0, 100, 100).
    418 * @param aInputWriteRect The region in the space of the input image that the
    419 *                        filter pipeline will allow writes to. Note the
    420 *                        difference from @aInputRect: @aInputRect is the actual
    421 *                        region invalidated, while @aInputWriteRect is the
    422 *                        region that is written to. These can differ in cases
    423 *                        where the input is not clipped to the size of the
    424 * image. Defaults to the entire input rect.
    425 * @param aOutputWriteRect The region in the space of the output surface that
    426 *                         the filter pipeline will actually write to. It's
    427 *                         expected that pixels in this region are green, while
    428 *                         pixels outside this region are transparent. Defaults
    429 *                         to the entire output rect.
    430 */
    431 void CheckWritePixels(Decoder* aDecoder, SurfaceFilter* aFilter,
    432                      const Maybe<gfx::IntRect>& aOutputRect = Nothing(),
    433                      const Maybe<gfx::IntRect>& aInputRect = Nothing(),
    434                      const Maybe<gfx::IntRect>& aInputWriteRect = Nothing(),
    435                      const Maybe<gfx::IntRect>& aOutputWriteRect = Nothing(),
    436                      uint8_t aFuzz = 0);
    437 
    438 /**
    439 * Tests the result of calling WritePixels() using the provided SurfaceFilter
    440 * pipeline. Allows for control over the input color to write, and the expected
    441 * output color.
    442 * @see CheckWritePixels() for documentation of the arguments.
    443 */
    444 void CheckTransformedWritePixels(
    445    Decoder* aDecoder, SurfaceFilter* aFilter, const BGRAColor& aInputColor,
    446    const BGRAColor& aOutputColor,
    447    const Maybe<gfx::IntRect>& aOutputRect = Nothing(),
    448    const Maybe<gfx::IntRect>& aInputRect = Nothing(),
    449    const Maybe<gfx::IntRect>& aInputWriteRect = Nothing(),
    450    const Maybe<gfx::IntRect>& aOutputWriteRect = Nothing(), uint8_t aFuzz = 0);
    451 
    452 ///////////////////////////////////////////////////////////////////////////////
    453 // Decoder Helpers
    454 ///////////////////////////////////////////////////////////////////////////////
    455 
    456 // Friend class of Decoder to access internals for tests.
    457 class MOZ_STACK_CLASS DecoderTestHelper final {
    458 public:
    459  explicit DecoderTestHelper(Decoder* aDecoder) : mDecoder(aDecoder) {}
    460 
    461  void PostIsAnimated(FrameTimeout aTimeout) {
    462    mDecoder->PostIsAnimated(aTimeout);
    463  }
    464 
    465  void PostFrameStop(Opacity aOpacity) { mDecoder->PostFrameStop(aOpacity); }
    466 
    467 private:
    468  Decoder* mDecoder;
    469 };
    470 
    471 ///////////////////////////////////////////////////////////////////////////////
    472 // Test Data
    473 ///////////////////////////////////////////////////////////////////////////////
    474 
    475 ImageTestCase GreenPNGTestCase();
    476 ImageTestCase GreenGIFTestCase();
    477 ImageTestCase GreenJPGTestCase();
    478 ImageTestCase GreenBMPTestCase();
    479 ImageTestCase GreenICOTestCase();
    480 ImageTestCase GreenIconTestCase();
    481 ImageTestCase GreenWebPTestCase();
    482 ImageTestCase GreenAVIFTestCase();
    483 
    484 ImageTestCase NonzeroReservedAVIFTestCase();
    485 ImageTestCase MultipleColrAVIFTestCase();
    486 ImageTestCase Transparent10bit420AVIFTestCase();
    487 ImageTestCase Transparent10bit422AVIFTestCase();
    488 ImageTestCase Transparent10bit444AVIFTestCase();
    489 ImageTestCase Transparent12bit420AVIFTestCase();
    490 ImageTestCase Transparent12bit422AVIFTestCase();
    491 ImageTestCase Transparent12bit444AVIFTestCase();
    492 ImageTestCase Transparent8bit420AVIFTestCase();
    493 ImageTestCase Transparent8bit422AVIFTestCase();
    494 ImageTestCase Transparent8bit444AVIFTestCase();
    495 
    496 ImageTestCase Gray8bitLimitedRangeBT601AVIFTestCase();
    497 ImageTestCase Gray8bitLimitedRangeBT709AVIFTestCase();
    498 ImageTestCase Gray8bitLimitedRangeBT2020AVIFTestCase();
    499 ImageTestCase Gray8bitFullRangeBT601AVIFTestCase();
    500 ImageTestCase Gray8bitFullRangeBT709AVIFTestCase();
    501 ImageTestCase Gray8bitFullRangeBT2020AVIFTestCase();
    502 ImageTestCase Gray10bitLimitedRangeBT601AVIFTestCase();
    503 ImageTestCase Gray10bitLimitedRangeBT709AVIFTestCase();
    504 ImageTestCase Gray10bitLimitedRangeBT2020AVIFTestCase();
    505 ImageTestCase Gray10bitFullRangeBT601AVIFTestCase();
    506 ImageTestCase Gray10bitFullRangeBT709AVIFTestCase();
    507 ImageTestCase Gray10bitFullRangeBT2020AVIFTestCase();
    508 ImageTestCase Gray12bitLimitedRangeBT601AVIFTestCase();
    509 ImageTestCase Gray12bitLimitedRangeBT709AVIFTestCase();
    510 ImageTestCase Gray12bitLimitedRangeBT2020AVIFTestCase();
    511 ImageTestCase Gray12bitFullRangeBT601AVIFTestCase();
    512 ImageTestCase Gray12bitFullRangeBT709AVIFTestCase();
    513 ImageTestCase Gray12bitFullRangeBT2020AVIFTestCase();
    514 ImageTestCase Gray8bitLimitedRangeGrayscaleAVIFTestCase();
    515 ImageTestCase Gray8bitFullRangeGrayscaleAVIFTestCase();
    516 ImageTestCase Gray10bitLimitedRangeGrayscaleAVIFTestCase();
    517 ImageTestCase Gray10bitFullRangeGrayscaleAVIFTestCase();
    518 ImageTestCase Gray12bitLimitedRangeGrayscaleAVIFTestCase();
    519 ImageTestCase Gray12bitFullRangeGrayscaleAVIFTestCase();
    520 
    521 ImageTestCase StackCheckAVIFTestCase();
    522 
    523 ImageTestCase LargeWebPTestCase();
    524 ImageTestCase GreenWebPIccSrgbTestCase();
    525 
    526 ImageTestCase GreenFirstFrameAnimatedGIFTestCase();
    527 ImageTestCase GreenFirstFrameAnimatedPNGTestCase();
    528 ImageTestCase GreenFirstFrameAnimatedWebPTestCase();
    529 ImageTestCase GreenFirstFrameAnimatedAVIFTestCase();
    530 
    531 ImageTestCase BlendAnimatedGIFTestCase();
    532 ImageTestCase BlendAnimatedPNGTestCase();
    533 ImageTestCase BlendAnimatedWebPTestCase();
    534 ImageTestCase BlendAnimatedAVIFTestCase();
    535 
    536 ImageTestCase CorruptTestCase();
    537 ImageTestCase CorruptBMPWithTruncatedHeader();
    538 ImageTestCase CorruptICOWithBadBMPWidthTestCase();
    539 ImageTestCase CorruptICOWithBadBMPHeightTestCase();
    540 ImageTestCase CorruptICOWithBadBppTestCase();
    541 
    542 ImageTestCase TransparentPNGTestCase();
    543 ImageTestCase TransparentGIFTestCase();
    544 ImageTestCase TransparentWebPTestCase();
    545 ImageTestCase TransparentNoAlphaHeaderWebPTestCase();
    546 ImageTestCase FirstFramePaddingGIFTestCase();
    547 ImageTestCase TransparentIfWithinICOBMPTestCase(TestCaseFlags aFlags);
    548 ImageTestCase NoFrameDelayGIFTestCase();
    549 ImageTestCase ExtraImageSubBlocksAnimatedGIFTestCase();
    550 
    551 ImageTestCase TransparentBMPWhenBMPAlphaEnabledTestCase();
    552 ImageTestCase RLE4BMPTestCase();
    553 ImageTestCase RLE8BMPTestCase();
    554 
    555 ImageTestCase DownscaledPNGTestCase();
    556 ImageTestCase DownscaledGIFTestCase();
    557 ImageTestCase DownscaledJPGTestCase();
    558 ImageTestCase DownscaledBMPTestCase();
    559 ImageTestCase DownscaledICOTestCase();
    560 ImageTestCase DownscaledIconTestCase();
    561 ImageTestCase DownscaledWebPTestCase();
    562 ImageTestCase DownscaledTransparentICOWithANDMaskTestCase();
    563 
    564 ImageTestCase TruncatedSmallGIFTestCase();
    565 
    566 ImageTestCase LargeICOWithBMPTestCase();
    567 ImageTestCase LargeICOWithPNGTestCase();
    568 ImageTestCase GreenMultipleSizesICOTestCase();
    569 
    570 ImageTestCase PerfGrayJPGTestCase();
    571 ImageTestCase PerfCmykJPGTestCase();
    572 ImageTestCase PerfYCbCrJPGTestCase();
    573 ImageTestCase PerfRgbPNGTestCase();
    574 ImageTestCase PerfRgbAlphaPNGTestCase();
    575 ImageTestCase PerfGrayPNGTestCase();
    576 ImageTestCase PerfGrayAlphaPNGTestCase();
    577 ImageTestCase PerfRgbLosslessWebPTestCase();
    578 ImageTestCase PerfRgbAlphaLosslessWebPTestCase();
    579 ImageTestCase PerfRgbLossyWebPTestCase();
    580 ImageTestCase PerfRgbAlphaLossyWebPTestCase();
    581 ImageTestCase PerfRgbGIFTestCase();
    582 
    583 ImageTestCase CorruptAVIFTestCase();
    584 ImageTestCase DownscaledAVIFTestCase();
    585 ImageTestCase LargeAVIFTestCase();
    586 ImageTestCase MultiLayerAVIFTestCase();
    587 ImageTestCase TransparentAVIFTestCase();
    588 
    589 #ifdef MOZ_JXL
    590 ImageTestCase GreenJXLTestCase();
    591 ImageTestCase DownscaledJXLTestCase();
    592 ImageTestCase LargeJXLTestCase();
    593 ImageTestCase TransparentJXLTestCase();
    594 #endif
    595 
    596 ImageTestCase ExifResolutionTestCase();
    597 
    598 RefPtr<Image> TestCaseToDecodedImage(const ImageTestCase&);
    599 
    600 }  // namespace image
    601 }  // namespace mozilla
    602 
    603 #endif  // mozilla_image_test_gtest_Common_h