Mobrovac has submitted this change and it was merged.

Change subject: Resolve problems on SpecialPage:MathStatus
......................................................................


Resolve problems on SpecialPage:MathStatus

* Update reference SVG image
* Store image in file to simplify review

Bug: T113708
Change-Id: Ie727148dff7896bde1068f6efc643b430536991f
---
M SpecialMathStatus.php
A images/reference.svg
2 files changed, 20 insertions(+), 21 deletions(-)

Approvals:
  Mobrovac: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SpecialMathStatus.php b/SpecialMathStatus.php
index a40c4e9..0a139ee 100644
--- a/SpecialMathStatus.php
+++ b/SpecialMathStatus.php
@@ -76,24 +76,7 @@
         * i.e. if the span element is generated right.
         */
        public function testMathMLIntegration() {
-               // @codingStandardsIgnoreStart
-               $svgRef = '<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
-<svg xmlns:xlink="http://www.w3.org/1999/xlink"; style="vertical-align: 
-0.333ex; " width="5.167ex" height="1.833ex" viewBox="0 -717.9 2195.4 823.9" 
xmlns="http://www.w3.org/2000/svg"; role="math" 
aria-labelledby="MathJax-SVG-1-Title MathJax-SVG-1-Desc">
-<title id="MathJax-SVG-1-Title">Equation</title>
-<desc id="MathJax-SVG-1-Desc">a plus b</desc>
-<defs aria-hidden="true">
-<path stroke-width="10" id="E1-MJMATHI-61" d="M33 157Q33 258 109 349T280 
441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 
68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 
483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 
393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 
-10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 
374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 
254 59T298 110Q300 114 325 217T351 328Z"></path>
-<path stroke-width="10" id="E1-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 
570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 
-82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path>
-<path stroke-width="10" id="E1-MJMATHI-62" d="M73 647Q73 657 77 670T89 683Q90 
683 161 688T234 694Q246 694 246 685T212 542Q204 508 195 472T180 418L176 399Q176 
396 182 402Q231 442 283 442Q345 442 383 396T422 280Q422 169 343 79T173 -11Q123 
-11 82 27T40 150V159Q40 180 48 217T97 414Q147 611 147 623T109 637Q104 637 101 
637H96Q86 637 83 637T76 640T73 647ZM336 325V331Q336 405 275 405Q258 405 240 
397T207 376T181 352T163 330L157 322L136 236Q114 150 114 114Q114 66 138 42Q154 
26 178 26Q211 26 245 58Q270 81 285 114T318 219Q336 291 336 325Z"></path>
-</defs>
-<g stroke="currentColor" fill="currentColor" stroke-width="0" 
transform="matrix(1 0 0 -1 0 0)" aria-hidden="true">
- <use xlink:href="#E1-MJMATHI-61" x="0" y="0"></use>
- <use xlink:href="#E1-MJMAIN-2B" x="756" y="0"></use>
- <use xlink:href="#E1-MJMATHI-62" x="1761" y="0"></use>
-</g>
-</svg>';
-               // @codingStandardsIgnoreEnd
+               $svgRef = file_get_contents( __DIR__ .'/images/reference.svg' );
                $renderer = MathRenderer::getRenderer( "a+b", array(), 'mathml' 
);
                $this->assertTrue( $renderer->render( true ), "Rendering of a+b 
in plain MathML mode" );
                $real = str_replace( "\n", '', $renderer->getHtmlOutput() );
@@ -120,7 +103,7 @@
                $this->assertEquals( 'pmml', $renderer->getInputType(), 
'Checking if MathML input is supported' );
                $this->assertTrue( $renderer->render(), 'Rendering Presentation 
MathML sample' );
                $real = MathRenderer::renderMath( $inputSample, $attribs, 
'mathml' );
-               $expected = 'hash=5628b8248b79267ecac656102334d5e3&amp;mode=5';
+               $expected = 
'hash=5628b8248b79267ecac656102334d5e3&amp;mode=mathml';
                $this->assertContains( $expected, $real, 'Checking if the link 
to SVG image is correct' );
        }
 
@@ -132,7 +115,7 @@
                $renderer = MathRenderer::getRenderer( "a+b", array(), 
'latexml' );
                $this->assertTrue( $renderer->render( true ), "Rendering of a+b 
in LaTeXML mode" );
                // @codingStandardsIgnoreStart
-               $expected = '<math xmlns="http://www.w3.org/1998/Math/MathML"; 
id="p1.1.m1.1" class="ltx_Math" alttext="{\displaystyle a+b}" ><semantics 
id="p1.1.m1.1a"><mrow id="p1.1.m1.1.4" xref="p1.1.m1.1.4.cmml"><mi 
id="p1.1.m1.1.1" xref="p1.1.m1.1.1.cmml">a</mi><mo id="p1.1.m1.1.2" 
xref="p1.1.m1.1.2.cmml">+</mo><mi id="p1.1.m1.1.3" 
xref="p1.1.m1.1.3.cmml">b</mi></mrow><annotation-xml encoding="MathML-Content" 
id="p1.1.m1.1b"><apply id="p1.1.m1.1.4.cmml" xref="p1.1.m1.1.4"><plus 
id="p1.1.m1.1.2.cmml" xref="p1.1.m1.1.2"/><ci id="p1.1.m1.1.1.cmml" 
xref="p1.1.m1.1.1">a</ci><ci id="p1.1.m1.1.3.cmml" 
xref="p1.1.m1.1.3">b</ci></apply></annotation-xml><annotation 
encoding="application/x-tex" id="p1.1.m1.1c">{\displaystyle 
a+b}</annotation></semantics></math>';
+               $expected = '<math xmlns="http://www.w3.org/1998/Math/MathML"; 
id="p1.m1" class="ltx_Math" alttext="{\displaystyle a+b}" ><semantics><mrow 
id="p1.m1.4" xref="p1.m1.4.cmml"><mi id="p1.m1.1" xref="p1.m1.1.cmml">a</mi><mo 
id="p1.m1.2" xref="p1.m1.2.cmml">+</mo><mi id="p1.m1.3" 
xref="p1.m1.3.cmml">b</mi></mrow><annotation-xml 
encoding="MathML-Content"><apply id="p1.m1.4.cmml" xref="p1.m1.4"><plus 
id="p1.m1.2.cmml" xref="p1.m1.2"/><ci id="p1.m1.1.cmml" 
xref="p1.m1.1">a</ci><ci id="p1.m1.3.cmml" 
xref="p1.m1.3">b</ci></apply></annotation-xml><annotation 
encoding="application/x-tex">{\displaystyle 
a+b}</annotation></semantics></math>';
                // @codingStandardsIgnoreEnd
                $real = preg_replace( "/\n\\s*/", '', 
$renderer->getHtmlOutput() );
                $this->assertContains( $expected, $real,
@@ -178,7 +161,7 @@
        }
 
        private function assertEquals( $expected, $real, $message = '' ) {
-               if ( !$this->assertTrue( $expected == $real, $message ) ) {
+               if ( !$this->assertTrue( $expected === $real, $message ) ) {
                        $this->printDiff( $expected, $real, 
'math-test-equals-diff' );
                }
        }
diff --git a/images/reference.svg b/images/reference.svg
new file mode 100644
index 0000000..2b7291f
--- /dev/null
+++ b/images/reference.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+<svg xmlns:xlink="http://www.w3.org/1999/xlink"; style="vertical-align: 
-0.505ex;" width="5.099ex" height="2.343ex" viewBox="0 -791.3 2195.4 1008.6" 
xmlns="http://www.w3.org/2000/svg"; role="math" 
aria-labelledby="MathJax-SVG-1-Title MathJax-SVG-1-Desc">
+<title id="MathJax-SVG-1-Title">Equation</title>
+<desc id="MathJax-SVG-1-Desc">a plus b</desc>
+<defs aria-hidden="true">
+<path stroke-width="10" id="E1-MJMATHI-61" d="M33 157Q33 258 109 349T280 
441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 
68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 
483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 
393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 
-10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 
374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 
254 59T298 110Q300 114 325 217T351 328Z"></path>
+<path stroke-width="10" id="E1-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 
570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 
-82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path>
+<path stroke-width="10" id="E1-MJMATHI-62" d="M73 647Q73 657 77 670T89 683Q90 
683 161 688T234 694Q246 694 246 685T212 542Q204 508 195 472T180 418L176 399Q176 
396 182 402Q231 442 283 442Q345 442 383 396T422 280Q422 169 343 79T173 -11Q123 
-11 82 27T40 150V159Q40 180 48 217T97 414Q147 611 147 623T109 637Q104 637 101 
637H96Q86 637 83 637T76 640T73 647ZM336 325V331Q336 405 275 405Q258 405 240 
397T207 376T181 352T163 330L157 322L136 236Q114 150 114 114Q114 66 138 42Q154 
26 178 26Q211 26 245 58Q270 81 285 114T318 219Q336 291 336 325Z"></path>
+</defs>
+<g stroke="currentColor" fill="currentColor" stroke-width="0" 
transform="matrix(1 0 0 -1 0 0)" aria-hidden="true">
+ <use xlink:href="#E1-MJMATHI-61" x="0" y="0"></use>
+ <use xlink:href="#E1-MJMAIN-2B" x="756" y="0"></use>
+ <use xlink:href="#E1-MJMATHI-62" x="1761" y="0"></use>
+</g>
+</svg>
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/250839
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie727148dff7896bde1068f6efc643b430536991f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
Gerrit-Reviewer: Physikerwelt <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to