r62021 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62020‎ | r62021 | r62022 >
Date:13:14, 5 February 2010
Author:mglaser
Status:deferred
Tags:
Comment:
unit and selenium tests for PagedTiffHandler
Modified paths:
  • /trunk/extensions/PagedTiffHandler/selenium (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium/testImages (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium/testImages/SOURCES.txt (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium/testImages/caspian.tif (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium/testImages/multipage.tiff (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/RunSeleniumTests.php (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/Selenium.php (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestCase.php (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestConsoleLogger.php (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestHTMLLogger.php (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestListener.php (added) (history)
  • /trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestSuite.php (added) (history)
  • /trunk/extensions/PagedTiffHandler/tests (added) (history)
  • /trunk/extensions/PagedTiffHandler/tests/PagedTiffHandlerTest.php (added) (history)
  • /trunk/extensions/PagedTiffHandler/tests/testImages (added) (history)
  • /trunk/extensions/PagedTiffHandler/tests/testImages/SOURCES.txt (added) (history)
  • /trunk/extensions/PagedTiffHandler/tests/testImages/caspian.tif (added) (history)
  • /trunk/extensions/PagedTiffHandler/tests/testImages/multipage.tiff (added) (history)

Diff [purge]

Index: trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php
@@ -0,0 +1,378 @@
 2+<?php
 3+/** To get this working you must
 4+* - set a valid path to PEAR
 5+* - Either upload multipage.tiff when PagedTiffHandler is active or set $wgSeleniumTiffTestUploads = true
 6+* - set the locale to german
 7+*/
 8+
 9+
 10+if (!defined('MEDIAWIKI') || !defined('SELENIUMTEST')) {
 11+ echo "This script cannot be run standalone";
 12+ exit(1);
 13+}
 14+
 15+$wgSeleniumTiffTestUploads = false;
 16+
 17+class SeleniumUploadTiffTest extends SeleniumTestCase
 18+{
 19+ public function uploadFile($filename)
 20+ {
 21+ global $wgUITestsWikiUrl;
 22+ $this->open($wgUITestsWikiUrl.'/index.php?title=Special:Upload');
 23+ $this->type("wpUploadFile", dirname(__FILE__)."\\testImages\\".$filename);
 24+ $this->check("wpIgnoreWarning");
 25+ $this->click("wpUpload");
 26+ $this->waitForPageToLoad(30000);
 27+ }
 28+
 29+ public function assertUploaded($filename)
 30+ {
 31+ $this->assertSeleniumHTMLContains('//h1[@class="firstHeading"]', ucfirst($filename));
 32+ }
 33+
 34+ public function assertErrorMsg($msg)
 35+ {
 36+ $this->assertSeleniumHTMLContains('//div[@id="bodyContent"]//span[@class="error"]', $msg);
 37+ }
 38+
 39+}
 40+
 41+class SeleniumUploadWorkingTiffTest extends SeleniumUploadTiffTest
 42+{
 43+ public $name = "Upload working Tiff: ";
 44+ private $filename;
 45+
 46+ public function __construct($filename)
 47+ {
 48+ parent::__construct();
 49+ $this->filename = $filename;
 50+ $this->name .= $filename;
 51+ }
 52+
 53+ public function runTest()
 54+ {
 55+ $this->uploadFile($this->filename);
 56+ $this->assertUploaded(str_replace("_", " ", $this->filename));
 57+ }
 58+}
 59+
 60+class SeleniumUploadBrokenTiffTest extends SeleniumUploadTiffTest
 61+{
 62+ public $name = "Upload broken Tiff: ";
 63+ private $filename;
 64+ private $errorMsg;
 65+
 66+ public function __construct($filename, $errorMsg)
 67+ {
 68+ parent::__construct();
 69+ $this->filename = $filename;
 70+ $this->name .= $filename;
 71+ $this->errorMsg = $errorMsg;
 72+ }
 73+
 74+ public function runTest()
 75+ {
 76+ $this->uploadFile($this->filename);
 77+ $this->assertErrorMsg($this->errorMsg);
 78+ }
 79+}
 80+
 81+class SeleniumDeleteTiffTest extends SeleniumTestCase
 82+{
 83+ public $name = "Delete Tiff: ";
 84+ private $filename;
 85+
 86+ public function __construct($filename)
 87+ {
 88+ parent::__construct();
 89+ $this->filename = $filename;
 90+ $this->name .= $filename;
 91+ }
 92+ public function runTest()
 93+ {
 94+ global $wgUITestsWikiUrl;
 95+ $this->open($wgUITestsWikiUrl.'/index.php?title=Image:'.ucfirst($this->filename).'&action=delete');
 96+ $this->type("wpReason", "Remove test file");
 97+ $this->click("mw-filedelete-submit");
 98+ $this->waitForPageToLoad(10000);
 99+
 100+ // Todo: This message is localized
 101+ $this->assertSeleniumHTMLContains('//div[@id="bodyContent"]/p', ucfirst($this->filename).'.*wurde gelöscht.');
 102+
 103+
 104+ }
 105+}
 106+
 107+class SeleniumEmbedTiffTest extends SeleniumTestCase //PHPUnit_Extensions_SeleniumTestCase
 108+{
 109+
 110+ public function tearDown()
 111+ {
 112+ global $wgUITestsWikiUrl;
 113+ parent::tearDown();
 114+ //Clear EmbedTiffTest page for future tests
 115+ $this->open($wgUITestsWikiUrl.'/index.php?title=EmbedTiffTest&action=edit');
 116+ $this->type("wpTextbox1", "");
 117+ $this->click("wpSave");
 118+ }
 119+
 120+ public function preparePage($text)
 121+ {
 122+ global $wgUITestsWikiUrl;
 123+ $this->open($wgUITestsWikiUrl.'/index.php?title=EmbedTiffTest&action=edit');
 124+ $this->type("wpTextbox1", $text);
 125+ $this->click("wpSave");
 126+ $this->waitForPageToLoad(10000);
 127+ }
 128+
 129+}
 130+
 131+class SeleniumTiffPageTest extends SeleniumTestCase
 132+{
 133+ public function tearDown()
 134+ {
 135+ parent::tearDown();
 136+ //Clear EmbedTiffTest page for future tests
 137+ $this->open($wgUITestsWikiUrl.'/index.php?title=Image:'.$this->image.'&action=edit');
 138+ $this->type("wpTextbox1", "");
 139+ $this->click("wpSave");
 140+ }
 141+
 142+ public function prepareImagePage($image, $text)
 143+ {
 144+ global $wgUITestsWikiUrl;
 145+ $this->image = $image;
 146+ $this->open($wgUITestsWikiUrl.'/index.php?title=Image:'.$image.'&action=edit');
 147+ $this->type("wpTextbox1", $text);
 148+ $this->click("wpSave");
 149+ $this->waitForPageToLoad(10000);
 150+
 151+ }
 152+}
 153+
 154+class SeleniumDisplayInCategoryTest extends SeleniumTiffPageTest
 155+{
 156+ public $name = "Display in category";
 157+
 158+ public function runTest()
 159+ {
 160+ $this->prepareImagePage("Multipage.tiff","[[Category:Wiki]]\n");
 161+
 162+ global $wgUITestsWikiUrl;
 163+ $this->open($wgUITestsWikiUrl.'/index.php?title=Category:Wiki');
 164+
 165+ //Ergebnis chekcen
 166+ $source = $this->getAttribute("//div[@class='gallerybox']//a[@class='image']//img@src");
 167+ $correct = strstr($source, "/page1-");
 168+ $this->assertEquals($correct, true);
 169+
 170+ }
 171+}
 172+
 173+class SeleniumDisplayInGalleryTest extends SeleniumEmbedTiffTest
 174+{
 175+ public $name = "Display in gallery";
 176+
 177+ public function runTest()
 178+ {
 179+ $this->preparePage("<gallery>\nImage:Multipage.tiff\n</gallery>\n");
 180+
 181+ //global $wgUITestsWikiUrl;
 182+ //$this->open($wgUITestsWikiUrl.'/index.php?title=GalleryTest');
 183+
 184+ //Ergebnis chekcen
 185+ //$source = $this->getAttribute("//div[@class='gallerybox']//a[@title='Multipage.tiff']//img@src");
 186+ $source = $this->getAttribute("//div[@class='gallerybox']//a[@class='image']//img@src");
 187+ $correct = strstr($source, "/page1-");
 188+ $this->assertEquals($correct, true);
 189+
 190+ }
 191+}
 192+
 193+class SeleniumEmbedTiffInclusionTest extends SeleniumEmbedTiffTest
 194+{
 195+ public $name = "Include Tiff Images";
 196+
 197+ public function runTest()
 198+ {
 199+ $this->preparePage("[[Image:Pc260001.tif]]\n");
 200+
 201+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "480");
 202+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "640");
 203+ }
 204+}
 205+
 206+class SeleniumEmbedTiffThumbRatioTest extends SeleniumEmbedTiffTest
 207+{
 208+ public $name = "Include Tiff Thumbnail Aspect Ratio";
 209+
 210+ public function runTest()
 211+ {
 212+ $this->preparePage("[[Image:Pc260001.tif|200px]]\n");
 213+ //$this->selenium->type("wpTextbox1", "[[Image:Pc260001.tif|thumb]]\n");
 214+
 215+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "150");
 216+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "200");
 217+ }
 218+}
 219+
 220+class SeleniumEmbedTiffBoxFitTest extends SeleniumEmbedTiffTest
 221+{
 222+ public $name = "Include Tiff Box Fit";
 223+
 224+ public function runTest()
 225+ {
 226+ $this->preparePage("[[Image:Pc260001.tif|200x75px]]\n");
 227+
 228+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "75");
 229+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "100");
 230+ }
 231+}
 232+
 233+
 234+class SeleniumEmbedTiffPage2InclusionTest extends SeleniumEmbedTiffTest
 235+{
 236+ public $name = "Include Tiff Images: Page 2";
 237+
 238+ public function runTest()
 239+ {
 240+ $this->preparePage("[[Image:Multipage.tiff|page=2]]\n");
 241+ //$this->selenium->type("wpTextbox1", "[[Image:Pc260001.tif|thumb]]\n");
 242+
 243+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "564");
 244+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "640");
 245+ }
 246+}
 247+
 248+class SeleniumEmbedTiffPage2ThumbRatioTest extends SeleniumEmbedTiffTest
 249+{
 250+ public $name = "Include Tiff Thumbnail Aspect Ratio: Page 2";
 251+
 252+ public function runTest()
 253+ {
 254+ $this->preparePage("[[Image:Multipage.tiff|320px|page=2]]\n");
 255+
 256+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "282");
 257+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "320");
 258+ }
 259+}
 260+
 261+class SeleniumEmbedTiffPage2BoxFitTest extends SeleniumEmbedTiffTest
 262+{
 263+ public $name = "Include Tiff Box Fit: Page 2";
 264+
 265+ public function runTest()
 266+ {
 267+ $this->preparePage("[[Image:Multipage.tiff|200x108px|page=2]]\n");
 268+
 269+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "108");
 270+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "123");
 271+ }
 272+}
 273+
 274+class SeleniumEmbedTiffNegativePageParameterTest extends SeleniumEmbedTiffTest
 275+{
 276+ public $name = "Include Tiff: negative page parameter";
 277+
 278+ public function runTest()
 279+ {
 280+ $this->preparePage("[[Image:Multipage.tiff|page=-1]]\n");
 281+
 282+ $source = $this->getAttribute("//div[@id='bodyContent']//img@src");
 283+ $correct = strstr($source, "/page1-");
 284+ $this->assertEquals($correct, true);
 285+ }
 286+}
 287+
 288+class SeleniumEmbedTiffPageParameterTooHighTest extends SeleniumEmbedTiffTest
 289+{
 290+ public $name = "Include Tiff: too high page parameter";
 291+
 292+ public function runTest()
 293+ {
 294+ $this->preparePage("[[Image:Multipage.tiff|page=8]]\n");
 295+
 296+ $source = $this->getAttribute("//div[@id='bodyContent']//img@src");
 297+ $correct = strstr($source, "/page7-");
 298+ $this->assertEquals($correct, true);
 299+ }
 300+}
 301+
 302+// actually run tests
 303+// create test suite
 304+$wgSeleniumTestSuites['PagedTiffHandler'] = new SeleniumTestSuite('Paged TIFF Images');
 305+// add tests
 306+if ($wgSeleniumTiffTestUploads)
 307+{
 308+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("caspian.tif", 'Die hochgeladene Datei ist fehlerhaft.'));
 309+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("cramps.tif"));
 310+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("cramps-tile.tif"));
 311+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("dscf0013.tif"));
 312+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("fax2d.tif"));
 313+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("g3test.tif"));
 314+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("Jello.tif"));
 315+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("jim___ah.tif", 'Die errechnete Größe der Datei stimmt nicht mit der tatsächlichen überein.'));
 316+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("jim___cg.tif"));
 317+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("jim___dg.tif", 'Die errechnete Größe der Datei stimmt nicht mit der tatsächlichen überein.'));
 318+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("jim___gg.tif", 'Die errechnete Größe der Datei stimmt nicht mit der tatsächlichen überein.'));
 319+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("ladoga.tif"));
 320+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("off_l16.tif"));
 321+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("off_luv24.tif"));
 322+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("off_luv24.tif"));
 323+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("oxford.tif"));
 324+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("pc260001.tif"));
 325+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("quad-jpeg.tif", 'Die hochgeladene Datei konnte nicht verarbeitet werden. ImageMagick ist nicht verfügbar.'));
 326+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("quad-lzw.tif"));
 327+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("quad-tile.tif"));
 328+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("smallliz.tif", 'Die hochgeladene Datei konnte nicht verarbeitet werden. ImageMagick ist nicht verfügbar.'));
 329+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("strike.tif"));
 330+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("text.tif", 'Die hochgeladene Datei ist fehlerhaft.'));
 331+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("ycbcr-cat.tif"));
 332+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("zackthecat.tif", 'Die hochgeladene Datei konnte nicht verarbeitet werden. ImageMagick ist nicht verfügbar.'));
 333+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("multipage.tiff"));
 334+}
 335+//$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadWorkingTiffTest("multipage.tiff"));
 336+
 337+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumEmbedTiffInclusionTest());
 338+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumEmbedTiffThumbRatioTest());
 339+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumEmbedTiffBoxFitTest());
 340+
 341+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumEmbedTiffPage2InclusionTest());
 342+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumEmbedTiffPage2ThumbRatioTest());
 343+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumEmbedTiffPage2BoxFitTest());
 344+
 345+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumEmbedTiffNegativePageParameterTest());
 346+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumEmbedTiffPageParameterTooHighTest());
 347+
 348+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDisplayInCategoryTest());
 349+$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDisplayInGalleryTest());
 350+
 351+if ($wgSeleniumTiffTestUploads)
 352+{
 353+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("cramps.tif"));
 354+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("cramps-tile.tif"));
 355+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("dscf0013.tif"));
 356+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("fax2d.tif"));
 357+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("g3test.tif"));
 358+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("Jello.tif"));
 359+ //$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("jim___ah.tif"));
 360+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("jim___cg.tif"));
 361+ //$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("jim___dg.tif"));
 362+ //$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("jim___gg.tif"));
 363+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("ladoga.tif"));
 364+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("off_l16.tif"));
 365+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("off_luv24.tif"));
 366+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("off_luv24.tif"));
 367+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("oxford.tif"));
 368+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("pc260001.tif"));
 369+ //$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("quad-jpeg.tif"));
 370+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("quad-lzw.tif"));
 371+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("quad-tile.tif"));
 372+ //$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("smallliz.tif"));
 373+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("strike.tif"));
 374+ //$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("text.tif"));
 375+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("ycbcr-cat.tif"));
 376+ //$wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("zackthecat.tif"));
 377+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumDeleteTiffTest("multipage.tiff"));
 378+}
 379+
