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

Unified Diff: LayoutTests/svg/text/text-getSubStringLength.html

Issue 206663003: Clip the start position when performing SVG text queries (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add missing -expected.txt. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/svg/text/text-getSubStringLength-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/text/text-getSubStringLength.html
diff --git a/LayoutTests/svg/text/text-getSubStringLength.html b/LayoutTests/svg/text/text-getSubStringLength.html
new file mode 100644
index 0000000000000000000000000000000000000000..2698cb6de7896362a487c30486227002c50bb6fd
--- /dev/null
+++ b/LayoutTests/svg/text/text-getSubStringLength.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<title>SVGTextContentElement.getSubStringLength</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<div id=log></div>
+<div>
+ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
+ <text x="10" y="20">W3C &#x0646;&#x0634;&#x0627;&#x0637;</text>
+ <text x="10 50" y="40">AB</text>
+ </svg>
+</div>
+<script>
+test(function() {
+ var text = document.querySelector('text');
+ assert_equals(text.getNumberOfChars(), 8);
+ var lenFirst4 = text.getSubStringLength(0, 4);
+ var lenLast4 = text.getSubStringLength(4, 4);
+ var lenAll = text.getSubStringLength(0, 8);
+ assert_approx_equals(lenFirst4 + lenLast4, lenAll, 0.01, 'Sum of the parts equal the total.');
+}, document.title+', BiDi.');
+test(function() {
+ var text = document.querySelector('text + text');
+ assert_equals(text.getNumberOfChars(), 2);
+ var lenFirst = text.getSubStringLength(0, 1);
+ var lenLast = text.getSubStringLength(1, 1);
+ var lenAll = text.getSubStringLength(0, 2);
+ assert_approx_equals(lenFirst + lenLast, lenAll, 0.01, 'Sum of the parts equal the total.');
+}, document.title+', multiple text-chunks.');
+</script>
« no previous file with comments | « no previous file | LayoutTests/svg/text/text-getSubStringLength-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698