summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2019-06-14 16:46:21 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2019-06-14 16:46:21 (GMT)
commit972db41befadc17a6d88853f55720ac0f172582b (patch)
tree85e1c42146d51a2347239b7b0913be0e92001f9b /tests
parentdc8652e4584c5d38db87555343e97c675a3caa27 (diff)
downloadtk-972db41befadc17a6d88853f55720ac0f172582b.zip
tk-972db41befadc17a6d88853f55720ac0f172582b.tar.gz
tk-972db41befadc17a6d88853f55720ac0f172582b.tar.bz2
Tests for svg file
Diffstat (limited to 'tests')
-rw-r--r--tests/imgSVGnano.test61
1 files changed, 60 insertions, 1 deletions
diff --git a/tests/imgSVGnano.test b/tests/imgSVGnano.test
index a3bdcbf..1f1c8c1 100644
--- a/tests/imgSVGnano.test
+++ b/tests/imgSVGnano.test
@@ -27,6 +27,9 @@ namespace eval svgnano {
">
</svg>}
+ tcltest::makeFile $data(plus) plus.svg
+ set data(plusFilePath) [file join [tcltest::configure -tmpdir] plus.svg]
+
test imgSVGnano-1.1 {reading simple image} -setup {
catch {rename foo ""}
} -body {
@@ -67,7 +70,6 @@ test imgSVGnano-1.4 {image options} -setup {
rename foo ""
} -result {100 100}
-
test imgSVGnano-2.1 {reading a bad image} -body {
image create photo foo -format svg -data $data(bad)
} -returnCodes error -result {couldn't recognize image data}
@@ -136,6 +138,63 @@ test imgSVGnano-3.9 {Very small scale gives 1x1 image} -body {
rename foo ""
} -result {1 1}
+test imgSVGnano-3.10 {change from -scaletoheight to -scale} -body {
+ set res {}
+ image create photo foo -format "svg -scaletoheight 16"\
+ -data $data(plus)
+ lappend res [image width foo] [image height foo]
+ foo configure -format "svg -scale 2"
+ lappend res [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+ unset res
+} -result {16 16 200 200}
+
+# svg file access
+test imgSVGnano-4.1 {reading simple image from file} -setup {
+ catch {rename foo ""}
+} -body {
+ image create photo foo -file $data(plusFilePath)
+ list [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+} -result {100 100}
+
+test imgSVGnano-4.2 {simple image with options} -setup {
+ catch {rename foo ""}
+} -body {
+ image create photo foo -file $data(plusFilePath) -format {svg -dpi 100 -scale 3}
+ list [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+} -result {300 300}
+
+test imgSVGnano-4.3 {reread file on configure -scale} -setup {
+ catch {rename foo ""}
+ set res {}
+} -body {
+ image create photo foo -file $data(plusFilePath)
+ lappend res [image width foo] [image height foo]
+ foo configure -format "svg -scale 2"
+ lappend res [image width foo] [image height foo]
+} -cleanup {
+ rename foo ""
+ unset res
+} -result {100 100 200 200}
+
+
+test imgSVGnano-4.4 {error on file not accessible on reread due to configure} -setup {
+ catch {rename foo ""}
+ tcltest::makeFile $data(plus) tmpplus.svg
+ image create photo foo -file [file join [tcltest::configure -tmpdir] tmpplus.svg]
+ tcltest::removeFile tmpplus.svg
+} -body {
+ foo configure -format "svg -scale 2"
+} -cleanup {
+ rename foo ""
+ tcltest::removeFile tmpplus.svg
+} -returnCodes error -match glob -result {couldn't open "*/tmpplus.svg": no such file or directory}
+
};# end of namespace svgnano
namespace delete svgnano