You are here

function GMapSimpleAPITest::testGMapToDim in GMap Module 6

Same name and namespace in other branches
  1. 6.2 tests/gmap.test \GMapSimpleAPITest::testGMapToDim()
  2. 7.2 tests/gmap.test \GMapSimpleAPITest::testGMapToDim()
  3. 7 tests/gmap.test \GMapSimpleAPITest::testGMapToDim()

Verify gmap_todim().

File

tests/gmap.test, line 19

Class

GMapSimpleAPITest
Unit tests for gmap.module.

Code

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)'));
}