http://www.mediawiki.org/wiki/Special:Code/MediaWiki/62473
Revision: 62473 Author: mglaser Date: 2010-02-14 18:46:41 +0000 (Sun, 14 Feb 2010) Log Message: ----------- check prerequisites before actual testing Modified Paths: -------------- trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php Modified: trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php =================================================================== --- trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php 2010-02-14 18:46:10 UTC (rev 62472) +++ trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php 2010-02-14 18:46:41 UTC (rev 62473) @@ -1,6 +1,7 @@ <?php /** To get this working you must * - set a valid path to PEAR +* - check upload size in php.ini: Multipage.tiff needs at least 3M * - Either upload multipage.tiff when PagedTiffHandler is active or set $wgSeleniumTiffTestUploads = true * - set the locale to german */ @@ -12,7 +13,30 @@ } $wgSeleniumTiffTestUploads = false; +$wgSeleniumTiffTestCheckPrerequistes = true; +class SeleniumCheckPrerequisites extends SeleniumTestCase +{ + public $name = "Check prerequisites"; + + public function runTest() + { + global $wgSeleniumTestsWikiUrl; + // check whether Multipage.tiff is already uploaded + $this->open($wgSeleniumTestsWikiUrl.'/index.php?title=Image:Multipage.tiff'); + + $source = $this->getAttribute("//d...@id='bodyContent']//u...@id"); + $this->assertEquals($source, 'filetoc'); + + //check for language + $this->open($wgSeleniumTestsWikiUrl.'/index.php/Special:Preferences'); + + $source = $this->getAttribute("//sele...@id='mw-input-language']/opti...@value='de']/@selected"); + $this->assertEquals($source, 'selected'); + } +} + + class SeleniumUploadTiffTest extends SeleniumTestCase { public function uploadFile($filename) @@ -195,10 +219,10 @@ public function runTest() { - $this->preparePage("[[Image:Pc260001.tif]]\n"); + $this->preparePage("[[Image:Multipage.tiff]]\n"); - $this->assertSeleniumAttributeEquals("//d...@id='bodyContent']//i...@height", "480"); - $this->assertSeleniumAttributeEquals("//d...@id='bodyContent']//i...@width", "640"); + $this->assertSeleniumAttributeEquals("//d...@id='bodyContent']//i...@height", "768"); + $this->assertSeleniumAttributeEquals("//d...@id='bodyContent']//i...@width", "1024"); } } @@ -208,7 +232,7 @@ public function runTest() { - $this->preparePage("[[Image:Pc260001.tif|200px]]\n"); + $this->preparePage("[[Image:Multipage.tiff|200px]]\n"); //$this->selenium->type("wpTextbox1", "[[Image:Pc260001.tif|thumb]]\n"); $this->assertSeleniumAttributeEquals("//d...@id='bodyContent']//i...@height", "150"); @@ -222,7 +246,7 @@ public function runTest() { - $this->preparePage("[[Image:Pc260001.tif|200x75px]]\n"); + $this->preparePage("[[Image:Multipage.tiff|200x75px]]\n"); $this->assertSeleniumAttributeEquals("//d...@id='bodyContent']//i...@height", "75"); $this->assertSeleniumAttributeEquals("//d...@id='bodyContent']//i...@width", "100"); @@ -302,6 +326,11 @@ // create test suite $wgSeleniumTestSuites['PagedTiffHandler'] = new SeleniumTestSuite('Paged TIFF Images'); // add tests +if ($wgSeleniumTiffTestCheckPrerequistes) +{ + $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumCheckPrerequisites()); +} + if ($wgSeleniumTiffTestUploads) { $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("caspian.tif", 'Die hochgeladene Datei ist fehlerhaft.')); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs