Skip to content

Commit

Permalink
Upgraded testing framework to FlexUnit 4 Beta 1. Converted project to…
Browse files Browse the repository at this point in the history
… Flash Builder 4. Added logos.
  • Loading branch information
gasi committed Aug 8, 2009
1 parent cef39a8 commit 6c26d59
Show file tree
Hide file tree
Showing 26 changed files with 201 additions and 220 deletions.
49 changes: 26 additions & 23 deletions .actionScriptProperties
@@ -1,25 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<actionScriptProperties mainApplicationPath="OpenZoomSDK.mxml" version="3">
<compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="false" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="true" htmlPlayerVersion="9.0.124" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="src" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path=""/>
<libraryPathEntry kind="1" linkType="1" path="lib"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="CatalogViewer.as"/>
<application path="GigaPanViewer.as"/>
<application path="SmoothTransformerTest.as"/>
<application path="LayerRendererTest.as"/>
<application path="RosettaProjectViewer.as"/>
<application path="DjatokaTest.as"/>
<application path="OpenZoomDescriptorTest.as"/>
<application path="dourado.as"/>
<application path="ImagePyramidRendererTest.as"/>
<application path="KoelnGigapixel.as"/>
</applications>
<modules/>
<buildCSSFiles/>
<actionScriptProperties mainApplicationPath="OpenZoomTestRunner.mxml" projectUUID="efa1b883-609d-439f-a9b6-852a61f741cd" version="6">
<compiler additionalCompilerArguments="-locale en_US -default-size 1024 768" autoRSLOrdering="true" copyDependentFiles="false" flexSDK="Flex 4.0" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath>
<compilerSourcePathEntry kind="1" linkType="1" path="test"/>
</compilerSourcePath>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path=""/>
<libraryPathEntry kind="1" linkType="1" path="lib"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="OpenZoomTestRunner.mxml"/>
<application path="CatalogViewer.as"/>
<application path="GigaPanViewer.as"/>
<application path="SmoothTransformerTest.as"/>
<application path="LayerRendererTest.as"/>
<application path="RosettaProjectViewer.as"/>
<application path="DjatokaTest.as"/>
<application path="OpenZoomDescriptorTest.as"/>
<application path="dourado.as"/>
<application path="ImagePyramidRendererTest.as"/>
<application path="KoelnGigapixel.as"/>
</applications>
<modules/>
<buildCSSFiles/>
</actionScriptProperties>
2 changes: 1 addition & 1 deletion .flexProperties
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<flexProperties flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="1"/>
<flexProperties flexServerFeatures="0" flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="1"/>
3 changes: 0 additions & 3 deletions .settings/com.adobe.flexbuilder.project.prefs

This file was deleted.

Binary file added lib/FlexUnit1Lib.swc
Binary file not shown.
Binary file added lib/FlexUnit4.swc
Binary file not shown.
Binary file added lib/FlexUnit4TurnkeyBeta_1.0.zip
Binary file not shown.
Binary file added lib/FlexUnit4UIRunner.swc
Binary file not shown.
Binary file added resources/logo/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/logo/logo.psd
Binary file not shown.
10 changes: 5 additions & 5 deletions src/ImagePyramidRendererTest.as
Expand Up @@ -212,11 +212,11 @@ public class ImagePyramidRendererTest extends Sprite
// height = 16384

// Virtual Earth
source = new VirtualEarthDescriptor()
numRenderers = 1
numColumns = 1
width = 16384
height = 16384
// source = new VirtualEarthDescriptor()
// numRenderers = 1
// numColumns = 1
// width = 16384
// height = 16384

// Zoomify
// <IMAGE_PROPERTIES WIDTH="2203" HEIGHT="3290"
Expand Down
36 changes: 36 additions & 0 deletions src/OpenZoomTestRunner.mxml
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner"
minWidth="1024"
minHeight="768"
creationComplete="creationCompleteHandler(event)">

<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import org.flexunit.listeners.UIListener;
import org.flexunit.runner.FlexUnitCore;
import org.openzoom.flash.utils.UtilsSuite;
import org.openzoom.flash.descriptors.DescriptorSuite;
private var flexUnitCore:FlexUnitCore;
private function creationCompleteHandler(event:Event):void
{
flexUnitCore = new FlexUnitCore()
flexUnitCore.addListener(new UIListener(testRunner))
flexUnitCore.run(DescriptorSuite, UtilsSuite)
}
]]>
</fx:Script>

<flexUnitUIRunner:TestRunnerBase id="testRunner" width="100%" height="100%" />

</s:Application>
Expand Up @@ -277,7 +277,6 @@ public class ZoomifyDescriptor extends ImagePyramidDescriptorBase
private function getScale(level:int):Number
{
var maxLevel:int = numLevels - 1
// 1 / (1 << maxLevel - level)
return Math.pow(0.5, maxLevel - level)
}