Property changes on: trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php
___________________________________________________________________
Name: svn:keywords
1380 + LastChangedDate LastChangedBy Revision Id
Index: trunk/extensions/PagedTiffHandler/selenium/testImages/caspian.tif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/PagedTiffHandler/selenium/testImages/caspian.tif
___________________________________________________________________
Name: svn:mime-type
2381 + application/octet-stream
Index: trunk/extensions/PagedTiffHandler/selenium/testImages/SOURCES.txt
@@ -0,0 +1,20 @@
 2+multipage.tiff created by ImageMagick 6.5.0-0 2009-03-09 Q16 OpenMP http://www.imagemagick.org
 3+Command: convert.exe * -adjoin multipage.tiff
 4+
 5+Bridge.jpg http://commons.wikimedia.org/wiki/File:Regensburg_Steinerne_Bruecke.jpg
 6+Caffeine.png http://commons.wikimedia.org/wiki/File:Caffeine-3D-vdW.png
 7+Mars.jpg http://commons.wikimedia.org/wiki/File:MarsTopoMap-PIA02031_modest_cropped_monochrome.jpg
 8+
 9+Pogona.jpg To the extent possible under law, Marc Reymann has waived all copyright
 10+Snake1.jpg and related or neighboring rights to these four pictures.
 11+Snake2.jpg This work is published from Germany.
 12+Venice.jpg
 13+
 14+----------
 15+
 16+caspian.tif taken from libtiff test images. Obviously they are under no license. you can obtain the
 17+ whole set of test images from http://www.libtiff.org/images.html
 18+
 19+----------
 20+
 21+For upload tests pls. get the whole set of test images from http://www.libtiff.org/images.html and copy the images into this directory.
