Backed out changeset 665bcbc87862 (bug 1341490)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 23 Feb 2017 00:47:26 +0100
changeset 373462 1fa7b9c7d739737d7015e46c47810c499ebc0e0e
parent 373461 9d35d61ac2ac342b4236e2ec2fb66efc93c31542
child 373463 c8dc302b26ac7620191c8d53e52b0bb5b44886dd
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1341490
milestone54.0a1
backs out665bcbc8786275c50fb9b6b473a8f798e6f72e10
Backed out changeset 665bcbc87862 (bug 1341490)
gfx/tests/gtest/TestTiledLayerBuffer.cpp
gfx/tests/gtest/moz.build
new file mode 100644
--- /dev/null
+++ b/gfx/tests/gtest/TestTiledLayerBuffer.cpp
@@ -0,0 +1,64 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+#include "TiledLayerBuffer.h"
+
+#include "gtest/gtest.h"
+
+namespace mozilla {
+namespace layers {
+
+TEST(TiledLayerBuffer, TileStart) {
+  ASSERT_EQ(RoundDownToTileEdge(10, 256), 0);
+  ASSERT_EQ(RoundDownToTileEdge(-10, 256), -256);
+}
+
+TEST(TiledLayerBuffer, TilesPlacement) {
+  for (int firstY = -10; firstY < 10; ++firstY) {
+    for (int firstX = -10; firstX < 10; ++firstX) {
+      for (int height = 1; height < 10; ++height) {
+        for (int width = 1; width < 10; ++width) {
+
+          const TilesPlacement p1 = TilesPlacement(firstX, firstY, width, height);
+          // Check that HasTile returns false with some positions that we know
+          // not to be in the rectangle of the TilesPlacement.
+          ASSERT_FALSE(p1.HasTile(TileIntPoint(firstX - 1, 0)));
+          ASSERT_FALSE(p1.HasTile(TileIntPoint(0, firstY - 1)));
+          ASSERT_FALSE(p1.HasTile(TileIntPoint(firstX + width + 1,  0)));
+          ASSERT_FALSE(p1.HasTile(TileIntPoint(0, firstY + height + 1)));
+
+          // Verify that all positions within the rect that defines the
+          // TilesPlacement map to indices between 0 and width*height.
+          for (int y = firstY; y < (firstY+height); ++y) {
+            for (int x = firstX; x < (firstX+width); ++x) {
+              ASSERT_TRUE(p1.HasTile(TileIntPoint(x,y)));
+              ASSERT_TRUE(p1.TileIndex(TileIntPoint(x, y)) >= 0);
+              ASSERT_TRUE(p1.TileIndex(TileIntPoint(x, y)) < width * height);
+            }
+          }
+
+          // XXX - This causes some versions of gcc to warn that it optimizes
+          // away the test, which gets caught in -WError in PGO builds.
+          // The lazy thing to do is to just comment this out since this specific
+          // test isn't critically important, but we should remove the warning instead.
+          // cf. bug 1179287
+          //
+          // Verify that indices map to positions that are within the rect that
+          // defines the TilesPlacement.
+          // for (int i = 0; i < width * height; ++i) {
+          //   ASSERT_TRUE(p1.TilePosition(i).x >= firstX);
+          //   ASSERT_TRUE(p1.TilePosition(i).x < firstX + width);
+          //   ASSERT_TRUE(p1.TilePosition(i).y >= firstY);
+          //   ASSERT_TRUE(p1.TilePosition(i).y < firstY + height);
+          // }
+
+        }
+      }
+    }
+  }
+}
+
+}
+}
--- a/gfx/tests/gtest/moz.build
+++ b/gfx/tests/gtest/moz.build
@@ -23,16 +23,18 @@ UNIFIED_SOURCES += [
     'TestQcms.cpp',
     'TestRect.cpp',
     'TestRegion.cpp',
     'TestSkipChars.cpp',
     'TestSwizzle.cpp',
     'TestTextureCompatibility.cpp',
     'TestTextures.cpp',
     'TestTreeTraversal.cpp',
+    # Bug 1179287 - PGO bustage on Linux
+    #'TestTiledLayerBuffer.cpp',
     'TestVsync.cpp',
 ]
 
 UNIFIED_SOURCES += [ '/gfx/2d/unittest/%s' % p for p in [
     'TestBase.cpp',
     'TestBugs.cpp',
     'TestCairo.cpp',
     'TestPoint.cpp',