*/
private $dbClone;
+ /**
+ * @var DjVuSupport
+ */
+ private $djVuSupport;
+
/**
* @var string $oldTablePrefix Original table prefix
*/
$this->runDisabled = isset( $options['run-disabled'] );
$this->runParsoid = isset( $options['run-parsoid'] );
+ $this->djVuSupport = new DjVuSupport();
+
$this->hooks = array();
$this->functionHooks = array();
self::setUp();
foreach ( $filenames as $filename ) {
$contents = file_get_contents( $filename );
- preg_match_all( '/!!\s*(input|wikitext)\n(.*?)\n!!\s*(result|html|html\/\*|html\/php)/s', $contents, $matches );
+ preg_match_all(
+ '/!!\s*(input|wikitext)\n(.*?)\n!!\s*(result|html|html\/\*|html\/php)/s',
+ $contents,
+ $matches
+ );
foreach ( $matches[1] as $match ) {
$dict .= $match . "\n";
$user = $context->getUser();
$options = ParserOptions::newFromContext( $context );
+ if ( isset( $opts['djvu'] ) ) {
+ if ( !$this->djVuSupport->isEnabled() ) {
+ return $this->showSkipped();
+ }
+ }
+
if ( isset( $opts['title'] ) ) {
$titleText = $opts['title'];
} else {
$settings = array(
'wgServer' => 'http://example.org',
+ 'wgServerName' => 'example.org',
'wgScript' => '/index.php',
'wgScriptPath' => '/',
'wgArticlePath' => '/wiki/$1',
'size' => 12345,
'width' => 240,
'height' => 180,
- 'bits' => 24,
+ 'bits' => 0,
'media_type' => MEDIATYPE_DRAWING,
'mime' => 'image/svg+xml',
'metadata' => serialize( array() ),
'sha1' => wfBaseConvert( '3', 16, 36, 31 ),
'fileExists' => true
), $this->db->timestamp( '20010115123500' ), $user );
+
+ # A DjVu file
+ $image = wfLocalFile( Title::makeTitle( NS_FILE, 'LoremIpsum.djvu' ) );
+ $image->recordUpload2( '', 'Upload a DjVu', 'A DjVu', array(
+ 'size' => 3249,
+ 'width' => 2480,
+ 'height' => 3508,
+ 'bits' => 0,
+ 'media_type' => MEDIATYPE_BITMAP,
+ 'mime' => 'image/vnd.djvu',
+ 'metadata' => '<?xml version="1.0" ?>
+<!DOCTYPE DjVuXML PUBLIC "-//W3C//DTD DjVuXML 1.1//EN" "pubtext/DjVuXML-s.dtd">
+<DjVuXML>
+<HEAD></HEAD>
+<BODY><OBJECT height="3508" width="2480">
+<PARAM name="DPI" value="300" />
+<PARAM name="GAMMA" value="2.2" />
+</OBJECT>
+<OBJECT height="3508" width="2480">
+<PARAM name="DPI" value="300" />
+<PARAM name="GAMMA" value="2.2" />
+</OBJECT>
+<OBJECT height="3508" width="2480">
+<PARAM name="DPI" value="300" />
+<PARAM name="GAMMA" value="2.2" />
+</OBJECT>
+<OBJECT height="3508" width="2480">
+<PARAM name="DPI" value="300" />
+<PARAM name="GAMMA" value="2.2" />
+</OBJECT>
+<OBJECT height="3508" width="2480">
+<PARAM name="DPI" value="300" />
+<PARAM name="GAMMA" value="2.2" />
+</OBJECT>
+</BODY>
+</DjVuXML>',
+ 'sha1' => wfBaseConvert( '', 16, 36, 31 ),
+ 'fileExists' => true
+ ), $this->db->timestamp( '20010115123600' ), $user );
}
public function teardownDatabase() {
}
wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
- copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
+ copy( "$IP/tests/phpunit/data/parser/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
wfMkdirParents( $dir . '/e/ea', null, __METHOD__ );
- copy( "$IP/skins/monobook/wiki.png", "$dir/e/ea/Thumb.png" );
+ copy( "$IP/tests/phpunit/data/parser/wiki.png", "$dir/e/ea/Thumb.png" );
wfMkdirParents( $dir . '/0/09', null, __METHOD__ );
- copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
+ copy( "$IP/tests/phpunit/data/parser/headbg.jpg", "$dir/0/09/Bad.jpg" );
wfMkdirParents( $dir . '/f/ff', null, __METHOD__ );
file_put_contents( "$dir/f/ff/Foobar.svg",
'<?xml version="1.0" encoding="utf-8"?>' .
'<svg xmlns="http://www.w3.org/2000/svg"' .
' version="1.1" width="240" height="180"/>' );
+ wfMkdirParents( $dir . '/5/5f', null, __METHOD__ );
+ copy( "$IP/tests/phpunit/data/parser/LoremIpsum.djvu", "$dir/5/5f/LoremIpsum.djvu" );
+
return $dir;
}
"$dir/0/09/Bad.jpg",
+ "$dir/5/5f/LoremIpsum.djvu",
+ "$dir/thumb/5/5f/LoremIpsum.djvu/page2-2480px-LoremIpsum.djvu.jpg",
+ "$dir/thumb/5/5f/LoremIpsum.djvu/page2-3720px-LoremIpsum.djvu.jpg",
+ "$dir/thumb/5/5f/LoremIpsum.djvu/page2-4960px-LoremIpsum.djvu.jpg",
+
"$dir/f/ff/Foobar.svg",
"$dir/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png",
"$dir/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png",
"$dir/thumb/f/",
"$dir/0/09/",
"$dir/0/",
+ "$dir/5/5f",
+ "$dir/5",
+ "$dir/thumb/5/5f/LoremIpsum.djvu",
+ "$dir/thumb/5/5f",
+ "$dir/thumb/5",
"$dir/thumb",
"$dir/math/f/a/5",
"$dir/math/f/a",
return false;
}
+ /**
+ * Print a skipped message.
+ *
+ * @return boolean
+ */
+ protected function showSkipped() {
+ if ( $this->showProgress ) {
+ print $this->term->color( '1;33' ) . 'SKIPPED' . $this->term->reset() . "\n";
+ }
+
+ return true;
+ }
+
/**
* Run given strings through a diff and return the (colorized) output.
* Requires writable /tmp directory and a 'diff' command in the PATH.