From: Michael Orlitzky Date: Thu, 16 Nov 2023 15:55:11 +0000 (-0500) Subject: test/css: add some visually-verified test cases for our new features X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;ds=sidebyside;h=bf0a5015ded255baf512e96a857947e55cee9728;p=libsvgtiny.git test/css: add some visually-verified test cases for our new features It's helpful to have some test cases for our CSS handling, but unfortunately, it's not all that easy to write them. How should we compare the actual output to the expected output? For now we settle for a visual comparison. You can render the test diagrams using the example program examples/svgtiny_display_x11, and also open them in another SVG viewer. Do they look the same? Great. The test cases should be simple enough that _subtle_ visual mismatches are not possible. Automating this is not an impossible problem: for example, we could render the parsed diagram to a bitmap image using cairo and then compare it to what we get using librsvg which is also cairo-based. But that has downsides too (like the portability of librsvg) that we don't want to address right now. --- diff --git a/test/css/README b/test/css/README new file mode 100644 index 0000000..fd429d3 --- /dev/null +++ b/test/css/README @@ -0,0 +1,11 @@ +The SVG files in this directory are used to verify that certain CSS +constructs are processed properly. These "tests" are un-automated; you +have to view each diagram with the example program svgtiny_display_x11 +to see if they are rendered correctly. + +What is "correctly?" + +Each test should be simple enough that the correct behavior is not to +hard for someone familiar with CSS to deduce. Hints may be given in +the comment at the top of the file. Or, maybe you just open the same +file in firefox and look at them side-by-side. diff --git a/test/css/attributes.svg b/test/css/attributes.svg new file mode 100644 index 0000000..3e008e8 --- /dev/null +++ b/test/css/attributes.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/test/css/case-sensitive-elements.svg b/test/css/case-sensitive-elements.svg new file mode 100644 index 0000000..f5c9986 --- /dev/null +++ b/test/css/case-sensitive-elements.svg @@ -0,0 +1,19 @@ + + + + + + diff --git a/test/css/empty-pseudo-class.svg b/test/css/empty-pseudo-class.svg new file mode 100644 index 0000000..ebe3c28 --- /dev/null +++ b/test/css/empty-pseudo-class.svg @@ -0,0 +1,33 @@ + + + + + + + + + + I'm a rectangle. + + + diff --git a/test/css/id-and-class.svg b/test/css/id-and-class.svg new file mode 100644 index 0000000..be5a9d7 --- /dev/null +++ b/test/css/id-and-class.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + diff --git a/test/css/inherit.svg b/test/css/inherit.svg new file mode 100644 index 0000000..8ab3c1f --- /dev/null +++ b/test/css/inherit.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + diff --git a/test/css/inline.svg b/test/css/inline.svg new file mode 100644 index 0000000..7c84b62 --- /dev/null +++ b/test/css/inline.svg @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/test/css/lang.svg b/test/css/lang.svg new file mode 100644 index 0000000..4ca92de --- /dev/null +++ b/test/css/lang.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + diff --git a/test/css/link-pseudo-class.svg b/test/css/link-pseudo-class.svg new file mode 100644 index 0000000..d9b6edf --- /dev/null +++ b/test/css/link-pseudo-class.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/test/css/node-name.svg b/test/css/node-name.svg new file mode 100644 index 0000000..5a3e282 --- /dev/null +++ b/test/css/node-name.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + diff --git a/test/css/nth-child.svg b/test/css/nth-child.svg new file mode 100644 index 0000000..137298e --- /dev/null +++ b/test/css/nth-child.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + diff --git a/test/css/root.svg b/test/css/root.svg new file mode 100644 index 0000000..dd20d98 --- /dev/null +++ b/test/css/root.svg @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/test/css/siblings-and-descendants.svg b/test/css/siblings-and-descendants.svg new file mode 100644 index 0000000..272ddc4 --- /dev/null +++ b/test/css/siblings-and-descendants.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/test/css/styles-at-end.svg b/test/css/styles-at-end.svg new file mode 100644 index 0000000..540bba0 --- /dev/null +++ b/test/css/styles-at-end.svg @@ -0,0 +1,29 @@ + + + + + + + + + +