From 480fb6400478d95a4cadd823e7f995db23dc9a0c Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Sun, 17 Feb 2013 21:07:42 +0000 Subject: [PATCH] Unit test for text elements in coords git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2420 eee81c28-f429-11dd-99c0-75d572ba1ddd --- test/coords_test.html | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/test/coords_test.html b/test/coords_test.html index e8e3113f..7c0f0f10 100644 --- a/test/coords_test.html +++ b/test/coords_test.html @@ -21,7 +21,10 @@ } }; - var svgroot = document.getElementById('svgroot'); + var root = document.getElementById('root'); + var svgroot = document.createElementNS(svgedit.NS.SVG, 'svg'); + svgroot.id = 'svgroot'; + root.appendChild(svgroot); var svg = document.createElementNS(svgedit.NS.SVG, 'svg'); svgroot.appendChild(svg); var elemId = 1; @@ -320,6 +323,33 @@ tearDown(); }); + test('Test remapElement(translate) for text', function() { + expect(2); + setUp(); + + var text = document.createElementNS(svgedit.NS.SVG, 'text'); + text.setAttribute('x', '50'); + text.setAttribute('y', '100'); + svg.appendChild(text); + + var attrs = { + x: '50', + y: '100' + } + + // Create a translate. + var m = svg.createSVGMatrix(); + m.a = 1; m.b = 0; + m.c = 0; m.d = 1; + m.e = 100; m.f = -50; + + svgedit.coords.remapElement(text, attrs, m); + + equals(text.getAttribute('x'), '150'); + equals(text.getAttribute('y'), '50'); + + tearDown(); + }); }); @@ -328,6 +358,6 @@

    - +