OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/layout/ng/ng_length_utils.h" | 5 #include "core/layout/ng/ng_length_utils.h" |
6 | 6 |
7 #include "core/layout/ng/ng_box_fragment.h" | 7 #include "core/layout/ng/ng_box_fragment.h" |
8 #include "core/layout/ng/ng_constraint_space.h" | 8 #include "core/layout/ng/ng_constraint_space.h" |
9 #include "core/layout/ng/ng_constraint_space_builder.h" | 9 #include "core/layout/ng/ng_constraint_space_builder.h" |
10 #include "core/layout/ng/ng_fragment_builder.h" | 10 #include "core/layout/ng/ng_fragment_builder.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 EXPECT_EQ(LayoutUnit(52), margins.inline_end); | 354 EXPECT_EQ(LayoutUnit(52), margins.inline_end); |
355 EXPECT_EQ(LayoutUnit(), margins.block_end); | 355 EXPECT_EQ(LayoutUnit(), margins.block_end); |
356 EXPECT_EQ(LayoutUnit(22), margins.inline_start); | 356 EXPECT_EQ(LayoutUnit(22), margins.inline_start); |
357 } | 357 } |
358 | 358 |
359 TEST_F(NGLengthUtilsTest, testBorders) { | 359 TEST_F(NGLengthUtilsTest, testBorders) { |
360 style_->SetBorderTopWidth(1); | 360 style_->SetBorderTopWidth(1); |
361 style_->SetBorderRightWidth(2); | 361 style_->SetBorderRightWidth(2); |
362 style_->SetBorderBottomWidth(3); | 362 style_->SetBorderBottomWidth(3); |
363 style_->SetBorderLeftWidth(4); | 363 style_->SetBorderLeftWidth(4); |
364 style_->SetBorderTopStyle(kBorderStyleSolid); | 364 style_->SetBorderTopStyle(EBorderStyle::kSolid); |
365 style_->SetBorderRightStyle(kBorderStyleSolid); | 365 style_->SetBorderRightStyle(EBorderStyle::kSolid); |
366 style_->SetBorderBottomStyle(kBorderStyleSolid); | 366 style_->SetBorderBottomStyle(EBorderStyle::kSolid); |
367 style_->SetBorderLeftStyle(kBorderStyleSolid); | 367 style_->SetBorderLeftStyle(EBorderStyle::kSolid); |
368 style_->SetWritingMode(WritingMode::kVerticalLr); | 368 style_->SetWritingMode(WritingMode::kVerticalLr); |
369 | 369 |
370 RefPtr<NGConstraintSpace> constraint_space( | 370 RefPtr<NGConstraintSpace> constraint_space( |
371 ConstructConstraintSpace(200, 300)); | 371 ConstructConstraintSpace(200, 300)); |
372 | 372 |
373 NGBoxStrut borders = ComputeBorders(*constraint_space, *style_); | 373 NGBoxStrut borders = ComputeBorders(*constraint_space, *style_); |
374 | 374 |
375 EXPECT_EQ(LayoutUnit(4), borders.block_start); | 375 EXPECT_EQ(LayoutUnit(4), borders.block_start); |
376 EXPECT_EQ(LayoutUnit(3), borders.inline_end); | 376 EXPECT_EQ(LayoutUnit(3), borders.inline_end); |
377 EXPECT_EQ(LayoutUnit(2), borders.block_end); | 377 EXPECT_EQ(LayoutUnit(2), borders.block_end); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 EXPECT_EQ(125, GetUsedColumnWidth(4, 100, 10, 530)); | 496 EXPECT_EQ(125, GetUsedColumnWidth(4, 100, 10, 530)); |
497 EXPECT_EQ(4, GetUsedColumnCount(4, 100, 10, 530)); | 497 EXPECT_EQ(4, GetUsedColumnCount(4, 100, 10, 530)); |
498 EXPECT_EQ(100, GetUsedColumnWidth(6, 100, 10, 540)); | 498 EXPECT_EQ(100, GetUsedColumnWidth(6, 100, 10, 540)); |
499 EXPECT_EQ(5, GetUsedColumnCount(6, 100, 10, 540)); | 499 EXPECT_EQ(5, GetUsedColumnCount(6, 100, 10, 540)); |
500 EXPECT_EQ(100, GetUsedColumnWidth(0, 100, 10, 540)); | 500 EXPECT_EQ(100, GetUsedColumnWidth(0, 100, 10, 540)); |
501 EXPECT_EQ(5, GetUsedColumnCount(0, 100, 10, 540)); | 501 EXPECT_EQ(5, GetUsedColumnCount(0, 100, 10, 540)); |
502 } | 502 } |
503 | 503 |
504 } // namespace | 504 } // namespace |
505 } // namespace blink | 505 } // namespace blink |
OLD | NEW |