~zorba-coders/zorba/bug-1158052-image

« back to all changes in this revision

Viewing changes to test/Queries/image/paint_2.xq

  • Committer: mbrantner
  • Date: 2011-08-07 00:38:36 UTC
  • Revision ID: svn-v4:8046edc3-af21-0410-8661-ec7318497eea:modules/image/trunk:11598
unqualified schema for image modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';
7
7
import module namespace file = 'http://expath.org/ns/file';
8
8
import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';
9
 
import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';
 
9
import schema namespace img = 'http://www.zorba-xquery.com/modules/image/image';
10
10
 
11
11
declare namespace ann = "http://www.zorba-xquery.com/annotations";
12
12
 
13
13
declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
14
14
 
15
15
 
16
 
declare variable $local:gif as xs:base64Binary := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), image:imageFormat("GIF"));
 
16
declare variable $local:gif as xs:base64Binary := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), img:imageFormat("GIF"));
17
17
 
18
18
 
19
19
(:~
37
37
 
38
38
declare %ann:nondeterministic function local:test-draw-poly-line() as xs:boolean 
39
39
{
40
 
  let $draw := paint:paint($local:gif, <image:polyLine><point><x>10</x><y>10</y></point><point><x>40</x><y>80</y></point><point><x>50</x><y>30</y></point><point><x>200</x><y>200</y></point></image:polyLine>)
 
40
  let $draw := paint:paint($local:gif, <img:polyLine><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point><img:point><img:x>200</img:x><img:y>200</img:y></img:point></img:polyLine>)
41
41
  let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLine.gif"))
42
42
  return basic:equals($draw, $draw-ref)
43
43
};
44
44
 
45
45
declare %ann:nondeterministic function local:test-draw-poly-line-anti-aliased() as xs:boolean
46
46
{
47
 
  let $draw := paint:paint($local:gif, <image:polyLine><antiAliasing>true</antiAliasing><point><x>10</x><y>10</y></point><point><x>40</x><y>80</y></point><point><x>50</x><y>30</y></point></image:polyLine>)
 
47
  let $draw := paint:paint($local:gif, <img:polyLine><img:antiAliasing>true</img:antiAliasing><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point></img:polyLine>)
48
48
  let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineAntiAliased.gif"))
49
49
  return basic:equals($draw,  $draw-ref)
50
50
};
55
55
 :)
56
56
declare %ann:nondeterministic function local:test-draw-poly-line-red() as xs:boolean 
57
57
{
58
 
    let $draw := paint:paint($local:gif, <image:polyLine><strokeColor>#FF0000</strokeColor><antiAliasing>true</antiAliasing><point><x>10</x><y>10</y></point><point><x>40</x><y>80</y></point><point><x>50</x><y>30</y></point></image:polyLine>)
 
58
    let $draw := paint:paint($local:gif, <img:polyLine><img:strokeColor>#FF0000</img:strokeColor><img:antiAliasing>true</img:antiAliasing><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point></img:polyLine>)
59
59
    
60
60
    let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineRed.gif"))
61
61
    return basic:equals($draw, $draw-ref)
66
66
 : @return true if the man:draw-poly-line function works.
67
67
 :)
68
68
declare %ann:nondeterministic function local:test-draw-poly-line-wide() as xs:boolean {
69
 
     let $draw := paint:paint($local:gif, <image:polyLine><strokeWidth>5</strokeWidth><antiAliasing>true</antiAliasing><point><x>10</x><y>10</y></point><point><x>40</x><y>80</y></point><point><x>50</x><y>30</y></point></image:polyLine>)
 
69
     let $draw := paint:paint($local:gif, <img:polyLine><img:strokeWidth>5</img:strokeWidth><img:antiAliasing>true</img:antiAliasing><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point></img:polyLine>)
70
70
    
71
71
    let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineWide.gif"))
72
72
    return basic:equals($draw, $draw-ref)