[MediaWiki-commits] [Gerrit] Add extra parser tests for SVGMessageGroup and SVGFile classes - change (mediawiki...TranslateSvg)
Jarry1250 has submitted this change and it was merged. Change subject: Add extra parser tests for SVGMessageGroup and SVGFile classes .. Add extra parser tests for SVGMessageGroup and SVGFile classes Change-Id: Ibc0a4c37afbaa82d296d5bd964e12c119e7e1b87 --- M tests/phpunit/SVGFileTest.php M tests/phpunit/SVGMessageGroupTest.php 2 files changed, 157 insertions(+), 0 deletions(-) Approvals: Jarry1250: Verified; Looks good to me, approved diff --git a/tests/phpunit/SVGFileTest.php b/tests/phpunit/SVGFileTest.php index ec83b0c..5843f77 100644 --- a/tests/phpunit/SVGFileTest.php +++ b/tests/phpunit/SVGFileTest.php @@ -294,4 +294,145 @@ $this-assertEquals( $expected, $this-svg-getSavedLanguagesFiltered() ); } + public function testGetFilteredTextNodes() { + + // The important things here are: + // * array length. One of the three sets has non-zero text content, so should not be filtered + // * text. Since they are filtered, all should contain nothing but $ references. + // * data-children. Each should have as many children as there are $ references. + + $expected = array( + 'text2985' = + array( + 'de' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985-de', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + 'fr' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985-fr', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + 'nl' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985-nl', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + 'tlh-ca' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985-nl', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + 'fallback' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + ), + 'text2989' = + array( +
[MediaWiki-commits] [Gerrit] Add extra parser tests for SVGMessageGroup and SVGFile classes - change (mediawiki...TranslateSvg)
Jarry1250 has uploaded a new change for review. https://gerrit.wikimedia.org/r/156134 Change subject: Add extra parser tests for SVGMessageGroup and SVGFile classes .. Add extra parser tests for SVGMessageGroup and SVGFile classes Change-Id: Ibc0a4c37afbaa82d296d5bd964e12c119e7e1b87 --- M tests/phpunit/SVGFileTest.php M tests/phpunit/SVGMessageGroupTest.php 2 files changed, 157 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslateSvg refs/changes/34/156134/1 diff --git a/tests/phpunit/SVGFileTest.php b/tests/phpunit/SVGFileTest.php index ec83b0c..5843f77 100644 --- a/tests/phpunit/SVGFileTest.php +++ b/tests/phpunit/SVGFileTest.php @@ -294,4 +294,145 @@ $this-assertEquals( $expected, $this-svg-getSavedLanguagesFiltered() ); } + public function testGetFilteredTextNodes() { + + // The important things here are: + // * array length. One of the three sets has non-zero text content, so should not be filtered + // * text. Since they are filtered, all should contain nothing but $ references. + // * data-children. Each should have as many children as there are $ references. + + $expected = array( + 'text2985' = + array( + 'de' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985-de', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + 'fr' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985-fr', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + 'nl' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985-nl', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + 'tlh-ca' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985-nl', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + 'fallback' = + array( + 'text' = '$1', + 'xml:space' = 'preserve', + 'x' = '90', + 'y' = '108.07646', + 'id' = 'text2985', + 'sodipodi:linespacing' = '125%', + 'data-children' = 'tspan2987', + ), + ), +