2013-02-16 22:55:39 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Test the TeX source output format.
|
|
|
|
* @group Math
|
|
|
|
*/
|
|
|
|
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() {
|
2015-07-22 22:10:46 +00:00
|
|
|
$real = MathRenderer::renderMath( "a+b", array(), '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() {
|
2015-07-22 22:10:46 +00:00
|
|
|
$real = MathRenderer::renderMath( "a\n b", array(), '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
|
|
|
}
|