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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_units_test.cc

Issue 2282213002: [LayoutNG] Introduce NGPhysicalFragment and make NGFragment a 'view' (Closed)
Patch Set: address comments. Created 4 years, 4 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 | « third_party/WebKit/Source/core/layout/ng/ng_units.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/ng_units_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_units_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_units_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d5610fcc4bb62089b2436aff1857d9dce9182462
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units_test.cc
@@ -0,0 +1,74 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/layout/ng/ng_units.h"
+
+#include "core/layout/ng/ng_direction.h"
+#include "core/layout/ng/ng_writing_mode.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+namespace {
+
+TEST(NGUnitsTest, ConvertLogicalOffsetToPhysicalOffset) {
+ NGLogicalOffset logical_offset(LayoutUnit(20), LayoutUnit(30));
+ NGPhysicalSize container_size(LayoutUnit(300), LayoutUnit(400));
+ NGPhysicalSize inner_size(LayoutUnit(5), LayoutUnit(65));
+ NGPhysicalOffset offset;
+
+ offset = logical_offset.ConvertToPhysical(HorizontalTopBottom, LeftToRight,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(20), offset.left);
+ EXPECT_EQ(LayoutUnit(30), offset.top);
+
+ offset = logical_offset.ConvertToPhysical(HorizontalTopBottom, RightToLeft,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(275), offset.left);
+ EXPECT_EQ(LayoutUnit(30), offset.top);
+
+ offset = logical_offset.ConvertToPhysical(VerticalRightLeft, LeftToRight,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(265), offset.left);
+ EXPECT_EQ(LayoutUnit(20), offset.top);
+
+ offset = logical_offset.ConvertToPhysical(VerticalRightLeft, RightToLeft,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(265), offset.left);
+ EXPECT_EQ(LayoutUnit(315), offset.top);
+
+ offset = logical_offset.ConvertToPhysical(SidewaysRightLeft, LeftToRight,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(265), offset.left);
+ EXPECT_EQ(LayoutUnit(20), offset.top);
+
+ offset = logical_offset.ConvertToPhysical(SidewaysRightLeft, RightToLeft,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(265), offset.left);
+ EXPECT_EQ(LayoutUnit(315), offset.top);
+
+ offset = logical_offset.ConvertToPhysical(VerticalLeftRight, LeftToRight,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(30), offset.left);
+ EXPECT_EQ(LayoutUnit(20), offset.top);
+
+ offset = logical_offset.ConvertToPhysical(VerticalLeftRight, RightToLeft,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(30), offset.left);
+ EXPECT_EQ(LayoutUnit(315), offset.top);
+
+ offset = logical_offset.ConvertToPhysical(SidewaysLeftRight, LeftToRight,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(30), offset.left);
+ EXPECT_EQ(LayoutUnit(315), offset.top);
+
+ offset = logical_offset.ConvertToPhysical(SidewaysLeftRight, RightToLeft,
+ container_size, inner_size);
+ EXPECT_EQ(LayoutUnit(30), offset.left);
+ EXPECT_EQ(LayoutUnit(20), offset.top);
+}
+
+} // namespace
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_units.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698