1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "mojo/public/cpp/base/text_direction_mojom_traits.h" 6 #include "testing/gtest/include/gtest/gtest.h" 7 8 namespace mojo_base { 9 namespace text_direction_unittest { 10 11 TEST(TextDirectionTest, TextDirection) { 12 static constexpr base::i18n::TextDirection kTestDirections[] = { 13 base::i18n::LEFT_TO_RIGHT, base::i18n::RIGHT_TO_LEFT, 14 base::i18n::UNKNOWN_DIRECTION}; 15 16 for (auto direction_in : kTestDirections) { 17 base::i18n::TextDirection direction_out; 18 19 mojo_base::mojom::TextDirection serialized_direction = 20 mojo::EnumTraits<mojo_base::mojom::TextDirection, 21 base::i18n::TextDirection>::ToMojom(direction_in); 22 ASSERT_TRUE((mojo::EnumTraits< 23 mojo_base::mojom::TextDirection, 24 base::i18n::TextDirection>::FromMojom(serialized_direction, 25 &direction_out))); 26 EXPECT_EQ(direction_in, direction_out); 27 } 28 } 29 30 } // namespace text_direction_unittest 31 } // namespace mojo_base