Bug 950550. Test. r=jrmuizel
authorNicholas Cameron <ncameron@mozilla.com>
Tue, 07 Jan 2014 11:27:07 +1300
changeset 162288 2c5fcba9480cbfcac8841d239596df9aed0b2a45
parent 162287 1fa9d7cf6d623552d4a4c86b374eaccd5c3354eb
child 162289 72af8e9c325cdd9aaa05b8c7d53a933e86c18173
push idunknown
push userunknown
push dateunknown
reviewersjrmuizel
bugs950550
milestone29.0a1
Bug 950550. Test. r=jrmuizel
gfx/2d/unittest/TestBugs.cpp
gfx/2d/unittest/TestBugs.h
--- a/gfx/2d/unittest/TestBugs.cpp
+++ b/gfx/2d/unittest/TestBugs.cpp
@@ -8,16 +8,17 @@
 #include <string.h>
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
 TestBugs::TestBugs()
 {
   REGISTER_TEST(TestBugs, CairoClip918671);
+  REGISTER_TEST(TestBugs, PushPopClip950550);
 }
 
 void
 TestBugs::CairoClip918671()
 {
   RefPtr<DrawTarget> dt = Factory::CreateDrawTarget(BACKEND_CAIRO,
                                                     IntSize(100, 100),
                                                     FORMAT_B8G8R8A8);
@@ -62,8 +63,24 @@ TestBugs::CairoClip918671()
   for (int y = 0; y < dt->GetSize().height; y++) {
     VERIFY(memcmp(dataSurf1->GetData() + y * dataSurf1->Stride(),
                   dataSurf2->GetData() + y * dataSurf2->Stride(),
                   dataSurf1->GetSize().width * 4) == 0);
   }
 
 }
 
+void
+TestBugs::PushPopClip950550()
+{
+  RefPtr<DrawTarget> dt = Factory::CreateDrawTarget(BACKEND_CAIRO,
+                                                    IntSize(500, 500),
+                                                    FORMAT_B8G8R8A8);
+  dt->PushClipRect(Rect(0, 0, 100, 100));
+  Matrix m(1, 0, 0, 1, 45, -100);
+  dt->SetTransform(m);
+  dt->PopClip();
+
+  // We fail the test if we assert in this call because our draw target's
+  // transforms are out of sync.
+  dt->FillRect(Rect(50, 50, 50, 50), ColorPattern(Color(0.5f, 0, 0, 1.0f)));
+}
+
--- a/gfx/2d/unittest/TestBugs.h
+++ b/gfx/2d/unittest/TestBugs.h
@@ -8,10 +8,11 @@
 #include "TestBase.h"
 
 class TestBugs : public TestBase
 {
 public:
   TestBugs();
 
   void CairoClip918671();
+  void PushPopClip950550();
 };