2013-02-16 22:55:39 +00:00
|
|
|
<?php
|
2016-02-12 16:57:37 +00:00
|
|
|
|
2013-02-16 22:55:39 +00:00
|
|
|
/**
|
|
|
|
* Test the TeX source output format.
|
2016-02-12 16:57:37 +00:00
|
|
|
*
|
|
|
|
* @covers MathRenderer
|
|
|
|
*
|
2013-02-16 22:55:39 +00:00
|
|
|
* @group Math
|
2016-02-12 16:57:37 +00:00
|
|
|
*
|
2018-04-13 14:06:39 +00:00
|
|
|
* @license GPL-2.0-or-later
|
2013-02-16 22:55:39 +00:00
|
|
|
*/
|
|
|
|
class MathSourceTest extends MediaWikiTestCase {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks the basic functionallity
|
|
|
|
* i.e. if the span element is generated right.
|
|
|
|
*/
|
2014-02-09 19:02:15 +00:00
|
|
|
public function testBasics() {
|
2016-04-12 20:53:25 +00:00
|
|
|
$real = MathRenderer::renderMath( "a+b", [], 'source' );
|
2014-03-11 15:53:03 +00:00
|
|
|
$this->assertEquals(
|
2014-03-17 06:14:02 +00:00
|
|
|
'<span class="mwe-math-fallback-source-inline tex" dir="ltr">$ a+b $</span>',
|
2014-03-11 15:53:03 +00:00
|
|
|
$real,
|
|
|
|
"Rendering of a+b in plain Text mode"
|
|
|
|
);
|
2013-02-16 22:55:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if newlines are converted to spaces correctly.
|
|
|
|
*/
|
2014-02-09 19:02:15 +00:00
|
|
|
public function testNewLines() {
|
2016-04-12 20:53:25 +00:00
|
|
|
$real = MathRenderer::renderMath( "a\n b", [], 'source' );
|
2014-03-11 15:53:03 +00:00
|
|
|
$this->assertSame(
|
2014-03-17 06:14:02 +00:00
|
|
|
'<span class="mwe-math-fallback-source-inline tex" dir="ltr">$ a b $</span>',
|
2014-03-11 15:53:03 +00:00
|
|
|
$real,
|
|
|
|
"converting newlines to spaces"
|
|
|
|
);
|
2013-02-16 22:55:39 +00:00
|
|
|
}
|
|
|
|
|
2015-01-10 01:55:54 +00:00
|
|
|
}
|