From 47d455dd55be855e4cc691c32f687f723d9247ee Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ksvg/test/ecma/bbox/bbox-circle.svg | 13 +++++ ksvg/test/ecma/bbox/bbox-ellipse.svg | 14 +++++ ksvg/test/ecma/bbox/bbox-line.svg | 35 ++++++++++++ ksvg/test/ecma/bbox/bbox-path.svg | 15 +++++ ksvg/test/ecma/bbox/bbox-path2.svg | 14 +++++ ksvg/test/ecma/bbox/bbox-polygon.svg | 13 +++++ ksvg/test/ecma/bbox/bbox-polyline.svg | 13 +++++ ksvg/test/ecma/bbox/bbox-rect.svg | 15 +++++ ksvg/test/ecma/bbox/bbox.js | 103 ++++++++++++++++++++++++++++++++++ 9 files changed, 235 insertions(+) create mode 100644 ksvg/test/ecma/bbox/bbox-circle.svg create mode 100644 ksvg/test/ecma/bbox/bbox-ellipse.svg create mode 100644 ksvg/test/ecma/bbox/bbox-line.svg create mode 100644 ksvg/test/ecma/bbox/bbox-path.svg create mode 100644 ksvg/test/ecma/bbox/bbox-path2.svg create mode 100644 ksvg/test/ecma/bbox/bbox-polygon.svg create mode 100644 ksvg/test/ecma/bbox/bbox-polyline.svg create mode 100644 ksvg/test/ecma/bbox/bbox-rect.svg create mode 100644 ksvg/test/ecma/bbox/bbox.js (limited to 'ksvg/test/ecma/bbox') diff --git a/ksvg/test/ecma/bbox/bbox-circle.svg b/ksvg/test/ecma/bbox/bbox-circle.svg new file mode 100644 index 00000000..10ff5e3c --- /dev/null +++ b/ksvg/test/ecma/bbox/bbox-circle.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ksvg/test/ecma/bbox/bbox-ellipse.svg b/ksvg/test/ecma/bbox/bbox-ellipse.svg new file mode 100644 index 00000000..0fccee5b --- /dev/null +++ b/ksvg/test/ecma/bbox/bbox-ellipse.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/ksvg/test/ecma/bbox/bbox-line.svg b/ksvg/test/ecma/bbox/bbox-line.svg new file mode 100644 index 00000000..b9caf551 --- /dev/null +++ b/ksvg/test/ecma/bbox/bbox-line.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ksvg/test/ecma/bbox/bbox-path.svg b/ksvg/test/ecma/bbox/bbox-path.svg new file mode 100644 index 00000000..bdfd24fe --- /dev/null +++ b/ksvg/test/ecma/bbox/bbox-path.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/ksvg/test/ecma/bbox/bbox-path2.svg b/ksvg/test/ecma/bbox/bbox-path2.svg new file mode 100644 index 00000000..988641a1 --- /dev/null +++ b/ksvg/test/ecma/bbox/bbox-path2.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/ksvg/test/ecma/bbox/bbox-polygon.svg b/ksvg/test/ecma/bbox/bbox-polygon.svg new file mode 100644 index 00000000..025bdeb5 --- /dev/null +++ b/ksvg/test/ecma/bbox/bbox-polygon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ksvg/test/ecma/bbox/bbox-polyline.svg b/ksvg/test/ecma/bbox/bbox-polyline.svg new file mode 100644 index 00000000..c60321da --- /dev/null +++ b/ksvg/test/ecma/bbox/bbox-polyline.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ksvg/test/ecma/bbox/bbox-rect.svg b/ksvg/test/ecma/bbox/bbox-rect.svg new file mode 100644 index 00000000..b35285ec --- /dev/null +++ b/ksvg/test/ecma/bbox/bbox-rect.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/ksvg/test/ecma/bbox/bbox.js b/ksvg/test/ecma/bbox/bbox.js new file mode 100644 index 00000000..2d692694 --- /dev/null +++ b/ksvg/test/ecma/bbox/bbox.js @@ -0,0 +1,103 @@ +function clear_test(evt, number) +{ + for(var i = 0; i < number; i++) + { + var element = evt.target.getOwnerDocument().getElementById("bbox" + (i + 1)); + element.getParentNode().removeChild(element); + } +} + +function bbox_loop(drawit, number) +{ + var doc = evt.target.getOwnerDocument(); + + for(var i = 0; i < number; i++) + { + var shape = doc.getElementById("test-" + i); + var bbox = shape.getBBox(); + + if(drawit == "true") + { + draw_it(doc, bbox, shape, i + 1); + } + else + { + do_string(bbox, i + 1); + } + } +} + +function do_string(shape, number) +{ + var string = "\nShape " + number + "\nX = " + shape.x + "\nY = " + shape.y + "\nW = " + shape.width + "\nH = " + shape.height; + alert(string); +} + +function draw_it(doc, bbox, shape, number) +{ + var element = doc.createElement("rect"); + element.setAttribute("x", bbox.x); + element.setAttribute("y", bbox.y); + element.setAttribute("width", bbox.width); + element.setAttribute("height", bbox.height); + element.setAttribute("fill", "none"); + element.setAttribute("stroke", "red"); + element.setAttribute("stroke-width", "3"); + element.setAttribute("id", "bbox" + number); + + shape.getParentNode().appendChild(element); +} + +function gen_buttons(evt, number) +{ + var doc = evt.target.getOwnerDocument(); + var main = doc.getElementById("svg-root"); + + var aone = doc.createElement("a"); + var atwo = doc.createElement("a"); + var athree = doc.createElement("a"); + + var rect = doc.createElement("rect"); + var text = doc.createElement("text"); + + aone.setAttribute("onclick", "bbox_loop('false'," + number + ")"); + + atwo.setAttribute("onclick", "bbox_loop('true'," + number + ")"); + atwo.setAttribute("transform", "translate(0,22)"); + + athree.setAttribute("onclick", "clear_test(evt," + number + ")"); + athree.setAttribute("transform", "translate(0,44)"); + + rect.setAttribute("x", "0"); + rect.setAttribute("y", "0"); + rect.setAttribute("width", "110"); + rect.setAttribute("height", "20"); + + text.setAttribute("x", "0"); + text.setAttribute("y", "15"); + text.setAttribute("fill", "white"); + + // First button + aone.appendChild(rect.cloneNode(1)); + var aonetext = text.cloneNode(1); + aonetext.appendChild(doc.createTextNode("Calculate bbox")); + aone.appendChild(aonetext); + + main.appendChild(aone); + + // Second button + atwo.appendChild(rect.cloneNode(1)); + var atwotext = text.cloneNode(1); + atwotext.appendChild(doc.createTextNode("Draw bbox")); + atwo.appendChild(atwotext); + + main.appendChild(atwo); + + // Third button + athree.appendChild(rect.cloneNode(1)); + var athreetext = text.cloneNode(1); + athreetext.appendChild(doc.createTextNode("Clear bbox drawing")); + athree.appendChild(athreetext); + + main.appendChild(athree); +} -- cgit v1.2.1