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

Side by Side Diff: cc/quads/draw_quad_unittest.cc

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « cc/quads/checkerboard_draw_quad.cc ('k') | cc/quads/render_pass_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/quads/draw_quad.h" 5 #include "cc/quads/draw_quad.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \ 362 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
363 { \ 363 { \
364 QUAD_DATA quad_new->SetNew( \ 364 QUAD_DATA quad_new->SetNew( \
365 shared_state, quad_rect, a, b, c, d, e, f, g, h); \ 365 shared_state, quad_rect, a, b, c, d, e, f, g, h); \
366 } \ 366 } \
367 SETUP_AND_COPY_QUAD_NEW_RP(Type, quad_new, copy_a); 367 SETUP_AND_COPY_QUAD_NEW_RP(Type, quad_new, copy_a);
368 368
369 TEST(DrawQuadTest, CopyCheckerboardDrawQuad) { 369 TEST(DrawQuadTest, CopyCheckerboardDrawQuad) {
370 gfx::Rect visible_rect(40, 50, 30, 20); 370 gfx::Rect visible_rect(40, 50, 30, 20);
371 SkColor color = 0xfabb0011; 371 SkColor color = 0xfabb0011;
372 float scale = 2.3f;
372 CREATE_SHARED_STATE(); 373 CREATE_SHARED_STATE();
373 374
374 CREATE_QUAD_2_NEW(CheckerboardDrawQuad, visible_rect, color); 375 CREATE_QUAD_3_NEW(CheckerboardDrawQuad, visible_rect, color, scale);
375 EXPECT_EQ(DrawQuad::CHECKERBOARD, copy_quad->material); 376 EXPECT_EQ(DrawQuad::CHECKERBOARD, copy_quad->material);
376 EXPECT_EQ(visible_rect, copy_quad->visible_rect); 377 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
377 EXPECT_EQ(color, copy_quad->color); 378 EXPECT_EQ(color, copy_quad->color);
379 EXPECT_EQ(scale, copy_quad->scale);
378 380
379 CREATE_QUAD_1_ALL(CheckerboardDrawQuad, color); 381 CREATE_QUAD_2_ALL(CheckerboardDrawQuad, color, scale);
380 EXPECT_EQ(DrawQuad::CHECKERBOARD, copy_quad->material); 382 EXPECT_EQ(DrawQuad::CHECKERBOARD, copy_quad->material);
381 EXPECT_EQ(color, copy_quad->color); 383 EXPECT_EQ(color, copy_quad->color);
384 EXPECT_EQ(scale, copy_quad->scale);
382 } 385 }
383 386
384 TEST(DrawQuadTest, CopyDebugBorderDrawQuad) { 387 TEST(DrawQuadTest, CopyDebugBorderDrawQuad) {
385 gfx::Rect visible_rect(40, 50, 30, 20); 388 gfx::Rect visible_rect(40, 50, 30, 20);
386 SkColor color = 0xfabb0011; 389 SkColor color = 0xfabb0011;
387 int width = 99; 390 int width = 99;
388 CREATE_SHARED_STATE(); 391 CREATE_SHARED_STATE();
389 392
390 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width); 393 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width);
391 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material); 394 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material);
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 return num_resources_; 732 return num_resources_;
730 } 733 }
731 734
732 private: 735 private:
733 int num_resources_; 736 int num_resources_;
734 }; 737 };
735 738
736 TEST_F(DrawQuadIteratorTest, CheckerboardDrawQuad) { 739 TEST_F(DrawQuadIteratorTest, CheckerboardDrawQuad) {
737 gfx::Rect visible_rect(40, 50, 30, 20); 740 gfx::Rect visible_rect(40, 50, 30, 20);
738 SkColor color = 0xfabb0011; 741 SkColor color = 0xfabb0011;
742 float scale = 3.2f;
739 743
740 CREATE_SHARED_STATE(); 744 CREATE_SHARED_STATE();
741 CREATE_QUAD_2_NEW(CheckerboardDrawQuad, visible_rect, color); 745 CREATE_QUAD_3_NEW(CheckerboardDrawQuad, visible_rect, color, scale);
742 EXPECT_EQ(0, IterateAndCount(quad_new)); 746 EXPECT_EQ(0, IterateAndCount(quad_new));
743 } 747 }
744 748
745 TEST_F(DrawQuadIteratorTest, DebugBorderDrawQuad) { 749 TEST_F(DrawQuadIteratorTest, DebugBorderDrawQuad) {
746 gfx::Rect visible_rect(40, 50, 30, 20); 750 gfx::Rect visible_rect(40, 50, 30, 20);
747 SkColor color = 0xfabb0011; 751 SkColor color = 0xfabb0011;
748 int width = 99; 752 int width = 99;
749 753
750 CREATE_SHARED_STATE(); 754 CREATE_SHARED_STATE();
751 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width); 755 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); 1029 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad);
1026 break; 1030 break;
1027 case DrawQuad::INVALID: 1031 case DrawQuad::INVALID:
1028 break; 1032 break;
1029 } 1033 }
1030 } 1034 }
1031 } 1035 }
1032 1036
1033 } // namespace 1037 } // namespace
1034 } // namespace cc 1038 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/checkerboard_draw_quad.cc ('k') | cc/quads/render_pass_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698