Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added test cases for circle, ellipse, line, arc

  • Loading branch information...
commit e423fc117d3c16f2c80720715ce8be18db803a9c 1 parent c1ecdce
@dnewcome authored
View
29 tests/arc.html
@@ -12,14 +12,26 @@
var arc;
function main() {
var paper = Donatello.paper('paper-div', 20, 20, 600, 600 );
- rect = paper.rect( 100, 100, 2, 2 );
- arc = paper.arc( 100, 100, 75, 0, 150, {
- stroke:'red',
- 'stroke-width':30
- });
- }
- function resize( evt ) {
- arc.draw( evt.clientX%360 );
+
+ // test positioning:
+ // rect should mark center of arc
+ rect = paper.rect( 25, 25, 1, 1 );
+ arc = paper.arc( 25, 25, 20, 0, 150 );
+
+ // test setting attribute during construction
+ arc = paper.arc( 75, 25, 20, 0, 150, { stroke:'red' } );
+
+ // test setting attribute
+ arc = paper.arc( 125, 25, 20, 0, 150 );
+ arc.attr( { stroke:'blue' } );
+
+ // test setting attribute
+ arc = paper.arc( 175, 25, 20, 0, 150 );
+ arc.attr( { t1:50 } );
+
+ // test setting attribute
+ arc = paper.arc( 225, 25, 20, 0, 150 );
+ arc.attr( { 'stroke-width':3 } );
}
</script>
<style>
@@ -29,7 +41,6 @@
</style>
</head>
-<body onload='main();' onmousemove='resize(event);'>
<body onload='main();'>
<div id="paper-div">
</div>
View
46 tests/circle.html
@@ -0,0 +1,46 @@
+<!doctype html>
+<html>
+<head>
+ <script src="../donatello.js" type="text/javascript"></script>
+ <script src="../circle.js" type="text/javascript"></script>
+ <!--
+ <script src="../build/donatello-min.js" type="text/javascript"></script>
+ -->
+ <script>
+ var circle;
+ function main() {
+ var paper = Donatello.paper('paper-div', 20, 20, 600, 600 );
+
+ // test positioning:
+ // rect should mark center of circle
+ rect = paper.rect( 25, 25, 1, 1 );
+ paper.circle( 25, 25, 20 );
+
+ // test setting attribute during construction
+ paper.circle( 75, 25, 20, { stroke:'red' } );
+
+ // test setting attribute
+ circle = paper.circle( 125, 25, 20 );
+ circle.attr( { stroke:'blue' } );
+
+ // test setting attribute
+ circle = paper.circle( 175, 25, 20 );
+ circle.attr( { y:50 } );
+
+ // test setting attribute
+ circle = paper.circle( 225, 25, 20 );
+ circle.attr( { 'stroke-width':6 } );
+ }
+ </script>
+ <style>
+ #paper-div {
+ border: 1px solid black
+ }
+ </style>
+
+</head>
+<body onload='main();'>
+ <div id="paper-div">
+ </div>
+</body>
+</html>
View
46 tests/ellipse.html
@@ -0,0 +1,46 @@
+<!doctype html>
+<html>
+<head>
+ <script src="../donatello.js" type="text/javascript"></script>
+ <script src="../ellipse.js" type="text/javascript"></script>
+ <!--
+ <script src="../build/donatello-min.js" type="text/javascript"></script>
+ -->
+ <script>
+ var ellipse;
+ function main() {
+ var paper = Donatello.paper('paper-div', 20, 20, 600, 600 );
+
+ // test positioning:
+ // rect should mark center of ellipse
+ rect = paper.rect( 25, 25, 1, 1 );
+ paper.ellipse( 25, 25, 20, 10 );
+
+ // test setting attribute during construction
+ paper.ellipse( 75, 25, 20, 10, { stroke:'red' } );
+
+ // test setting attribute
+ ellipse = paper.ellipse( 125, 25, 20, 10 );
+ ellipse.attr( { stroke:'blue' } );
+
+ // test setting attribute
+ ellipse = paper.ellipse( 175, 25, 20, 10 );
+ ellipse.attr( { y:50 } );
+
+ // test setting attribute
+ ellipse = paper.ellipse( 225, 25, 20, 10 );
+ ellipse.attr( { 'stroke-width':6 } );
+ }
+ </script>
+ <style>
+ #paper-div {
+ border: 1px solid black
+ }
+ </style>
+
+</head>
+<body onload='main();'>
+ <div id="paper-div">
+ </div>
+</body>
+</html>
View
43 tests/line.html
@@ -0,0 +1,43 @@
+<!doctype html>
+<html>
+<head>
+ <script src="../donatello.js" type="text/javascript"></script>
+ <script src="../line.js" type="text/javascript"></script>
+ <!--
+ <script src="../build/donatello-min.js" type="text/javascript"></script>
+ -->
+ <script>
+ var line;
+ function main() {
+ var paper = Donatello.paper('paper-div', 20, 20, 600, 600 );
+
+ paper.line( 25, 25, 10, 10 );
+
+ // test setting attribute during construction
+ paper.line( 75, 25, 10, 10, { stroke:'red' } );
+
+ // test setting attribute
+ line = paper.line( 125, 25, 10, 10 );
+ line.attr( { stroke:'blue' } );
+
+ // test setting attribute
+ line = paper.line( 175, 25, 10, 10 );
+ line.attr( { y:50 } );
+
+ // test setting attribute
+ line = paper.line( 225, 25, 10, 10 );
+ line.attr( { 'stroke-width':6 } );
+ }
+ </script>
+ <style>
+ #paper-div {
+ border: 1px solid black
+ }
+ </style>
+
+</head>
+<body onload='main();'>
+ <div id="paper-div">
+ </div>
+</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.