\ No newline at end of file
Index: trunk/extensions/PagedTiffHandler/selenium/testImages/multipage.tiff
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/PagedTiffHandler/selenium/testImages/multipage.tiff
___________________________________________________________________
Name: svn:mime-type
122 + application/octet-stream
Index: trunk/extensions/PagedTiffHandler/tests/testImages/caspian.tif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/PagedTiffHandler/tests/testImages/caspian.tif
___________________________________________________________________
Name: svn:mime-type
223 + application/octet-stream
Index: trunk/extensions/PagedTiffHandler/tests/testImages/SOURCES.txt
@@ -0,0 +1,16 @@
 2+multipage.tiff created by ImageMagick 6.5.0-0 2009-03-09 Q16 OpenMP http://www.imagemagick.org
 3+Command: convert.exe * -adjoin multipage.tiff
 4+
 5+Bridge.jpg http://commons.wikimedia.org/wiki/File:Regensburg_Steinerne_Bruecke.jpg
 6+Caffeine.png http://commons.wikimedia.org/wiki/File:Caffeine-3D-vdW.png
 7+Mars.jpg http://commons.wikimedia.org/wiki/File:MarsTopoMap-PIA02031_modest_cropped_monochrome.jpg
 8+
 9+Pogona.jpg To the extent possible under law, Marc Reymann has waived all copyright
 10+Snake1.jpg and related or neighboring rights to these four pictures.
 11+Snake2.jpg This work is published from Germany.
 12+Venice.jpg
 13+
 14+----------
 15+
 16+caspian.tif taken from libtiff test images. Obviously they are under no license. you can obtain the
 17+ whole set of test images from http://www.libtiff.org/images.html
