Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Unified Diff: components/exo/surface_unittest.cc

Issue 1548163002: exo: Add Surface::SetBufferScale. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use contents_size to determine layer transform Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/exo/surface.cc ('k') | components/exo/wayland/server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/surface_unittest.cc
diff --git a/components/exo/surface_unittest.cc b/components/exo/surface_unittest.cc
index 96d43fc41b54a4630e0458f1614c0133aa9eb4f1..3ba3a7d522c2a75ad31ae22cdfb8e3dca9fa4e64 100644
--- a/components/exo/surface_unittest.cc
+++ b/components/exo/surface_unittest.cc
@@ -91,6 +91,27 @@ TEST_F(SurfaceTest, SetOpaqueRegion) {
surface->SetOpaqueRegion(SkRegion(SkIRect::MakeEmpty()));
}
+TEST_F(SurfaceTest, SetBufferScale) {
+ gfx::Size buffer_size(512, 512);
+ scoped_ptr<Buffer> buffer(
+ new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size).Pass(),
+ GL_TEXTURE_2D));
+ scoped_ptr<Surface> surface(new Surface);
+
+ // Attach the buffer to the surface. This will update the pending bounds of
+ // the surface to the buffer size.
+ surface->Attach(buffer.get());
+ EXPECT_EQ(buffer_size.ToString(), surface->GetPreferredSize().ToString());
+
+ // This will update the pending bounds of the surface and take the buffer
+ // scale into account.
+ const float kBufferScale = 2.0f;
+ surface->SetBufferScale(kBufferScale);
+ EXPECT_EQ(
+ gfx::ScaleToFlooredSize(buffer_size, 1.0f / kBufferScale).ToString(),
+ surface->GetPreferredSize().ToString());
+}
+
TEST_F(SurfaceTest, Commit) {
scoped_ptr<Surface> surface(new Surface);
« no previous file with comments | « components/exo/surface.cc ('k') | components/exo/wayland/server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698