~zorba-coders/zorba/bug-874679-image-module

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Matthias Brantner
  • Date: 2012-04-12 12:51:54 UTC
  • mfrom: (45.1.1 image)
  • Revision ID: tarmac-20120412125154-cyzdz8far9a3r49c
fix for bug #978722 (change annotation prefix from "ann" to "an") Approved: William Candillon, Matthias Brantner

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
import module namespace man = 'http://www.zorba-xquery.com/modules/image/manipulation';
9
9
import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';
10
10
 
11
 
declare namespace ann = "http://www.zorba-xquery.com/annotations";
 
11
declare namespace an = "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
 
40
40
(:~
41
41
 : @return true if the man:resize function works.
42
42
 :)
43
 
declare %ann:nondeterministic function local:test-resize() as xs:boolean {
 
43
declare %an:nondeterministic function local:test-resize() as xs:boolean {
44
44
    let $resized := man:resize($local:gif, xs:unsignedInt(500), xs:unsignedInt(600))
45
45
    let $resized-ref as xs:base64Binary := file:read-binary(concat($local:image-dir, "manipulation/bigBird.gif"))
46
46
    return basic:equals($resized, $resized-ref)
51
51
(:~
52
52
 : @return true if the man:zoom function works.
53
53
 :)
54
 
declare %ann:nondeterministic function local:test-zoom() as xs:boolean {
 
54
declare %an:nondeterministic function local:test-zoom() as xs:boolean {
55
55
    let $zoomed := man:zoom($local:jpg, 2)
56
56
    let $ref-zoomed := file:read-binary(concat($local:image-dir, "manipulation/zoomedBird.jpg"))
57
57
    return basic:equals($zoomed, $ref-zoomed)
63
63
(:~
64
64
 : @return true if the man:zoom-by-width function works.
65
65
 :)
66
 
declare %ann:nondeterministic function local:test-zoom-by-width() as xs:boolean {
 
66
declare %an:nondeterministic function local:test-zoom-by-width() as xs:boolean {
67
67
    let $zoomed := man:zoom-by-width($local:jpg, xs:unsignedInt(268))
68
68
    let $ref-zoomed := file:read-binary(concat($local:image-dir, "manipulation/zoomedBird.jpg"))
69
69
    return basic:equals($zoomed, $ref-zoomed)
72
72
(:~
73
73
 : @return true if the man:zoom-by-height function works.
74
74
 :)
75
 
declare %ann:nondeterministic function local:test-zoom-by-height() as xs:boolean {
 
75
declare %an:nondeterministic function local:test-zoom-by-height() as xs:boolean {
76
76
    let $zoomed := man:zoom-by-height($local:jpg, xs:unsignedInt(320))
77
77
    let $ref-zoomed := file:read-binary(concat($local:image-dir, "manipulation/zoomedBird.jpg"))
78
78
    return basic:equals($zoomed, $ref-zoomed)
81
81
(:~
82
82
 : @return true if the man:sub-image function works.
83
83
 :)
84
 
declare %ann:nondeterministic function local:test-sub-image() as xs:boolean {
 
84
declare %an:nondeterministic function local:test-sub-image() as xs:boolean {
85
85
    let $sub := man:sub-image($local:jpg, xs:unsignedInt(20), xs:unsignedInt(20), xs:unsignedInt(200), xs:unsignedInt(30))
86
86
    let $ref-sub := file:read-binary(concat($local:image-dir, "manipulation/subBird.jpg"))
87
87
    return basic:equals($sub, $ref-sub)
90
90
(:~
91
91
 : @return true if the man:overlay function works.
92
92
 :)
93
 
declare %ann:nondeterministic function local:test-overlay() {
 
93
declare %an:nondeterministic function local:test-overlay() {
94
94
    let $ref-overlay:= file:read-binary(concat($local:image-dir, "manipulation/overlayBird.jpg"))
95
95
    let $ref-zoomed := file:read-binary(concat($local:image-dir, "manipulation/zoomedBird.jpg"))
96
96
    return basic:equals(man:overlay($ref-zoomed, $local:png, xs:unsignedInt(50), xs:unsignedInt(50), 
100
100
 
101
101
 
102
102
 
103
 
declare %ann:nondeterministic %ann:sequential function local:main() as xs:string* {
 
103
declare %an:nondeterministic %an:sequential function local:main() as xs:string* {
104
104
 
105
105
  let $a := local:test-resize()
106
106
  return