gfx/2d/unittest/TestDrawTargetBase.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/2d/unittest/TestDrawTargetBase.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,38 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#pragma once
    1.10 +
    1.11 +#include "2D.h"
    1.12 +#include "TestBase.h"
    1.13 +
    1.14 +#define DT_WIDTH 500
    1.15 +#define DT_HEIGHT 500
    1.16 +
    1.17 +/* This general DrawTarget test class can be reimplemented by a child class
    1.18 + * with optional additional drawtarget-specific tests. And is intended to run
    1.19 + * on a 500x500 32 BPP drawtarget.
    1.20 + */
    1.21 +class TestDrawTargetBase : public TestBase
    1.22 +{
    1.23 +public:
    1.24 +  void Initialized();
    1.25 +  void FillCompletely();
    1.26 +  void FillRect();
    1.27 +
    1.28 +protected:
    1.29 +  TestDrawTargetBase();
    1.30 +
    1.31 +  void RefreshSnapshot();
    1.32 +
    1.33 +  void VerifyAllPixels(const mozilla::gfx::Color &aColor);
    1.34 +  void VerifyPixel(const mozilla::gfx::IntPoint &aPoint,
    1.35 +                   mozilla::gfx::Color &aColor);
    1.36 +
    1.37 +  uint32_t RGBAPixelFromColor(const mozilla::gfx::Color &aColor);
    1.38 +
    1.39 +  mozilla::RefPtr<mozilla::gfx::DrawTarget> mDT;
    1.40 +  mozilla::RefPtr<mozilla::gfx::DataSourceSurface> mDataSnapshot;
    1.41 +};

mercurial