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

Side by Side Diff: cc/paint/paint_op_buffer_unittest.cc

Issue 2899483002: cc: Audit and static_assert the types in PaintOpBuffer can be moved.
Patch Set: check-copy better-better-comment Created 3 years, 7 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
« cc/paint/paint_image.h ('K') | « cc/paint/paint_op_buffer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/paint/paint_op_buffer.h" 5 #include "cc/paint/paint_op_buffer.h"
6 #include "cc/paint/display_item_list.h" 6 #include "cc/paint/display_item_list.h"
7 #include "cc/test/skia_common.h" 7 #include "cc/test/skia_common.h"
8 #include "cc/test/test_skcanvas.h" 8 #include "cc/test/test_skcanvas.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/effects/SkDashPathEffect.h" 10 #include "third_party/skia/include/effects/SkDashPathEffect.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 SaveLayerOp* save_op = static_cast<SaveLayerOp*>(*iter); 56 SaveLayerOp* save_op = static_cast<SaveLayerOp*>(*iter);
57 EXPECT_EQ(save_op->bounds, rect); 57 EXPECT_EQ(save_op->bounds, rect);
58 EXPECT_TRUE(save_op->flags == flags); 58 EXPECT_TRUE(save_op->flags == flags);
59 ++iter; 59 ++iter;
60 60
61 ASSERT_EQ(iter->GetType(), PaintOpType::Save); 61 ASSERT_EQ(iter->GetType(), PaintOpType::Save);
62 ++iter; 62 ++iter;
63 63
64 ASSERT_EQ(iter->GetType(), PaintOpType::DrawColor); 64 ASSERT_EQ(iter->GetType(), PaintOpType::DrawColor);
65 DrawColorOp* op = static_cast<DrawColorOp*>(*iter); 65 DrawColorOp* op = static_cast<DrawColorOp*>(*iter);
66 EXPECT_EQ(op->color, draw_color); 66 EXPECT_EQ(static_cast<SkColor>(op->color), draw_color);
67 EXPECT_EQ(op->mode, blend); 67 EXPECT_EQ(static_cast<SkBlendMode>(op->mode), blend);
68 ++iter; 68 ++iter;
69 69
70 ASSERT_EQ(iter->GetType(), PaintOpType::Restore); 70 ASSERT_EQ(iter->GetType(), PaintOpType::Restore);
71 ++iter; 71 ++iter;
72 72
73 EXPECT_FALSE(iter); 73 EXPECT_FALSE(iter);
74 } 74 }
75 75
76 // PaintOpBuffer has a special case for first ops stored locally, so 76 // PaintOpBuffer has a special case for first ops stored locally, so
77 // make sure that appending different kind of ops as a first op works 77 // make sure that appending different kind of ops as a first op works
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 490
491 // Drawing a record with slow paths into another adds the same 491 // Drawing a record with slow paths into another adds the same
492 // number of slow paths as the record. 492 // number of slow paths as the record.
493 auto buffer2 = sk_make_sp<PaintOpBuffer>(); 493 auto buffer2 = sk_make_sp<PaintOpBuffer>();
494 EXPECT_EQ(buffer2->numSlowPaths(), 0); 494 EXPECT_EQ(buffer2->numSlowPaths(), 0);
495 buffer2->push<DrawRecordOp>(buffer); 495 buffer2->push<DrawRecordOp>(buffer);
496 EXPECT_EQ(buffer->numSlowPaths(), buffer2->numSlowPaths()); 496 EXPECT_EQ(buffer->numSlowPaths(), buffer2->numSlowPaths());
497 } 497 }
498 498
499 } // namespace cc 499 } // namespace cc
OLDNEW
« cc/paint/paint_image.h ('K') | « cc/paint/paint_op_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698