summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_graphics_2d.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-01 16:16:50 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-01 16:16:50 +0000
commit1758e88fd909ea0ffd49621e8066ffad5627ffdf (patch)
treec304a5eed047cae5665f5af1739d84655fb5815d /ppapi/tests/test_graphics_2d.h
parente7d8b51953b7d3b2b8a0aba46132305b32f3efce (diff)
downloadchromium_src-1758e88fd909ea0ffd49621e8066ffad5627ffdf.zip
chromium_src-1758e88fd909ea0ffd49621e8066ffad5627ffdf.tar.gz
chromium_src-1758e88fd909ea0ffd49621e8066ffad5627ffdf.tar.bz2
Move PPAPI into the Chrome repo. The old repo was
http://ppapi.googlecode.com/ TEST=none BUG=none git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_graphics_2d.h')
-rw-r--r--ppapi/tests/test_graphics_2d.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/ppapi/tests/test_graphics_2d.h b/ppapi/tests/test_graphics_2d.h
new file mode 100644
index 0000000..a82207f
--- /dev/null
+++ b/ppapi/tests/test_graphics_2d.h
@@ -0,0 +1,88 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PAPPI_TESTS_TEST_GRAPHICS_2D_H_
+#define PAPPI_TESTS_TEST_GRAPHICS_2D_H_
+
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/tests/test_case.h"
+
+struct PPB_Graphics2D;
+struct PPB_ImageData;
+struct PPB_Testing_Dev;
+
+namespace pp {
+class Graphics2D;
+class ImageData;
+class Point;
+class Rect;
+}
+
+class TestGraphics2D : public TestCase {
+ public:
+ TestGraphics2D(TestingInstance* instance) : TestCase(instance) {}
+
+ // TestCase implementation.
+ virtual bool Init();
+ virtual void RunTest();
+
+ void QuitMessageLoop();
+
+ private:
+ bool ReadImageData(const pp::Graphics2D& dc,
+ pp::ImageData* image,
+ const pp::Point& top_left) const;
+
+ void FillRectInImage(pp::ImageData* image,
+ const pp::Rect& rect,
+ uint32_t color) const;
+
+ // Fill image with gradient colors.
+ void FillImageWithGradient(pp::ImageData* image) const;
+
+ // Return true if images are the same.
+ bool CompareImages(const pp::ImageData& image1,
+ const pp::ImageData& image2);
+
+ // Return true if images within specified rectangles are the same.
+ bool CompareImageRect(const pp::ImageData& image1,
+ const pp::Rect& rc1,
+ const pp::ImageData& image2,
+ const pp::Rect& rc2) const;
+
+ // Validates that the given image is a single color with a square of another
+ // color inside it.
+ bool IsSquareInImage(const pp::ImageData& image_data,
+ uint32_t background_color,
+ const pp::Rect& square, uint32_t square_color) const;
+
+ // Validates that the given device context is a single color with a square of
+ // another color inside it.
+ bool IsSquareInDC(const pp::Graphics2D& dc, uint32_t background_color,
+ const pp::Rect& square, uint32_t square_color) const;
+
+ // Validates that the given device context is filled with the given color.
+ bool IsDCUniformColor(const pp::Graphics2D& dc, uint32_t color) const;
+
+ // Issues a flush on the given device context and blocks until the flush
+ // has issued its callback. Returns true on success.
+ bool FlushAndWaitForDone(pp::Graphics2D* context);
+
+ std::string TestInvalidResource();
+ std::string TestInvalidSize();
+ std::string TestHumongous();
+ std::string TestInitToZero();
+ std::string TestDescribe();
+ std::string TestPaint();
+ std::string TestScroll();
+ std::string TestReplace();
+ std::string TestFlush();
+
+ // Used by the tests that access the C API directly.
+ const PPB_Graphics2D* graphics_2d_interface_;
+ const PPB_ImageData* image_data_interface_;
+ const PPB_Testing_Dev* testing_interface_;
+};
+
+#endif // PAPPI_TESTS_TEST_GRAPHICS_2D_H_