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(
|
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() {
|
|
|
|
$real = MathRenderer::renderMath( "a\n b", array(), MW_MATH_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
|
|
|
}
|