This is the LZUnit library.  LZUnit is an implementation of the
                               xUnit testing framework for LZX programs (cf., JUnit
                                      A Cook's Tour).
                           
            
                               Each of the xUnit components is implemented as an LZX tag with the
                               corresponding name.  Tests can be written by defining a subclass of
                               TestCase and defining test
                  
                               methods.  A test suite can be created by enclosing any number of
                               TestCases in a TestSuite.
                           
            
                               The usual helper methods, assertTrue,
                               assertEquals, assertWithin,
                               assertSame, etc. are available for implementing the
                               tests.  (See the documentation of Test for a full
                               list.)
                           
            
                               An LZX program that consists of a
                               TestSuite will, when loaded, automatically run all of
                               its child TestCases and report the number of test cases
                               run, the number of failures, and the number of errors.  If any error
                               occurs, an obvious error message is presented.
                           
            
Below is a simple example of the use of LZUnit demonstrating a successful test, a failed test, and a test that causes an error.
| ![[Note]](images/note.png) | Note | 
|---|---|
| You must run LZUnit with debugging on for it to detect errors. | 
For a more in depth discussion, please see the Developer's Guide.
<canvas debug="true">
                      <debug y="275"/>
                      <include href="lzunit"/>
                      <class name="Tautologies" extends="TestCase">
                        <method name="addTests" override="true">
                          addTest("testSuccess");
                        </method>
                        <method name="testSuccess">
                          assertTrue(true);
                          assertFalse(false);
                          assertEquals(null, undefined);
                          assertWithin(0, .001, .01);
                          assertSame(null, null);
                          assertNotSame(null, undefined);
                          assertNull(null);
                          assertNotNull(undefined);
                          assertUndefined(undefined);
                          assertNotUndefined(null);
                        </method>
                      </class>
                      <class name="IntentionalBugs" extends="TestCase">
                        <method name="addTests" override="true">
                          addTest("testFailure");
                          addTest("testError");
                        </method>
                        <method name="testFailure">
                          fail("This is an intentional failure");
                        </method>
                        <method name="testError">
                          error("This is an intentional error");
                        </method>
                      </class>
                      <TestSuite>
                        <Tautologies/>
                        <IntentionalBugs/>
                      </TestSuite>
                    </canvas>
               | Name (CSS property) | Type (tag) | Type (js) | Default | Category | 
|---|---|---|---|---|
| controlPanel | expression | any | canvas.lzunitControlPanel | read/write | 
aaactive, aadescription, aaname, aasilent, aatabindex, align, backgroundrepeat, bgcolor, cachebitmap, capabilities, clickable, clickregion, clip, colortransform, context, contextmenu, cornerradius, cursor, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hasdirectionallayout, hassetheight, hassetwidth, height, layout, loadratio, mask, opacity, pixellock, playing, proxyurl, resource, resourceheight, resourcewidth, rotation, shadowangle, shadowblurradius, shadowcolor, shadowdistance, showhandcursor, source, stretches, subviews, tintcolor, totalframes, unstretchedheight, unstretchedwidth, usegetbounds, valign, visibility, visible, width, x, xoffset, xscale, y, yoffset, yscale
classroot, cloneManager, data, datapath, defaultplacement, id, ignoreplacement, immediateparent, inited, initstage, name, nodeLevel, options, parent, placement, styleclass, subnodes, transition
Methods
assertEquals, assertFalse, assertNotNull, assertNotSame, assertNotUndefined, assertNull, assertSame, assertTrue, assertUndefined, assertWithin, displayMessage, error, fail
bringToFront, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getCurrentTime, getDepthList, getDisplayObject, getID3, getMouse, getNextSelection, getPan, getPrevSelection, getProxyURL, getTotalTime, getVolume, init, isBehind, isInFrontOf, isMouseOver, measureHeight, measureWidth, play, proxyurl, searchSubviews, seek, sendAAEvent, sendBehind, sendInFrontOf, sendToBack, setAccessible, setAttributeRelative, setColor, setColorTransform, setPan, setProxyPolicy, setSource, setVolume, shouldYieldFocus, stop, unload, updateResourceSize
animate, applyConstraintMethod, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getOption, getUID, init, lookupSourceLocator, releaseConstraint, releaseConstraintMethod, searchImmediateSubnodes, searchSubnodes, setOption, setSelected, updateData
onaddsubview, onbackgroundrepeat, onblur, onclick, onclickable, onclip, oncontext, oncornerradius, ondblclick, onerror, onfocus, onframe, onframesloadratio, ongesture, onheight, onkeydown, onkeyup, onlastframe, onload, onloadratio, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmousetrackout, onmousetrackover, onmousetrackup, onmouseup, onmouseupoutside, onopacity, onplay, onplaying, onremovesubview, onshadowangle, onshadowblurradius, onshadowcolor, onshadowdistance, onstop, ontimeout, ontouch, onvisible, onwidth, onx, ony
Copyright © 2002-2010 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.