Jarry1250 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/213801
Change subject: Add test for hasTextContent
......................................................................
Add test for hasTextContent
Change-Id: I0a61984f95934aa4a2d78300ee33a50fc60d8a4d
---
M tests/phpunit/SVGFileTest.php
1 file changed, 19 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslateSvg
refs/changes/01/213801/1
diff --git a/tests/phpunit/SVGFileTest.php b/tests/phpunit/SVGFileTest.php
index 6b8fa58..72c7a9f 100644
--- a/tests/phpunit/SVGFileTest.php
+++ b/tests/phpunit/SVGFileTest.php
@@ -454,6 +454,25 @@
$this->assertArrayEquals( array( 'started' => array(),
'expanded' => array() ), $ret );
}
+ public function hasTextContent() {
+ $document = new DOMDocument( '1.0' );
+ $node = $document->createElement( 'text' );
+ $this->assertFalse( SVGFile::hasActualTextContent( $node ) );
+ $node->appendChild( $document->createElement( 'tspan' ) );
+ $this->assertFalse( SVGFile::hasActualTextContent( $node ) );
+
+ //Trailing whitespace shouldn't count
+ $node->appendChild( $document->createTextNode( ' ' ) );
+ $this->assertFalse( SVGFile::hasActualTextContent( $node ) );
+
+ $node2 = $node->cloneNode( true );
+ $node2->appendChild( $document->createTextNode( 'foo' ) );
+ $this->assertTrue( SVGFile::hasActualTextContent( $node2 ) );
+
+ $node->childNodes->item(0)->appendChild(
$document->createTextNode( 'foo' ) );
+ $this->assertTrue( SVGFile::hasActualTextContent( $node ) );
+ }
+
public function testSaveToString() {
// Check that we are not actually destroying the XML file
$this->assertGreaterThan( 1500, strlen(
$this->svg->saveToString() ) );
--
To view, visit https://gerrit.wikimedia.org/r/213801
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a61984f95934aa4a2d78300ee33a50fc60d8a4d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslateSvg
Gerrit-Branch: master
Gerrit-Owner: Jarry1250 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits