Index: trunk/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php |
— | — | @@ -1,6 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /** To get this working you must |
4 | 4 | * - set a valid path to PEAR |
| 5 | +* - check upload size in php.ini: Multipage.tiff needs at least 3M |
5 | 6 | * - Either upload multipage.tiff when PagedTiffHandler is active or set $wgSeleniumTiffTestUploads = true |
6 | 7 | * - set the locale to german |
7 | 8 | */ |
— | — | @@ -12,7 +13,30 @@ |
13 | 14 | } |
14 | 15 | |
15 | 16 | $wgSeleniumTiffTestUploads = false; |
| 17 | +$wgSeleniumTiffTestCheckPrerequistes = true; |
16 | 18 | |
| 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 | + |
17 | 41 | class SeleniumUploadTiffTest extends SeleniumTestCase |
18 | 42 | { |
19 | 43 | public function uploadFile($filename) |
— | — | @@ -195,10 +219,10 @@ |
196 | 220 | |
197 | 221 | public function runTest() |
198 | 222 | { |
199 | | - $this->preparePage("[[Image:Pc260001.tif]]\n"); |
| 223 | + $this->preparePage("[[Image:Multipage.tiff]]\n"); |
200 | 224 | |
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"); |
203 | 227 | } |
204 | 228 | } |
205 | 229 | |
— | — | @@ -208,7 +232,7 @@ |
209 | 233 | |
210 | 234 | public function runTest() |
211 | 235 | { |
212 | | - $this->preparePage("[[Image:Pc260001.tif|200px]]\n"); |
| 236 | + $this->preparePage("[[Image:Multipage.tiff|200px]]\n"); |
213 | 237 | //$this->selenium->type("wpTextbox1", "[[Image:Pc260001.tif|thumb]]\n"); |
214 | 238 | |
215 | 239 | $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "150"); |
— | — | @@ -222,7 +246,7 @@ |
223 | 247 | |
224 | 248 | public function runTest() |
225 | 249 | { |
226 | | - $this->preparePage("[[Image:Pc260001.tif|200x75px]]\n"); |
| 250 | + $this->preparePage("[[Image:Multipage.tiff|200x75px]]\n"); |
227 | 251 | |
228 | 252 | $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@height", "75"); |
229 | 253 | $this->assertSeleniumAttributeEquals("//div[@id='bodyContent']//img@width", "100"); |
— | — | @@ -302,6 +326,11 @@ |
303 | 327 | // create test suite |
304 | 328 | $wgSeleniumTestSuites['PagedTiffHandler'] = new SeleniumTestSuite('Paged TIFF Images'); |
305 | 329 | // add tests |
| 330 | +if ($wgSeleniumTiffTestCheckPrerequistes) |
| 331 | +{ |
| 332 | + $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumCheckPrerequisites()); |
| 333 | +} |
| 334 | + |
306 | 335 | if ($wgSeleniumTiffTestUploads) |
307 | 336 | { |
308 | 337 | $wgSeleniumTestSuites['PagedTiffHandler']->addTest(new SeleniumUploadBrokenTiffTest("caspian.tif", 'Die hochgeladene Datei ist fehlerhaft.')); |