From eca4351d1f0a168f00be861d92ed2b2375aad4f5 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Tue, 18 Mar 2014 13:00:11 -0400 Subject: [PATCH] Parser tests: Make Foobar.svg consistent. The parserTest.inc file created metadata saying that Foobar.svg was 240x180px, but created an empty SVG file; the DEFAULT_WIDTH and DEFAULT_HEIGHT in includes/media/SVGMetadataExtractor.php would have caused this to be treated as a 512x512px image. In NewParserTest.php, a 200x200px image was created for Foobar.svg. That caused inconsistent and confusing results for SVG-related parser tests, depending on which of the testing frameworks you used. Fixed both of these to use a consistent 240x180px image, since non-square images are better for checking correct scaling. (Parsoid has always used a 240x180px size for Foobar.svg). The non-square image has caused three parser test results to slightly change. Change-Id: Ib60a7412d9be808a0995e94d3aa373f2c5ca9bad --- tests/parser/parserTest.inc | 4 ++-- tests/parser/parserTests.txt | 6 +++--- tests/phpunit/includes/parser/NewParserTest.php | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 95b9d05d29..65296d53d4 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -1074,10 +1074,10 @@ class ParserTest { wfMkdirParents( $dir . '/0/09', null, __METHOD__ ); copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" ); wfMkdirParents( $dir . '/f/ff', null, __METHOD__ ); - copy( "$IP/skins/monobook/headbg.jpg", "$dir/f/ff/Foobar.svg" ); file_put_contents( "$dir/f/ff/Foobar.svg", '' . - '' ); + '' ); return $dir; } diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 9cea15637f..9808e5677a 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -10331,7 +10331,7 @@ SVG thumbnails with no language set !! wikitext [[File:Foobar.svg|thumb|caption]] !! html -
caption
+
caption
!! end @@ -10341,7 +10341,7 @@ SVG thumbnails with language de !! wikitext [[File:Foobar.svg|thumb|caption|lang=de]] !! html -
caption
+
caption
!! end @@ -10351,7 +10351,7 @@ SVG thumbnails with invalid language code !! wikitext [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]] !! html -
lang=invalid.language.code
+
lang=invalid.language.code
!! end diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php index c74244415d..f75b254c3a 100644 --- a/tests/phpunit/includes/parser/NewParserTest.php +++ b/tests/phpunit/includes/parser/NewParserTest.php @@ -263,8 +263,8 @@ class NewParserTest extends MediaWikiTestCase { if ( !$this->db->selectField( 'image', '1', array( 'img_name' => $image->getName() ) ) ) { $image->recordUpload2( '', 'Upload of some lame SVG', 'Some lame SVG', array( 'size' => 12345, - 'width' => 200, - 'height' => 200, + 'width' => 240, + 'height' => 180, 'bits' => 24, 'media_type' => MEDIATYPE_DRAWING, 'mime' => 'image/svg+xml', @@ -445,7 +445,8 @@ class NewParserTest extends MediaWikiTestCase { // No helpful SVG file to copy, so make one ourselves $data = '' . - 'Foo'; + ''; $backend->prepare( array( 'dir' => "$base/local-public/f/ff" ) ); $backend->quickCreate( array( -- 2.20.1