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() {
|
|
|
|
$real = MathRenderer::renderMath( "a+b", array(), MW_MATH_SOURCE );
|
2014-03-11 15:53:03 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
'<span class="tex" dir="ltr">$ a+b $</span>',
|
|
|
|
$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() {
|
|
|
|
$real = MathRenderer::renderMath( "a\n b", array(), MW_MATH_SOURCE );
|
2014-03-11 15:53:03 +00:00
|
|
|
$this->assertSame(
|
|
|
|
'<span class="tex" dir="ltr">$ a b $</span>',
|
|
|
|
$real,
|
|
|
|
"converting newlines to spaces"
|
|
|
|
);
|
2013-02-16 22:55:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|