\ No newline at end of file
Index: trunk/extensions/PagedTiffHandler/tests/testImages/multipage.tiff
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/PagedTiffHandler/tests/testImages/multipage.tiff
___________________________________________________________________
Name: svn:mime-type
118 + application/octet-stream
Index: trunk/extensions/PagedTiffHandler/tests/PagedTiffHandlerTest.php
@@ -0,0 +1,124 @@
 2+<?php
 3+/** To get this working you must
 4+* - set a valid path to PEAR
 5+* - Upload the image Caspian.tif without PagedTiffHandler being active
 6+* - Upload multipage.tiff when PagedTiffHandler is active
 7+*/
 8+
 9+require_once( dirname(__FILE__) . '/../../../maintenance/commandLine.inc' );
 10+ini_set( 'include_path', get_include_path() . PATH_SEPARATOR . /*$_SERVER['PHP_PEAR_INSTALL_DIR']*/ 'C:\php\pear' );
 11+// requires PHPUnit 3.4
 12+require_once 'PHPUnit/Framework.php';
 13+
 14+
 15+class PagedTiffHandlerTest extends PHPUnit_Framework_TestCase {
 16+
 17+ private $handler;
 18+ private $image;
 19+
 20+ function setUp()
 21+ {
 22+ $this->handler = new PagedTiffHandler();
 23+ $this->image = wfFindFile(Title::newFromText('Image:Multipage.tiff'));
 24+ if (!$this->image)
 25+ {
 26+ echo "Please upload the image testImages/multipage.tiff into the wiki\n";
 27+ $this->preCheckError = true;
 28+ }
 29+ if (!file_exists(dirname(__FILE__) . '/testImages/caspian.tif'))
 30+ {
 31+ echo "testImages/caspian.tif cannot be found.\n";
 32+ $this->preCheckError = true;
 33+ }
 34+ if (!file_exists(dirname(__FILE__) . '/testImages/multipage.tiff'))
 35+ {
 36+ echo "testImages/Multitest_2.tif cannot be found.\n";
 37+ $this->preCheckError = true;
 38+ }
 39+ if (!file_exists( dirname(__FILE__) . '/testImages'))
 40+ {
 41+ echo "testImages directory cannot be found.\n";
 42+ $this->preCheckError = true;
 43+ }
 44+
 45+ $this->path = dirname(__FILE__) . '/testImages/multipage.tiff';
 46+ }
 47+
 48+ function runTest()
 49+ {
 50+ // do not execute test if preconditions check returned false;
 51+ if ($this->preCheckError) return false;
 52+ // ---- Parameter handling and lossy parameter
 53+ // validateParam
 54+ $this->assertTrue($this->handler->validateParam('lossy', '0'));
 55+ $this->assertTrue($this->handler->validateParam('lossy', '1'));
 56+ $this->assertTrue($this->handler->validateParam('lossy', 'false'));
 57+ $this->assertTrue($this->handler->validateParam('lossy', 'true'));
 58+ $this->assertTrue($this->handler->validateParam('lossy', 'lossy'));
 59+ $this->assertTrue($this->handler->validateParam('lossy', 'lossless'));
 60+ // normaliseParams
 61+ // here, boxfit behavior is tested
 62+ $params = array('width'=>'100', 'height'=>'100', 'page'=>'4');
 63+ $this->handler->normaliseParams($this->image, $params );
 64+ $this->assertEquals($params['height'], 75);
 65+ // makeParamString
 66+ $this->assertEquals($this->handler->makeParamString(array('width'=>'100', 'page'=>'4')), "page4-100px");
 67+
 68+ // ---- File upload checks and Thumbnail transformation
 69+ // check
 70+ // TODO: check other images
 71+ $this->assertTrue($this->handler->check( "multipage.tiff", $this->path, $error ));
 72+
 73+ $this->handler->check( "Caspian.tif", dirname(__FILE__) . '/testImages/caspian.tif', $error );
 74+ $this->assertEquals($error, "tiff_bad_file");
 75+ // doTransform
 76+ $this->handler->doTransform( $this->image, dirname(__FILE__) . '/testImages/test.tif', 'test.tif', array('width'=>100, 'height'=>100) );
 77+ $error = $this->handler->doTransform( wfFindFile(Title::newFromText('Image:Caspian.tif')), dirname(__FILE__) . '/testImages/caspian.tif', 'Caspian.tif', array('width'=>100, 'height'=>100) );
 78+ $this->assertEquals($error->textMsg, wfMsg("thumbnail_error", wfMsg("tiff_bad_file")));
 79+ // ---- Image information
 80+ // getThumbExtension
 81+ $this->assertEquals($this->handler->getThumbExtension( $this->image, 2, 1 ), '.jpg');
 82+ // TODO: 0 is obviously the same as NULL
 83+ $this->assertEquals($this->handler->getThumbExtension( $this->image, 2, '0' ), '.png');
 84+ // getLongDesc
 85+ $this->assertEquals($this->handler->getLongDesc( $this->image ), wfMsg('tiff-file-info-size', '1.024', '768', '2,64 MB', 'image/tiff', '1'));
 86+ // pageCount
 87+ $this->assertEquals($this->handler->pageCount( $this->image ), 7);
 88+ // getPageDimensions
 89+ $this->assertEquals($this->handler->getPageDimensions( $this->image, 0 ), array('width' => 1024, 'height' => 768) );
 90+ $this->assertEquals($this->handler->getPageDimensions( $this->image, 1 ), array('width' => 1024, 'height' => 768) );
 91+ $this->assertEquals($this->handler->getPageDimensions( $this->image, 2 ), array('width' => 640, 'height' => 564) );
 92+ $this->assertEquals($this->handler->getPageDimensions( $this->image, 3 ), array('width' => 1024, 'height' => 563) );
 93+ $this->assertEquals($this->handler->getPageDimensions( $this->image, 4 ), array('width' => 1024, 'height' => 768) );
 94+ $this->assertEquals($this->handler->getPageDimensions( $this->image, 5 ), array('width' => 1024, 'height' => 768) );
 95+ $this->assertEquals($this->handler->getPageDimensions( $this->image, 6 ), array('width' => 1024, 'height' => 768) );
 96+ $this->assertEquals($this->handler->getPageDimensions( $this->image, 7 ), array('width' => 768, 'height' => 1024) );
 97+ // TODO: check this, -1 is also false
 98+ $this->assertEquals($this->handler->getPageDimensions( $this->image, 8 ), false );
 99+ // isMultiPage
 100+ $this->assertTrue($this->handler->isMultiPage($this->image));
 101+
 102+ // ---- Metadata handling
 103+ // getMetadata
 104+ $metadata = $this->handler->getMetadata( false, $this->path );
 105+ $this->assertTrue(strpos($metadata, '"Pages";i:7')!==false);
 106+ // isMetadataValid
 107+ $this->assertTrue($this->handler->isMetadataValid($this->image, $metadata));
 108+ // getMetaArray
 109+ $metaArray = $this->handler->getMetaArray($this->image);
 110+ $this->assertEquals($metaArray['Pages'], 7);
 111+ $this->assertEquals($metaArray['pages'][1]['alpha'], 'False');
 112+ $this->assertEquals($metaArray['pages'][2]['alpha'], 'True');
 113+ $this->assertEquals($metaArray['exif']['Endianess'], 'MSB');
 114+ // formatMetadata
 115+ $formattedMetadata = $this->handler->formatMetadata($this->image) ;
 116+ $this->assertEquals($formattedMetadata['collapsed'][0]['value'], "TIFF (Tagged Image File Format)");
 117+ }
 118+
 119+}
 120+$wgShowExceptionDetails = true;
 121+
 122+$t = new PagedTiffHandlerTest();
 123+$t->setUp();
 124+$t->runTest();
 125+?>
