public function GMapSimpleAPITest::testGMapToDim in GMap Module 7
Same name and namespace in other branches
- 6.2 tests/gmap.test \GMapSimpleAPITest::testGMapToDim()
- 6 tests/gmap.test \GMapSimpleAPITest::testGMapToDim()
- 7.2 tests/gmap.test \GMapSimpleAPITest::testGMapToDim()
Verify gmap_todim().
File
- tests/
gmap.test, line 26 - Unit tests for gmap.module.
Class
- GMapSimpleAPITest
- @file Unit tests for gmap.module.
Code
public function testGMapToDim() {
// Valid stuff
$this
->assertEqual(gmap_todim('500PX'), '500px', t('Testing case normalization'));
$this
->assertEqual(gmap_todim(' 500 px '), '500px', t('Testing spaces'));
$this
->assertEqual(gmap_todim('1.5em'), '1.5em', t('Testing em'));
$this
->assertEqual(gmap_todim('1.5ex'), '1.5ex', t('Testing ex'));
$this
->assertEqual(gmap_todim('1.5in'), '1.5in', t('Testing in'));
$this
->assertEqual(gmap_todim('1.5cm'), '1.5cm', t('Testing cm'));
$this
->assertEqual(gmap_todim('1.5mm'), '1.5mm', t('Testing mm'));
$this
->assertEqual(gmap_todim('1.5pt'), '1.5pt', t('Testing pt'));
$this
->assertEqual(gmap_todim('1.5pc'), '1.5pc', t('Testing pc'));
$this
->assertEqual(gmap_todim('150%'), '150%', t('Testing %'));
// Invalid stuff
$this
->assertEqual(gmap_todim('500pxBLUE SMURFpx'), FALSE, t('Testing invalid data'));
$this
->assertEqual(gmap_todim('500'), FALSE, t('Testing missing dimension type'));
$this
->assertEqual(gmap_todim(500), FALSE, t('Testing raw number'));
// REALLY invalid stuff
$this
->assertEqual(gmap_todim(NULL), FALSE, t('Testing invalid data (NULL)'));
$this
->assertEqual(gmap_todim(array()), FALSE, t('Testing invalid data (Array)'));
}