r62473 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62472‎ | r62473 | r62474 >
Date:18:46, 14 February 2010
Author:mglaser
Status:deferred
Tags:
Comment:
check prerequisites before actual testing
Modified paths:
  • /trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php
@@ -1,6 +1,7 @@
22 <?php
33 /** To get this working you must
44 * - set a valid path to PEAR
 5+* - check upload size in php.ini: Multipage.tiff needs at least 3M
56 * - Either upload multipage.tiff when PagedTiffHandler is active or set $wgSeleniumTiffTestUploads = true
67 * - set the locale to german
78 */
@@ -12,7 +13,30 @@
1314 }
1415
1516 $wgSeleniumTiffTestUploads = false;
 17+$wgSeleniumTiffTestCheckPrerequistes = true;
1618
 19+class SeleniumCheckPrerequisites extends SeleniumTestCase
 20+{
 21+ public $name = "Check prerequisites";
 22+
 23+ public function runTest()
 24+ {
 25+ global $wgSeleniumTestsWikiUrl;
 26+ // check whether Multipage.tiff is already uploaded
 27+ $this->open($wgSeleniumTestsWikiUrl.'/index.php?title=Image:Multipage.tiff');
 28+
 29+ $source = $this->getAttribute("//div[@id='bodyContent']//ul@id");
 30+ $this->assertEquals($source, 'filetoc');
 31+
 32+ //check for language
 33+ $this->open($wgSeleniumTestsWikiUrl.'/index.php/Special:Preferences');
 34+
 35+ $source = $this->getAttribute("//select[@id='mw-input-language']/option[@value='de']/@selected");
 36+ $this->assertEquals($source, 'selected');
 37+ }
 38+}
 39+
 40+
1741 class SeleniumUploadTiffTest extends SeleniumTestCase
1842 {
1943 public function uploadFile($filename)
@@ -195,10 +219,10 @@
196220
197221 public function runTest()
198222 {
199 - $this->preparePage("[[Image:Pc260001.tif]]\n");
 223+ $this->preparePage("[[Image:Multipage.tiff]]\n");
200224
201 - $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "480");
202 - $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "640");
 225+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "768");
 226+ $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "1024");
203227 }
204228 }
205229
@@ -208,7 +232,7 @@
209233
210234 public function runTest()
211235 {
212 - $this->preparePage("[[Image:Pc260001.tif|200px]]\n");
 236+ $this->preparePage("[[Image:Multipage.tiff|200px]]\n");
213237 //$this->selenium->type("wpTextbox1", "[[Image:Pc260001.tif|thumb]]\n");
214238
215239 $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "150");
@@ -222,7 +246,7 @@
223247
224248 public function runTest()
225249 {
226 - $this->preparePage("[[Image:Pc260001.tif|200x75px]]\n");
 250+ $this->preparePage("[[Image:Multipage.tiff|200x75px]]\n");
227251
228252 $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "75");
229253 $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "100");
@@ -302,6 +326,11 @@
303327 // create test suite
304328 $wgSeleniumTestSuites['PagedTiffHandler'] = new SeleniumTestSuite('Paged TIFF Images');
305329 // add tests
 330+if ($wgSeleniumTiffTestCheckPrerequistes)
 331+{
 332+ $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumCheckPrerequisites());
 333+}
 334+
306335 if ($wgSeleniumTiffTestUploads)
307336 {
308337 $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("caspian.tif", 'Die hochgeladene Datei ist fehlerhaft.'));

Status & tagging log