\ No newline at end of file
Property changes on: trunk/extensions/PagedTiffHandler/tests/PagedTiffHandlerTest.php
___________________________________________________________________
Name: svn:keywords
1126 + LastChangedDate LastChangedBy Revision Id
Index: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/RunSeleniumTests.php
@@ -0,0 +1,88 @@
 2+<?php
 3+ /**
 4+ * Copyright (C) Wikimedia Deuschland, 2009
 5+ * Authors Hallo Welt! Medienwerkstatt GmbH
 6+ * Authors Markus Glaser
 7+ *
 8+ * This program is free software; you can redistribute it and/or modify
 9+ * it under the terms of the GNU General Public License as published by
 10+ * the Free Software Foundation; either version 2 of the License, or
 11+ * (at your option) any later version.
 12+ *
 13+ * This program is distributed in the hope that it will be useful,
 14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 16+ * GNU General Public License for more details.
 17+ *
 18+ * You should have received a copy of the GNU General Public License along
 19+ * with this program; if not, write to the Free Software Foundation, Inc.,
 20+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 21+ * http://www.gnu.org/copyleft/gpl.html
 22+ *
 23+ */
 24+
 25+define( "MEDIAWIKI", true );
 26+define( "SELENIUMTEST", true);
 27+
 28+//command line only
 29+$wgSeleniumTestsRunMode = 'cli';
 30+if( $wgSeleniumTestsRunMode == 'cli' && php_sapi_name() != 'cli' ) {
 31+ echo 'Must be run from the command line.';
 32+ die( -1 );
 33+}
 34+//include path and installation instructions
 35+
 36+//URL: http://localhost/tests/RunSeleniumTests.php
 37+//set_include_path(get_include_path() . PATH_SEPARATOR . './PEAR/');
 38+
 39+// Hostname of selenium server
 40+$wgSeleniumTestsSeleniumHost = "http://localhost";
 41+
 42+// URL of the wiki to be tested.
 43+$wgSeleniumTestsWikiUrl = 'http://localhost';
 44+
 45+// Wiki login. Used by Selenium to log onto the wiki
 46+$wgSeleniumTestsWikiUser = "WikiSysop";
 47+$wgSeleniumTestsWikiPassword = "hallowelt";
 48+
 49+// Common browsers on Windows platform
 50+// Use the *chrome handler in order to be able to test file uploads
 51+// further solution suggestions: http://www.brokenbuild.com/blog/2007/06/07/testing-file-uploads-with-selenium-rc-and-firefoxor-reducing-javascript-security-in-firefox-for-fun-and-profit/
 52+//$wgSeleniumTestsBrowsers['firefox'] = '*firefox c:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe';
 53+//$wgSeleniumTestsBrowsers['firefox'] = '*chrome c:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe';
 54+$wgSeleniumTestsBrowsers['firefox'] = '*chrome D:\\Firefox35\\firefox.exe';
 55+$wgSeleniumTestsBrowsers['iexplorer'] = '*iexploreproxy';
 56+
 57+// Actually, use this browser
 58+$wgSeleniumTestsUseBrowser = 'iexplorer';
 59+
 60+// requires PHPUnit 3.4
 61+require_once 'Testing/Selenium.php';
 62+require_once 'PHPUnit/Framework.php';
 63+require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
 64+
 65+// include uiTestsuite
 66+require_once 'selenium/SeleniumTestHTMLLogger.php';
 67+require_once 'selenium/SeleniumTestConsoleLogger.php';
 68+require_once 'selenium/SeleniumTestListener.php';
 69+require_once 'selenium/Selenium.php';
 70+require_once 'selenium/SeleniumTestSuite.php';
 71+require_once 'selenium/SeleniumTestCase.php';
 72+
 73+$result = new PHPUnit_Framework_TestResult;
 74+switch ($wgSeleniumTestsRunMode) {
 75+ case 'html' : $logger = new SeleniumTestHTMLLogger; break;
 76+ case 'cli' : $logger = new SeleniumTestConsoleLogger; break;
 77+}
 78+$result->addListener(new SeleniumTestListener($logger));
 79+
 80+
 81+$wgSeleniumTestSuites = array();
 82+
 83+// Todo: include automatically
 84+include_once '../extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php';
 85+
 86+// run tests
 87+foreach ($wgSeleniumTestSuites as $suite)
 88+ $suite->run($result);
 89+?>
\ No newline at end of file
Property changes on: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/RunSeleniumTests.php
___________________________________________________________________
Name: svn:keywords
190 + LastChangedDate LastChangedBy Revision Id
Index: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestSuite.php
@@ -0,0 +1,40 @@
 2+<?php
 3+if (!defined('MEDIAWIKI') || !defined('SELENIUMTEST')) {
 4+ echo "This script cannot be run standalone";
 5+ exit(1);
 6+}
 7+
 8+// Do not add line break after test output
 9+define('MW_TESTLOGGER_CONTINUE_LINE', 1);
 10+define('MW_TESTLOGGER_RESULT_OK', 2);
 11+define('MW_TESTLOGGER_RESULT_ERROR', 3);
 12+
 13+class SeleniumTestSuite extends PHPUnit_Framework_TestSuite
 14+{
 15+ private $selenium;
 16+
 17+ public function setUp()
 18+ {
 19+
 20+ $this->selenium = Selenium::getInstance();
 21+ $this->selenium->start();
 22+ $this->login();
 23+ //$this->loadPage('Testpage', 'edit');
 24+ }
 25+
 26+ public function tearDown()
 27+ {
 28+ $this->selenium->stop();
 29+ }
 30+
 31+ public function login()
 32+ {
 33+ $this->selenium->login();
 34+ }
 35+
 36+ public function loadPage($title, $action)
 37+ {
 38+ $this->selenium->loadPage($title, $action);
 39+ }
 40+}
 41+
