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

Side by Side Diff: Source/platform/text/SegmentedStringTest.cpp

Issue 1311043004: Revert of SegmentedString::push() should always push a char in front (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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
« no previous file with comments | « Source/platform/text/SegmentedString.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 29 matching lines...) Expand all
40 SegmentedString original(String("cde")); 40 SegmentedString original(String("cde"));
41 { 41 {
42 SegmentedString copied(original); 42 SegmentedString copied(original);
43 SegmentedString assigned; 43 SegmentedString assigned;
44 assigned = original; 44 assigned = original;
45 EXPECT_EQ("cde", original.toString()); 45 EXPECT_EQ("cde", original.toString());
46 EXPECT_EQ('c', original.currentChar()); 46 EXPECT_EQ('c', original.currentChar());
47 EXPECT_EQ('c', copied.currentChar()); 47 EXPECT_EQ('c', copied.currentChar());
48 EXPECT_EQ('c', assigned.currentChar()); 48 EXPECT_EQ('c', assigned.currentChar());
49 } 49 }
50 original.push('b');
51 {
52 SegmentedString copied(original);
53 SegmentedString assigned;
54 assigned = original;
55 EXPECT_EQ("bcde", original.toString());
56 EXPECT_EQ('b', original.currentChar());
57 EXPECT_EQ('b', copied.currentChar());
58 EXPECT_EQ('b', assigned.currentChar());
59 }
60 original.push('a'); 50 original.push('a');
61 { 51 {
62 SegmentedString copied(original); 52 SegmentedString copied(original);
63 SegmentedString assigned; 53 SegmentedString assigned;
64 assigned = original; 54 assigned = original;
55 EXPECT_EQ("acde", original.toString());
56 EXPECT_EQ('a', original.currentChar());
57 EXPECT_EQ('a', copied.currentChar());
58 EXPECT_EQ('a', assigned.currentChar());
59 }
60 original.push('b');
61 {
62 // Two consecutive push means to push the second char *after* the
63 // first char in SegmentedString.
64 SegmentedString copied(original);
65 SegmentedString assigned;
66 assigned = original;
65 EXPECT_EQ("abcde", original.toString()); 67 EXPECT_EQ("abcde", original.toString());
66 EXPECT_EQ('a', original.currentChar()); 68 EXPECT_EQ('a', original.currentChar());
67 EXPECT_EQ('a', copied.currentChar()); 69 EXPECT_EQ('a', copied.currentChar());
68 EXPECT_EQ('a', assigned.currentChar()); 70 EXPECT_EQ('a', assigned.currentChar());
69 } 71 }
70 original.advance(); 72 original.advance();
71 { 73 {
72 SegmentedString copied(original); 74 SegmentedString copied(original);
73 SegmentedString assigned; 75 SegmentedString assigned;
74 assigned = original; 76 assigned = original;
75 EXPECT_EQ("bcde", original.toString()); 77 EXPECT_EQ("bcde", original.toString());
76 EXPECT_EQ('b', original.currentChar()); 78 EXPECT_EQ('b', original.currentChar());
77 EXPECT_EQ('b', copied.currentChar()); 79 EXPECT_EQ('b', copied.currentChar());
78 EXPECT_EQ('b', assigned.currentChar()); 80 EXPECT_EQ('b', assigned.currentChar());
79 } 81 }
80 } 82 }
81 83
82 } // namespace blink 84 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/text/SegmentedString.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698