diff options
Diffstat (limited to 'ui/gfx/linux_util_unittest.cc')
-rw-r--r-- | ui/gfx/linux_util_unittest.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ui/gfx/linux_util_unittest.cc b/ui/gfx/linux_util_unittest.cc new file mode 100644 index 0000000..c1cbfa8 --- /dev/null +++ b/ui/gfx/linux_util_unittest.cc @@ -0,0 +1,31 @@ +// Copyright (c) 2012 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 "ui/gfx/linux_util.h" + +#include "base/basictypes.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace gfx { + +TEST(LinuxUtilTest, ConvertAcceleratorsFromWindowsStyle) { + static const struct { + const char* input; + const char* output; + } cases[] = { + { "", "" }, + { "nothing", "nothing" }, + { "foo &bar", "foo _bar" }, + { "foo &&bar", "foo &bar" }, + { "foo &&&bar", "foo &_bar" }, + { "&foo &&bar", "_foo &bar" }, + { "&foo &bar", "_foo _bar" }, + }; + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { + std::string result = ConvertAcceleratorsFromWindowsStyle(cases[i].input); + EXPECT_EQ(cases[i].output, result); + } +} + +} // namespace gfx |