Property changes on: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestSuite.php
___________________________________________________________________
Name: svn:keywords
142 + LastChangedDate LastChangedBy Revision Id
Index: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestCase.php
@@ -0,0 +1,43 @@
 2+<?php
 3+if (!defined('MEDIAWIKI') || !defined('SELENIUMTEST')) {
 4+ echo "This script cannot be run standalone";
 5+ exit(1);
 6+}
 7+
 8+class SeleniumTestCase extends PHPUnit_Framework_TestCase //PHPUnit_Extensions_SeleniumTestCase
 9+{
 10+ protected $selenium;
 11+
 12+ public function setUp()
 13+ {
 14+ set_time_limit(60);
 15+ $this->selenium = Selenium::getInstance();
 16+ //print_r($this->suite);
 17+ }
 18+
 19+ public function tearDown()
 20+ {
 21+
 22+ }
 23+
 24+ public function __call($method, $args)
 25+ {
 26+ return call_user_func_array (array($this->selenium, $method), $args);
 27+ }
 28+
 29+ public function assertSeleniumAttributeEquals($attribute, $value)
 30+ {
 31+ $attr = $this->getAttribute($attribute);
 32+ $this->assertEquals($attr, $value);
 33+ }
 34+
 35+ public function assertSeleniumHTMLContains($element, $text)
 36+ {
 37+ $innerHTML = $this->getText($element);
 38+ //or assertContains
 39+ $this->assertRegExp("/$text/", $innerHTML );
 40+ }
 41+
 42+}
 43+
 44+?>
Property changes on: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestCase.php
___________________________________________________________________
Name: svn:keywords
145 + LastChangedDate LastChangedBy Revision Id
Index: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/Selenium.php
@@ -0,0 +1,60 @@
 2+<?php
 3+/**
 4+ * Selenium connector
 5+ * This is implemented as a singleton.
 6+ */
 7+
 8+if (!defined('MEDIAWIKI') || !defined('SELENIUMTEST')) {
 9+ echo "This script cannot be run standalone";
 10+ exit(1);
 11+}
 12+
 13+class Selenium extends Testing_Selenium
 14+{
 15+ protected static $_instance = null;
 16+ public $isStarted = false;
 17+ public static function getInstance()
 18+ {
 19+ global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost, $wgSeleniumTestsUseBrowser;
 20+ if (null === self::$_instance)
 21+ {
 22+ self::$_instance = new self($wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser], $wgSeleniumTestsSeleniumHost);
 23+ }
 24+ return self::$_instance;
 25+ }
 26+
 27+ public function start()
 28+ {
 29+ global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost;
 30+ parent::start();
 31+ $this->isStarted = true;
 32+ }
 33+
 34+ public function stop()
 35+ {
 36+ parent::stop();
 37+ $this->isStarted = false;
 38+ }
 39+
 40+ public function login()
 41+ {
 42+ global $wgSeleniumTestsWikiUser, $wgSeleniumTestsWikiPassword, $wgSeleniumTestsWikiUrl;
 43+
 44+ $this->open($wgSeleniumTestsWikiUrl.'/index.php?title=Special:Userlogin');
 45+ $this->type("wpName1", $wgSeleniumTestsWikiUser);
 46+ $this->type("wpPassword1", $wgSeleniumTestsWikiPassword);
 47+ $this->click("//input[@id='wpLoginattempt']");
 48+ $value = $this->doCommand('assertTitle', array('Anmeldung erfolgreich*'));
 49+ }
 50+
 51+ public function loadPage($title, $action)
 52+ {
 53+ global $wgSeleniumTestsWikiUrl;
 54+ $this->open($wgSeleniumTestsWikiUrl.'/index.php?title='.$title.'&action='.$action);
 55+ }
 56+
 57+ // Prevent external cloning
 58+ protected function __clone() {}
 59+ // Prevent external construction
 60+ //protected function __construct() {}
 61+}
