org.hd.d.pg2k.test.dev
Class AlohaEarthTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.hd.d.pg2k.test.dev.AlohaEarthTest
All Implemented Interfaces:
junit.framework.Test

public final class AlohaEarthTest
extends junit.framework.TestCase

Test of various Aloha Earth components. Includes some tests of Location which could maybe go elsewhere.


Constructor Summary
AlohaEarthTest(java.lang.String name)
           
 
Method Summary
 void testAlohaEarthParams()
          Do some basic checks on AEParams object.
 void testBoundsEnforcement()
          Ensure that rectangle and other readable parameters are always in bounds where requested.
 void testLookupKey()
          Test lookup-key generation.
 void testTitleGeneration()
          Test that title lookup works.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AlohaEarthTest

public AlohaEarthTest(java.lang.String name)
Method Detail

testAlohaEarthParams

public void testAlohaEarthParams()
Do some basic checks on AEParams object. Test such as that we can set parameters away from and to their defaults.


testBoundsEnforcement

public void testBoundsEnforcement()
Ensure that rectangle and other readable parameters are always in bounds where requested. This is particularly important on edge cases, and were different sets of bounds interact so although individual values might be in range, combinations may not be.

We systematically run through a full range of zooms (indeed, nominally beyond the allowed bounds) and try extracting derived values for a range of input offsets.

This test is about making sure that things remain within bounds and is not about making sure that they can be usefully set, for example.


testLookupKey

public void testLookupKey()
Test lookup-key generation. Tests that a key is always generated, and that hashCode and equals work sufficiently well that a HashSet of the values correctly distinguishes all different pairs of AEParams values as seen from their zoom and constrained offsets.

We also check that these unique keys are one-to-one with unique views as indicated by the source rectangle a view (map fragment) is geenrated from.

To avoid running out of memory an patience this does not attempt to generate *all* possible valid values, but rather a finite subset randomly, maybe with a few edge cases thrown in.

TODO: Generalise this to test unconstrained keys too


testTitleGeneration

public void testTitleGeneration()
                         throws java.lang.Exception
Test that title lookup works. Test generation of titles is correct.

Throws:
java.lang.Exception

DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.