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

Side by Side Diff: chrome/browser/cocoa/ui_localizer_unittest.mm

Issue 155774: Starting mac l10n:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 #import <Foundation/Foundation.h>
6
7 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/cocoa/ui_localizer.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h"
11
12 typedef PlatformTest UILocalizerTest;
13
14 TEST_F(UILocalizerTest, FixUpWindowsStyleLabel) {
15 struct TestData {
16 NSString* input;
17 NSString* output;
18 };
19
20 TestData data[] = {
21 { @"", @"" },
22 { @"nothing", @"nothing" },
23 { @"foo &bar", @"foo bar" },
24 { @"foo &&bar", @"foo &bar" },
25 { @"foo &&&bar", @"foo &bar" },
26 { @"&foo &&bar", @"foo &bar" },
27 { @"&foo &bar", @"foo bar" },
28 { @"foo bar.", @"foo bar." },
29 { @"foo bar..", @"foo bar.." },
30 { @"foo bar...", @"foo bar\u2026" },
31 { @"foo.bar", @"foo.bar" },
32 { @"foo..bar", @"foo..bar" },
33 { @"foo...bar", @"foo\u2026bar" },
34 { @"foo...bar...", @"foo\u2026bar\u2026" },
35 };
36 for (size_t idx = 0; idx < ARRAYSIZE_UNSAFE(data) ; ++idx) {
Mark Mentovai 2009/07/21 21:23:52 Nit: consistency with spacing around ;s.
37 string16 input16(base::SysNSStringToUTF16(data[idx].input));
38
39 NSString* result = ui_localizer::FixUpWindowsStyleLabel(input16);
40 EXPECT_TRUE(result != nil) << "Fixup Failed, idx = " << idx;
41
42 EXPECT_TRUE([data[idx].output isEqualTo:result])
43 << "For idx " << idx << ", expected '" << [data[idx].output UTF8String]
44 << "', got '" << [result UTF8String] << "'";
45 }
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698