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

Side by Side Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp

Issue 2922233002: [ActiveSuggestionMarker #1] Introduce abstract StyleableMarker subclass of DocumentMarker (Closed)
Patch Set: Add test for IsStyleableMarker() Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 EXPECT_EQ(1u, new_rendered_rects.size()); 213 EXPECT_EQ(1u, new_rendered_rects.size());
214 EXPECT_NE(rendered_rects[0], new_rendered_rects[0]); 214 EXPECT_NE(rendered_rects[0], new_rendered_rects[0]);
215 } 215 }
216 216
217 TEST_F(DocumentMarkerControllerTest, CompositionMarkersNotMerged) { 217 TEST_F(DocumentMarkerControllerTest, CompositionMarkersNotMerged) {
218 SetBodyInnerHTML("<div style='margin: 100px'>foo</div>"); 218 SetBodyInnerHTML("<div style='margin: 100px'>foo</div>");
219 Node* text = GetDocument().body()->firstChild()->firstChild(); 219 Node* text = GetDocument().body()->firstChild()->firstChild();
220 GetDocument().UpdateStyleAndLayout(); 220 GetDocument().UpdateStyleAndLayout();
221 MarkerController().AddCompositionMarker( 221 MarkerController().AddCompositionMarker(
222 EphemeralRange(Position(text, 0), Position(text, 1)), Color::kBlack, 222 EphemeralRange(Position(text, 0), Position(text, 1)), Color::kBlack,
223 CompositionMarker::Thickness::kThin, Color::kBlack); 223 StyleableMarker::Thickness::kThin, Color::kBlack);
224 MarkerController().AddCompositionMarker( 224 MarkerController().AddCompositionMarker(
225 EphemeralRange(Position(text, 1), Position(text, 3)), Color::kBlack, 225 EphemeralRange(Position(text, 1), Position(text, 3)), Color::kBlack,
226 CompositionMarker::Thickness::kThick, Color::kBlack); 226 StyleableMarker::Thickness::kThick, Color::kBlack);
227 227
228 EXPECT_EQ(2u, MarkerController().Markers().size()); 228 EXPECT_EQ(2u, MarkerController().Markers().size());
229 } 229 }
230 230
231 TEST_F(DocumentMarkerControllerTest, SetMarkerActiveTest) { 231 TEST_F(DocumentMarkerControllerTest, SetMarkerActiveTest) {
232 SetBodyInnerHTML("<b>foo</b>"); 232 SetBodyInnerHTML("<b>foo</b>");
233 GetDocument().UpdateStyleAndLayout(); 233 GetDocument().UpdateStyleAndLayout();
234 Element* b_element = ToElement(GetDocument().body()->firstChild()); 234 Element* b_element = ToElement(GetDocument().body()->firstChild());
235 EphemeralRange ephemeral_range = EphemeralRange::RangeOfContents(*b_element); 235 EphemeralRange ephemeral_range = EphemeralRange::RangeOfContents(*b_element);
236 Position start_b_element = 236 Position start_b_element =
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 // RemoveSpellingMarkersUnderWords does not remove text match marker. 324 // RemoveSpellingMarkersUnderWords does not remove text match marker.
325 ASSERT_EQ(1u, MarkerController().Markers().size()); 325 ASSERT_EQ(1u, MarkerController().Markers().size());
326 const DocumentMarker& marker = *MarkerController().Markers()[0]; 326 const DocumentMarker& marker = *MarkerController().Markers()[0];
327 EXPECT_EQ(0u, marker.StartOffset()); 327 EXPECT_EQ(0u, marker.StartOffset());
328 EXPECT_EQ(3u, marker.EndOffset()); 328 EXPECT_EQ(3u, marker.EndOffset());
329 EXPECT_EQ(DocumentMarker::kTextMatch, marker.GetType()); 329 EXPECT_EQ(DocumentMarker::kTextMatch, marker.GetType());
330 } 330 }
331 331
332 } // namespace blink 332 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698