Property changes on: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/Selenium.php
___________________________________________________________________
Name: svn:keywords
162 + LastChangedDate LastChangedBy Revision Id
Index: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestConsoleLogger.php
@@ -0,0 +1,29 @@
 2+<?php
 3+if (!defined('MEDIAWIKI') || !defined('SELENIUMTEST')) {
 4+ echo "This script cannot be run standalone";
 5+ exit(1);
 6+}
 7+
 8+class SeleniumTestConsoleLogger
 9+{
 10+ public function __construct()
 11+ {
 12+ // Prepare testsuite for immediate output
 13+ @ini_set('zlib.output_compression', 0);
 14+ @ini_set('implicit_flush', 1);
 15+ for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
 16+ ob_implicit_flush(1);
 17+
 18+ }
 19+
 20+ public function write($message, $mode = false)
 21+ {
 22+ $out .= '';
 23+ //if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '<font color="green">';
 24+ $out .= htmlentities($message);
 25+ //if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '</font>';
 26+ if ($mode != MW_TESTLOGGER_CONTINUE_LINE) $out .= "\n";
 27+
 28+ echo $out;
 29+ }
 30+}
\ No newline at end of file
Property changes on: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestConsoleLogger.php
___________________________________________________________________
Name: svn:keywords
131 + LastChangedDate LastChangedBy Revision Id
Index: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestHTMLLogger.php
@@ -0,0 +1,43 @@
 2+<?php
 3+if (!defined('MEDIAWIKI') || !defined('SELENIUMTEST')) {
 4+ echo "This script cannot be run standalone";
 5+ exit(1);
 6+}
 7+
 8+class SeleniumTestHTMLLogger
 9+{
 10+ public function __construct()
 11+ {
 12+ // Prepare testsuite for immediate output
 13+ @ini_set('zlib.output_compression', 0);
 14+ @ini_set('implicit_flush', 1);
 15+ for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
 16+ ob_implicit_flush(1);
 17+
 18+ // Output some style information
 19+ echo '<style>
 20+ pre {
 21+ overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
 22+ white-space: pre-wrap; /* css-3 */
 23+ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
 24+ white-space: -pre-wrap; /* Opera 4-6 */
 25+ white-space: -o-pre-wrap; /* Opera 7 */
 26+ /* width: 99%; */
 27+ word-wrap: break-word; /* Internet Explorer 5.5+ */
 28+ }
 29+ </style>';
 30+
 31+
 32+ }
 33+
 34+ public function write($message, $mode = false)
 35+ {
 36+ $out .= '';
 37+ if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '<font color="green">';
 38+ $out .= htmlentities($message);
 39+ if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '</font>';
 40+ if ($mode != MW_TESTLOGGER_CONTINUE_LINE) $out .= '<br/>';
 41+
 42+ echo $out;
 43+ }
 44+}
\ No newline at end of file
Property changes on: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestHTMLLogger.php
___________________________________________________________________
Name: svn:keywords
145 + LastChangedDate LastChangedBy Revision Id
Index: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestListener.php
@@ -0,0 +1,74 @@
 2+<?php
 3+if (!defined('MEDIAWIKI') || !defined('SELENIUMTEST')) {
 4+ echo "This script cannot be run standalone";
 5+ exit(1);
 6+}
 7+
 8+class SeleniumTestListener implements PHPUnit_Framework_TestListener
 9+{
 10+ private $logger;
 11+ private $tests_ok = 0;
 12+ private $tests_failed = 0;
 13+
 14+ public function __construct($loggerInstance)
 15+ {
 16+ $this->logger = $loggerInstance;
 17+ }
 18+
 19+ public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
 20+ {
 21+ $this->logger->write("Error: ".$e->getMessage());
 22+ $this->tests_failed++;
 23+ }
 24+
 25+ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 26+ {
 27+ $this->logger->write("Failed: ".$e->getMessage());
 28+ $this->tests_failed++;
 29+
 30+ }
 31+
 32+ public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
 33+ {
 34+ $this->logger->write("Incomplete.");
 35+ $this->tests_failed++;
 36+ }
 37+
 38+ public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
 39+ {
 40+ $this->logger->write("Skipped.");
 41+ $this->tests_failed++;
 42+ }
 43+
 44+ public function startTest(PHPUnit_Framework_Test $test)
 45+ {
 46+ $this->logger->write("Testing ".$test->getName()." ... ", MW_TESTLOGGER_CONTINUE_LINE);
 47+ }
 48+
 49+ public function endTest(PHPUnit_Framework_Test $test, $time)
 50+ {
 51+ if (!$test->hasFailed())
 52+ {
 53+ $this->logger->write("OK", MW_TESTLOGGER_RESULT_OK);
 54+ $this->tests_ok++;
 55+ }
 56+ }
 57+
 58+ public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
 59+ {
 60+ $this->logger->write("Testsuite ".$suite->getName()." started.");
 61+ $this->tests_ok = 0;
 62+ }
 63+
 64+ public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
 65+ {
 66+ $this->logger->write("Testsuite ".$suite->getName()." ended. OK: ".$this->tests_ok." Failed: ".$this->tests_failed);
 67+
 68+ }
 69+
 70+ public function statusMessage($message)
 71+ {
 72+ $this->logger->write($message);
 73+ }
 74+}
 75+
Property changes on: trunk/extensions/PagedTiffHandler/selenium_copy_to_mediawiki_root/selenium/selenium/SeleniumTestListener.php
___________________________________________________________________
Name: svn:keywords
176 + LastChangedDate LastChangedBy Revision Id

Status & tagging log