Expand All @@ -286,7 +285,6 @@ public class ZoomifyDescriptor extends ImagePyramidDescriptorBase
*/
private function getSize(level:int):Point
{
// TODO: Test whether to floor or ceil dimensions
var size:Point = new Point()
var scale:Number = getScale(level)
size.x = Math.ceil(width * scale)
Expand Down
18 changes: 0 additions & 18 deletions test/.actionScriptProperties

This file was deleted.

2 changes: 0 additions & 2 deletions test/.flexProperties

This file was deleted.

25 changes: 0 additions & 25 deletions test/.project

This file was deleted.

3 changes: 0 additions & 3 deletions test/.settings/org.eclipse.core.resources.prefs

This file was deleted.

48 changes: 0 additions & 48 deletions test/OpenZoomTestRunner.mxml

This file was deleted.

2 changes: 1 addition & 1 deletion test/base16samples.py
Expand Up @@ -25,7 +25,7 @@
alphabet = """abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789!@#$%^&*()_{}|'/<>?.,"""
min = 0
max = len(alphabet)
total = 10000
total = 1000
string = ""
file = open("org/openzoom/flash/utils/Base16Samples.as","w")
file.write(" private static const SAMPLES : Array = [\n")
Expand Down
Binary file removed test/lib/FlexUnit.swc
Binary file not shown.
17 changes: 17 additions & 0 deletions test/org/openzoom/flash/descriptors/DescriptorSuite.as
@@ -0,0 +1,17 @@
package org.openzoom.flash.descriptors
{

import org.openzoom.flash.descriptors.deepzoom.DeepZoomImageDescriptorTest;
import org.openzoom.flash.descriptors.djatoka.DjatokaDescriptorTest;
import org.openzoom.flash.descriptors.zoomify.ZoomifyDescriptorTest;

[Suite]
[RunWith("org.flexunit.runners.Suite")]
public class DescriptorSuite
{
public var deepZoomImageDescriptorTest:DeepZoomImageDescriptorTest
public var djatokaDescriptorTest:DjatokaDescriptorTest
public var zoomifyDescriptorTest:ZoomifyDescriptorTest
}

}
Expand Up @@ -21,15 +21,14 @@
package org.openzoom.flash.descriptors.deepzoom
{

import flexunit.framework.TestCase;

import org.openzoom.flash.descriptors.IMultiScaleImageDescriptor;
import org.openzoom.flash.descriptors.IMultiScaleImageLevel;
import org.flexunit.Assert;
import org.openzoom.flash.descriptors.IImagePyramidDescriptor;
import org.openzoom.flash.descriptors.IImagePyramidLevel;

/**
* Tests the DZIDescriptor implementation for correctness.
* Tests the DeepZoomImageDescriptor implementation for correctness.
*/
public class DZIDescriptorTest extends TestCase
public class DeepZoomImageDescriptorTest
{
//--------------------------------------------------------------------------
//
Expand Down Expand Up @@ -66,20 +65,22 @@ public class DZIDescriptorTest extends TestCase
//
//--------------------------------------------------------------------------

private var descriptor:IMultiScaleImageDescriptor
private var descriptor:IImagePyramidDescriptor

//--------------------------------------------------------------------------
//
// Overridden methods: TestCase
//
//--------------------------------------------------------------------------

override public function setUp():void
[Before]
public function setUp():void
{
descriptor = DZIDescriptor.fromXML("test.xml", DESCRIPTOR_XML)
descriptor = DeepZoomImageDescriptor.fromXML("test.xml", DESCRIPTOR_XML)
}

override public function tearDown():void
[After]
public function tearDown():void
{
descriptor = null
}
Expand All @@ -90,36 +91,40 @@ public class DZIDescriptorTest extends TestCase
//
//--------------------------------------------------------------------------

[Test]
public function testMaxLevel():void
{
assertEquals("Maximum level correctly computed", 12, descriptor.numLevels - 1)
Assert.assertEquals("Maximum level correctly computed", 12, descriptor.numLevels - 1)
}

[Test]
public function testOverlap():void
{
assertEquals("Overlap correct", 0, descriptor.tileOverlap)
Assert.assertEquals("Overlap correct", 0, descriptor.tileOverlap)
}

[Test]
public function testLevels():void
{
for (var index:int = 0; index < descriptor.numLevels; index++)
{
var level:IMultiScaleImageLevel = descriptor.getLevelAt(index)
assertEquals("Width on level " + level.index, LEVELS[level.index][0], level.width)
assertEquals("Height on level " + level.index, LEVELS[level.index][1], level.height)
assertEquals("Column count on level " + level.index, LEVELS[level.index][2], level.numColumns)
assertEquals("Row count on level " + level.index, LEVELS[level.index][3], level.numRows)
var level:IImagePyramidLevel = descriptor.getLevelAt(index)
Assert.assertEquals("Width on level " + level.index, LEVELS[level.index][0], level.width)
Assert.assertEquals("Height on level " + level.index, LEVELS[level.index][1], level.height)
Assert.assertEquals("Column count on level " + level.index, LEVELS[level.index][2], level.numColumns)
Assert.assertEquals("Row count on level " + level.index, LEVELS[level.index][3], level.numRows)
}

}

public function testGetMinimumLevelForSize():void
[Test]
public function testGetLevelForSize():void
{
assertEquals("Level computation for given size", descriptor.numLevels - 1,
descriptor.getMinLevelForSize(descriptor.width, descriptor.height).index)
Assert.assertEquals("Level computation for given size", descriptor.numLevels - 1,
descriptor.getLevelForSize(descriptor.width, descriptor.height).index)

assertEquals("Level computation for given size", descriptor.numLevels - 2,
descriptor.getMinLevelForSize(descriptor.width / 2 - 1, descriptor.height / 2 - 1).index)
Assert.assertEquals("Level computation for given size", descriptor.numLevels - 2,
descriptor.getLevelForSize(descriptor.width / 2 - 1, descriptor.height / 2 - 1).index)
}
}

Expand Down

0 comments on commit 6c26d59

Please sign in to comment.