From: Andrew G. <agi...@us...> - 2005-08-15 23:18:25
|
Update of /cvsroot/dynapi/dynapi3x/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10083 Added Files: 001.DynLayers.html 001.DynLayers.txt 002.Location.html 002.Location.txt 003.DynLayerDestroy.html 003.DynLayerDestroy.txt 004.BorderManager.html 004.BorderManager.txt index.php Log Message: Initial version --- NEW FILE --- <html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <title>DynAPI - Test Suite</title> <script type=\"text/javascript\" language=\"JavaScript\" src=\"../src/dynapi.js\"></script> <script type=\"text/javascript\" language=\"JavaScript\"> dynapi.library.setPath(\'../src/\'); </script> <script type=\"text/javascript\" language=\"JavaScript\"> dynapi.library.include(\'dynapi.api\'); </script> <script type=\"text/javascript\" language=\"JavaScript\"> w = new DynLayer(); w.setBgColor(\'white\'); w.setSize(130,130); w.setLocation(50,50); b = new DynLayer(); b.setBgColor(\'black\'); b.setSize(100,100); b.setLocation(200,50); dynapi.document.addChild(w); dynapi.document.addChild(b); </script> </head> <body bgcolor=\"#999999\"> <script type=\"text/javascript\" language=\"JavaScript\"> dynapi.document.insertAllChildren(); </script> </body> </html> --- NEW FILE --- You should see a grey background, a white square and a smaller black square to the right. --- NEW FILE --- <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DynAPI - Test Suite</title> <script type="text/javascript" language="JavaScript" src="../src/dynapi.js"></script> <script type="text/javascript" language="JavaScript"> dynapi.library.setPath('../src/'); </script> <script type="text/javascript" language="JavaScript"> dynapi.library.include('dynapi.api'); </script> <script type="text/javascript" language="JavaScript"> // Parent Layer p = new DynLayer(); p.setBgColor('white'); p.setSize(200,200); p.setLocation(225,25); // Markers m1 = new DynLayer('25,25'); m1.setBgColor('yellow'); m1.setSize(50,50); m1.setLocation(25,25); m2 = new DynLayer('25,125'); m2.setBgColor('yellow'); m2.setSize(50,50); m2.setLocation(25,125); m3 = new DynLayer('350,50'); m3.setBgColor('pink'); m3.setSize(50,50); m3.setLocation(125,25); m4 = new DynLayer('350,150'); m4.setBgColor('pink'); m4.setSize(50,50); m4.setLocation(125,125); c = new DynLayer(); c.setBgColor('black'); c.setSize(50,50); c.setLocation(75,75); dynapi.document.addChild(p); p.addChild(m1); p.addChild(m2); p.addChild(m3); p.addChild(m4); p.addChild(c); </script> </head> <body bgcolor="#999999"> <script type="text/javascript" language="JavaScript"> dynapi.document.insertAllChildren(); </script> <p> <a href="javascript:;" onclick="c.setLocation(25,25)">Set Location 25,25</a><br> <a href="javascript:;" onclick="c.setLocation(25,125)">Set Location 25,125</a><br> <a href="javascript:;" onclick="c.setPageLocation(350,50)">Set Page Location 350,50</a><br> <a href="javascript:;" onclick="c.setPageLocation(350,150)">Set Page Location 350,150</a><br> </p> <p> <a href="javascript:;" onclick="c.setLocation(75,75)">Center</a> </p> </body> </html> --- NEW FILE --- Square should move around --- NEW FILE --- <html> <head> <title>DynAPI - DynLayer Destroy</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> dynapi.library.setPath('../src/'); dynapi.library.include('dynapi.api'); dynapi.library.include('dynapi.functions'); </script> <script language="Javascript"> dynapi.onLoad(init); function init() { document.countform.counttext.value = 0; }; var counter = 0; var startTime=0; function generate(n) { for (var i=0;i<n;i++) { var d = new DynLayer(); d.setBgColor(dynapi.functions.getRandomColor()); d.setSize(10+80*Math.random(),10+80*Math.random()); d.setLocation(130+500*Math.random(),500*Math.random()); dynapi.document.addChild(d); counter++; document.countform.counttext.value = counter; } if (counter >= 1000) stop(); } var timer; function start() { if (counter==0){ var d=new Date(); startTime=d.getTime(); timer = setInterval('generate(10)',1); } } function stop() { clearInterval(timer); var d=new Date(); document.countform.timer.value = (d.getTime()-startTime)/1000; } function destroyAll() { dynapi.document.destroyAllChildren(); document.countform.counttext.value = 0; document.countform.timer.value = ''; counter=0; } </script> </head> <body bgcolor="#999999"> <p><a href="javascript:start()">Start generation</a><br> <a href="javascript:destroyAll()">Destroy all</a><br> <form name="countform"> <input type=text name="counttext" size=5/> <br/> <input type=text name="timer" size=5> </form> </body> </html> --- NEW FILE --- When running this test it is useful to watch the memory usage of the browser. Let the test run to create 1000 or so dynlayers. Stop it, destroy the layers, and run it again. If the second run continues to increase the amount of memory used by the browser, then memory is not being released and you should mark the test as failed. <br> This test is based on the dynapi.api.dynlayer-destroy.html example. --- NEW FILE --- <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DynAPI - Test Suite - BorderManager</title> <script type="text/javascript" language="JavaScript" src="../src/dynapi.js"></script> <script type="text/javascript" language="JavaScript"> dynapi.library.setPath('../src/'); </script> <script type="text/javascript" language="JavaScript"> dynapi.library.include('dynapi.api'); dynapi.library.include('BorderManager'); </script> <script type="text/javascript" language="JavaScript"> var oldL = dynapi.document; var i,newL; for (i = 0; i < 125; i++) { newL = new DynLayer(); newL.setBgColor('#e0e0e0'); newL.setSize(500 - i*4, 500 - i*4); newL.setLocation(2, 2); newL.setInnerBorder(1,"black"); oldL.addChild(newL); oldL = newL; } </script> </head> <body bgcolor="#999999"> <script type="text/javascript" language="JavaScript"> dynapi.document.insertAllChildren(); </script> </body> </html> --- NEW FILE --- This test shows 125 white layers, each with a 1-pixel wide black border. The layers are stacked one above the other in decreasing size so that all the borders are visible. --- NEW FILE --- <html> <head> <title>DynAPI - Test Suite</title> </head> <body> <?php require("scripts/config.php"); // Read test files // Keep this ... just write the files!!!! (security?) echo "<p><a href=\"scripts/editTest.php\">Create new test case</a></p>\n"; echo "<p>Available test cases:</p>\n"; echo "<table border=\"1\" cellspacing=\"0\">\n"; echo "<table border=\"1\" cellspacing=\"0\">\n"; echo "<tr>\n"; echo " <th>Name</th>\n"; echo " <th colspan=\"3\">Commands</th>\n"; echo "</tr>\n"; foreach (glob("*.html") as $filename) { $basename = basename($filename, ".html"); if (!file_exists($basename . ".txt")) continue; echo "<tr>"; echo "<td>" . $basename . "</td>"; echo " <td><a href=\"scripts/displayTest.php?name=" . urlencode($basename) . "\">Run</a></td>\n"; echo " <td><a href=\"scripts/editTest.php?name=" . urlencode($basename) . "\">Edit</a></td>\n"; echo " <td><a href=\"scripts/showResults.php?name=" . urlencode($basename) . "\">Previous results</a></td>\n"; echo "</tr>\n"; } echo "</table>\n"; ?> </body> </html> |