diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/__init__.py | 0 | ||||
| -rw-r--r-- | tests/data/refs/imagemap__--maptype__HTML__intersect__svg.out | 2 | ||||
| -rw-r--r-- | tests/data/refs/imagemap__--maptype__HTML__overlap__svg.out | 4 | ||||
| -rw-r--r-- | tests/data/refs/imagemap__--maptype__HTML__rect__svg.out | 1 | ||||
| -rw-r--r-- | tests/data/refs/imagemap__--maptype__HTML__rounding__svg.out | 1 | ||||
| -rw-r--r-- | tests/data/refs/imagemap__--maptype__HTML__viewbox__svg.out | 1 | ||||
| -rw-r--r-- | tests/data/svg/intersect.svg | 5 | ||||
| -rw-r--r-- | tests/data/svg/overlap.svg | 8 | ||||
| -rw-r--r-- | tests/data/svg/rect.svg | 5 | ||||
| -rw-r--r-- | tests/data/svg/rounding.svg | 5 | ||||
| -rw-r--r-- | tests/data/svg/text.svg | 14 | ||||
| -rw-r--r-- | tests/data/svg/viewbox.svg | 5 | ||||
| -rw-r--r-- | tests/test_imagemap_comparison.py | 17 |
13 files changed, 68 insertions, 0 deletions
diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/__init__.py diff --git a/tests/data/refs/imagemap__--maptype__HTML__intersect__svg.out b/tests/data/refs/imagemap__--maptype__HTML__intersect__svg.out new file mode 100644 index 0000000..cab9492 --- /dev/null +++ b/tests/data/refs/imagemap__--maptype__HTML__intersect__svg.out @@ -0,0 +1,2 @@ +<area shape=poly coords=60,40,60,60,40,60,40,80,80,80,80,40 href=http://example.com> +<area shape=poly coords=20,20,20,60,40,60,40,40,60,40,60,20 href=http://example.com> diff --git a/tests/data/refs/imagemap__--maptype__HTML__overlap__svg.out b/tests/data/refs/imagemap__--maptype__HTML__overlap__svg.out new file mode 100644 index 0000000..8f8d95d --- /dev/null +++ b/tests/data/refs/imagemap__--maptype__HTML__overlap__svg.out @@ -0,0 +1,4 @@ +<area shape=poly coords=30,40,30,70,60,70,60,60,40,60,40,40 href=http://example.com/1> +<area shape=poly coords=30,10,30,30,40,30,40,20,80,20,80,60,70,60,70,70,90,70,90,10 href=http://example.com/1> +<area shape=rect coords=20,40,60,80> +<area shape=rect coords=10,30,70,90 href=http://example.com/2> diff --git a/tests/data/refs/imagemap__--maptype__HTML__rect__svg.out b/tests/data/refs/imagemap__--maptype__HTML__rect__svg.out new file mode 100644 index 0000000..9399c1c --- /dev/null +++ b/tests/data/refs/imagemap__--maptype__HTML__rect__svg.out @@ -0,0 +1 @@ +<area shape=rect coords=25,25,75,75 href=http://example.com> diff --git a/tests/data/refs/imagemap__--maptype__HTML__rounding__svg.out b/tests/data/refs/imagemap__--maptype__HTML__rounding__svg.out new file mode 100644 index 0000000..0fc648a --- /dev/null +++ b/tests/data/refs/imagemap__--maptype__HTML__rounding__svg.out @@ -0,0 +1 @@ +<area shape=poly coords=50,25,25,75,75,75 href=http://example.com> diff --git a/tests/data/refs/imagemap__--maptype__HTML__viewbox__svg.out b/tests/data/refs/imagemap__--maptype__HTML__viewbox__svg.out new file mode 100644 index 0000000..0fc648a --- /dev/null +++ b/tests/data/refs/imagemap__--maptype__HTML__viewbox__svg.out @@ -0,0 +1 @@ +<area shape=poly coords=50,25,25,75,75,75 href=http://example.com> diff --git a/tests/data/svg/intersect.svg b/tests/data/svg/intersect.svg new file mode 100644 index 0000000..5f07634 --- /dev/null +++ b/tests/data/svg/intersect.svg @@ -0,0 +1,5 @@ +<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <a xlink:href="http://example.com"> + <path d="M20 20 60 20 60 60 20 60ZM40 40 40 80 80 80 80 40Z"/> + </a> +</svg> diff --git a/tests/data/svg/overlap.svg b/tests/data/svg/overlap.svg new file mode 100644 index 0000000..7a3e7aa --- /dev/null +++ b/tests/data/svg/overlap.svg @@ -0,0 +1,8 @@ +<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" stroke-width="10" fill="none"> + <a xlink:href="http://example.com/1"> + <rect x="35" y="15" width="50" height="50" stroke="red"/> + </a> + <a xlink:href="http://example.com/2"> + <rect x="15" y="35" width="50" height="50" stroke="blue"/> + </a> +</svg> diff --git a/tests/data/svg/rect.svg b/tests/data/svg/rect.svg new file mode 100644 index 0000000..445e6e0 --- /dev/null +++ b/tests/data/svg/rect.svg @@ -0,0 +1,5 @@ +<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <a xlink:href="http://example.com"> + <rect x="25" y="25" width="50" height="50"/> + </a> +</svg> diff --git a/tests/data/svg/rounding.svg b/tests/data/svg/rounding.svg new file mode 100644 index 0000000..e3f98e6 --- /dev/null +++ b/tests/data/svg/rounding.svg @@ -0,0 +1,5 @@ +<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <a xlink:href="http://example.com"> + <polyline points="50.3,24.6 74.8,75.4 25.2,75.01"/> + </a> +</svg> diff --git a/tests/data/svg/text.svg b/tests/data/svg/text.svg new file mode 100644 index 0000000..6b0a130 --- /dev/null +++ b/tests/data/svg/text.svg @@ -0,0 +1,14 @@ +<svg width="300" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <a xlink:href="http://example.com/1"> + <ellipse cx="75" cy="50" rx="60" ry="30"/> + <text x="75" y="50" fill="#fff" text-anchor="middle" font-size="16">A</text> + </a> + <a xlink:href="http://example.com/2"> + <ellipse cx="225" cy="50" rx="60" ry="30"/> + <text x="225" y="50" fill="#fff" text-anchor="middle" font-size="16">B</text> + </a> + <a xlink:href="http://example.com/1"> + <ellipse cx="150" cy="150" rx="60" ry="30"/> + <text x="150" y="150" fill="#fff" text-anchor="middle" font-size="16">C</text> + </a> +</svg> diff --git a/tests/data/svg/viewbox.svg b/tests/data/svg/viewbox.svg new file mode 100644 index 0000000..a0cdc1d --- /dev/null +++ b/tests/data/svg/viewbox.svg @@ -0,0 +1,5 @@ +<svg width="100" height="100" viewBox="-100 -100 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <a xlink:href="http://example.com"> + <polyline points="0,-50 50,50 -50,50"/> + </a> +</svg> diff --git a/tests/test_imagemap_comparison.py b/tests/test_imagemap_comparison.py new file mode 100644 index 0000000..302162c --- /dev/null +++ b/tests/test_imagemap_comparison.py @@ -0,0 +1,17 @@ +from inkex.tester import ComparisonMixin, TestCase +from imagemap import ImageMap + +class ImageMapComparisonTest(ComparisonMixin, TestCase): + effect_class = ImageMap + compare_file = ( + 'svg/intersect.svg', + 'svg/overlap.svg', + 'svg/rect.svg', + 'svg/rounding.svg', + 'svg/text.svg', + 'svg/viewbox.svg' + ) + comparisons=[('--maptype=HTML',)] + compare_file_extension='map' + def _base_compare(self, data_a, data_b, compare_mode): + self.assertEqual(data_a, data_b) |
