Running 'testanimate.R' [178s]
  Running 'testattrib.R' [174s]
  Running 'testball.R' [3s]
  Running 'testclasses.R' [174s]
  Running 'testclippath.R' [1s]
  Running 'testcomment.R' [1s]
  Running 'testelement.R' [158s]
  Running 'testfilter.R' [151s]
  Running 'testforce.R' [1s]
  Running 'testgradientfill.R' [157s]
  Running 'testgrid.R' [1s]
  Running 'testid.R' [1s]
  Running 'testlink.R' [173s]
  Running 'testmask.R' [1s]
  Running 'testpath.R' [1s]
  Running 'testpatternfill.R' [173s]
  Running 'testpendulum.R' [158s]
  Running 'testplot.R' [147s]
  Running 'testplotmath.R' [7s]
  Running 'testpolyline.R' [1s]
  Running 'testprefix.R' [1s]
  Running 'testrotate.R' [7s]
  Running 'testsvg.R' [1s]
  Running 'testtransparency.R' [1s]
  Running 'testvp.R' [173s]
Running the tests in 'tests/testanimate.R' failed.
Complete output:
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > # animValues
  > 
  > animValue(letters[1:4])
  $t1
  [1] "a"
  
  $t2
  [1] "b"
  
  $t3
  [1] "c"
  
  $t4
  [1] "d"
  
  > animValue(letters[1:4], timeid=rep(1:2, 2))
  $t1
  [1] "a" "c"
  
  $t2
  [1] "b" "d"
  
  > animValue(letters[1:4], id=rep(1:2, 2))
  $id1
  $id1$t1
  [1] "a"
  
  $id1$t2
  [1] "c"
  
  
  $id2
  $id2$t1
  [1] "b"
  
  $id2$t2
  [1] "d"
  
  
  > 
  > as.animValue(letters[1:4])
  $t1
  [1] "a"
  
  $t2
  [1] "b"
  
  $t3
  [1] "c"
  
  $t4
  [1] "d"
  
  > as.animValue(matrix(letters[1:12], ncol=4))
  $id1
  $id1$t1
  [1] "a"
  
  $id1$t2
  [1] "b"
  
  $id1$t3
  [1] "c"
  
  
  $id2
  $id2$t1
  [1] "d"
  
  $id2$t2
  [1] "e"
  
  $id2$t3
  [1] "f"
  
  
  $id3
  $id3$t1
  [1] "g"
  
  $id3$t2
  [1] "h"
  
  $id3$t3
  [1] "i"
  
  
  $id4
  $id4$t1
  [1] "j"
  
  $id4$t2
  [1] "k"
  
  $id4$t3
  [1] "l"
  
  
  > as.animValue(matrix(letters[1:12], ncol=4), multVal=TRUE)
  $t1
  [1] "a" "b" "c"
  
  $t2
  [1] "d" "e" "f"
  
  $t3
  [1] "g" "h" "i"
  
  $t4
  [1] "j" "k" "l"
  
  > as.animValue(list(letters[1:3], letters[4:6]))
  $id1
  $id1$t1
  [1] "a"
  
  $id1$t2
  [1] "b"
  
  $id1$t3
  [1] "c"
  
  
  $id2
  $id2$t1
  [1] "d"
  
  $id2$t2
  [1] "e"
  
  $id2$t3
  [1] "f"
  
  
  > as.animValue(list(letters[1:3], letters[4:6]), multVal=TRUE)
  $t1
  [1] "a" "b" "c"
  
  $t2
  [1] "d" "e" "f"
  
  > 
  > # animUnits
  > 
  > animUnit(unit(1:4, "npc"))
  $t1
  [1] 1npc
  
  $t2
  [1] 2npc
  
  $t3
  [1] 3npc
  
  $t4
  [1] 4npc
  
  > animUnit(unit(1:4, "npc"), timeid=rep(1:2, 2))
  $t1
  [1] 1npc 3npc
  
  $t2
  [1] 2npc 4npc
  
  > animUnit(unit(1:4, "npc"), id=rep(1:2, 2))
  $id1
  $id1$t1
  [1] 1npc
  
  $id1$t2
  [1] 3npc
  
  
  $id2
  $id2$t1
  [1] 2npc
  
  $id2$t2
  [1] 4npc
  
  
  > 
  > as.animUnit(1:4, "npc")
  $t1
  [1] 1npc
  
  $t2
  [1] 2npc
  
  $t3
  [1] 3npc
  
  $t4
  [1] 4npc
  
  > as.animUnit(unit(1:4, "npc"))
  $t1
  [1] 1npc
  
  $t2
  [1] 2npc
  
  $t3
  [1] 3npc
  
  $t4
  [1] 4npc
  
  > as.animUnit(matrix(1:12, ncol=4), "in")
  $id1
  $id1$t1
  [1] 1inches
  
  $id1$t2
  [1] 2inches
  
  $id1$t3
  [1] 3inches
  
  
  $id2
  $id2$t1
  [1] 4inches
  
  $id2$t2
  [1] 5inches
  
  $id2$t3
  [1] 6inches
  
  
  $id3
  $id3$t1
  [1] 7inches
  
  $id3$t2
  [1] 8inches
  
  $id3$t3
  [1] 9inches
  
  
  $id4
  $id4$t1
  [1] 10inches
  
  $id4$t2
  [1] 11inches
  
  $id4$t3
  [1] 12inches
  
  
  > as.animUnit(matrix(1:12, ncol=4), "in", multVal=TRUE)
  $t1
  [1] 1inches 2inches 3inches
  
  $t2
  [1] 4inches 5inches 6inches
  
  $t3
  [1] 7inches 8inches 9inches
  
  $t4
  [1] 10inches 11inches 12inches
  
  > as.animUnit(list(unit(1:3, "npc"), unit(4:6, "in")))
  $id1
  $id1$t1
  [1] 1npc
  
  $id1$t2
  [1] 2npc
  
  $id1$t3
  [1] 3npc
  
  
  $id2
  $id2$t1
  [1] 4inches
  
  $id2$t2
  [1] 5inches
  
  $id2$t3
  [1] 6inches
  
  
  > as.animUnit(list(unit(1:3, "npc"), unit(4:6, "in")), multVal=TRUE)
  $t1
  [1] 1npc 2npc 3npc
  
  $t2
  [1] 4inches 5inches 6inches
  
  > 
  > # Some default settings
  > pushViewport(viewport(gp=gpar(col="black", fill=NA)))
  > 
  > grid.rect(name="rect",
  +           x=0,
  +           y=0,
  +           just=c("left", "bottom"))
  > grid.animate("rect", x=unit(0:30, "mm"), duration=5, rep=TRUE)
  > grid.circle(name="circle",
  +             x=unit(0.5, "npc") + unit(0, "mm"),
  +             r=unit(10, "mm"))
  > grid.animate("circle", x=unit(0.5, "npc") + unit(0:30, "mm"),
  +              duration=5, rep=TRUE)
  > grid.text("hello", name="text1",
  +           x=unit(0.3, "npc") + unit(0, "mm"))
  > grid.animate("text1",
  +              x=unit(0.3, "npc") + unit(0:30, "mm"),
  +              duration=5, rep=TRUE)
  > grid.text("hello", name="text2",
  +           x=unit(0.3, "npc") + unit(0, "mm"),
  +           y=unit(0.3, "npc") + unit(0, "mm"))
  > grid.animate("text2",
  +              x=unit(0.3, "npc") + unit(0:30, "mm"),
  +              y=unit(0.3, "npc") + unit(0:30, "mm"),
  +              duration=5, rep=TRUE)
  > 
  > popViewport()
  > 
  > grid.export("animate.svg")
  > 
  > 
  > # Animating rectangles
  > 
  > # There are numerous possibilities to consider:
  > #   The animation values could be numeric, unit, matrix, or list
  > #   The original values could spec a single rect or multiple rects
  > #   We could animate only one of x/y/width/height or several of them at once
  > 
  > # Simple case
  > # (single rect, anim only x, anim values are just numeric)
  > grid.newpage()
  > grid.text("One rectangle moves across",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.rect(x=.2, y=.2, width=.1, height=.1, name="rect")
  > grid.animate("rect", x=c(.2, .8), duration=3)
  > grid.export("anim-rect-simple.svg")
  > 
  > # Complex case
  > # (multiple rects, anim x/y/width/height, anim values are matrices and lists)
  > grid.newpage()
  > grid.text("Three rectangles: one goes up, one goes across, and
  + one goes diagonal and gets smaller",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.rect(x=rep(.2, 3), y=.2, width=.1, height=.1, name="rect")
  > grid.animate("rect",
  +              x=cbind(c(.2, .8), c(.2, .8), .2),
  +              y=cbind(.2, c(.2, .8), c(.2, .8)),
  +              width=list(unit(.1, "npc"),
  +                unit(c(.1, 1), c("npc", "cm")),
  +                unit(.1, "npc")),
  +              height=list(unit(.1, "npc"),
  +                unit(c(.1, 1), c("npc", "cm")),
  +                unit(.1, "npc")),             
  +              duration=3)
  > grid.export("anim-rect-complex.svg")
  > 
  > # Animating circles
  > 
  > # Complex case
  > # (multiple circles, anim x/y/width/height, anim values are matrices and lists)
  > grid.newpage()
  > grid.text("Three circles: one goes up, one goes across, and
  + one goes diagonal and gets smaller",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.circle(x=rep(.2, 3), y=.2, r=.1, name="circle")
  > grid.animate("circle",
  +              x=cbind(c(.2, .8), c(.2, .8), .2),
  +              y=cbind(.2, c(.2, .8), c(.2, .8)),
  +              r=list(unit(.1, "npc"),
  +                unit(c(.1, 1), c("npc", "cm")),
  +                unit(.1, "npc")),             
  +              duration=3)
  > grid.export("anim-circle-complex.svg")
  > 
  > # Animating points
  > 
  > # Complex case
  > # (multiple circles, anim x/y/width/height, anim values are matrices and lists)
  > grid.newpage()
  > grid.text("Three points: one goes up, one goes across, and
  + one goes diagonal and gets larger",
  +           y=unit(1, "lines"))
  > grid.rect()
  > pushViewport(viewport())
  > grid.points(x=rep(.2, 3), y=rep(.2, 3), size=unit(2, "mm"), name="points")
  > grid.animate("points",
  +              x=cbind(c(.2, .8), c(.2, .8), .2),
  +              y=cbind(.2, c(.2, .8), c(.2, .8)),
  +              size=list(unit(2, "mm"),
  +                unit(c(2, .1), c("mm", "npc")),
  +                unit(2, "mm")),             
  +              duration=3)
  > grid.export("anim-points-complex.svg")
  > 
  > # Animating text
  > 
  > # Complex case
  > # (multiple text, anim x/y/width/height, anim values are matrices and lists)
  > grid.newpage()
  > grid.text("Three letters:  one goes up, one goes across, and
  + one goes diagonal",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.text(letters[1:3], x=rep(.2, 3), y=.2, name="text")
  > grid.animate("text",
  +              x=cbind(c(.2, .8), c(.2, .8), .2),
  +              y=cbind(.2, c(.2, .8), c(.2, .8)),             
  +              duration=3)
  > grid.export("anim-text-complex.svg")
  > 
  > # Animating lines
  > 
  > # Simple case
  > # (line only has two points, animation only has two points, only animate x)
  > grid.newpage()
  > grid.text("45 degree line becomes vertical",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.lines(c(.1, .9), c(.1, .9), name="lines")
  > grid.animate("lines",
  +              x=cbind(c(.1, .9), c(.5, .5)),
  +              duration=3)
  > grid.export("anim-lines-simple.svg")
  > 
  > # Complex case
  > # (line has many points, animation has three points, only animate y)
  > x <- seq(-pi, pi, length.out=100)
  > y <- sin(x)
  > grid.newpage()
  > grid.text("Sine curve becomes flat then inverts (on y)",
  +           y=unit(1, "lines"))
  > grid.rect()
  > pushViewport(dataViewport(x, y))
  > grid.lines(x, y, default.units="native", name="lines")
  > grid.animate("lines",
  +              y=cbind(y, 0, -y),
  +              duration=3)
  > grid.export("anim-lines-complex.svg")
  > 
  > # Animating polylines
  > 
  > # Simple case
  > # (line only has two points, animation only has two points, only animate x)
  > grid.newpage()
  > grid.text("Two parallel lines slide to the right",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.polyline(c(.1, .2, .3, .4),
  +               c(.1, .9, .1, .9),
  +               id=rep(1:2, each=2), name="polyline")
  > grid.animate("polyline",
  +              x=animUnit(unit(c(.1, .2, .3, .4,
  +                                .5, .6, .7, .8),
  +                              unit="npc"),
  +                            id=rep(rep(1:2, each=2), 2),
  +                            timeid=rep(1:2, each=4)),
  +              duration=3)
  > grid.export("anim-polyline-simple.svg")
  > 
  > # Complex case
  > # (line only has many points, animation only has many points, animate x and y)
  > grid.newpage()
  > grid.text("Two random walks",
  +           y=unit(1, "lines"))
  > grid.rect()
  > n <- 50
  > x <- 1:n
  > set.seed(1000)
  > y1 <- runif(n, .6, .8)
  > y2 <- runif(n, .2, .4)
  > pushViewport(dataViewport(x, yscale=0:1))
  > grid.polyline(rep(x[1:2], 2), c(y1[1:2], y2[1:2]),
  +               default.units="native",
  +               id=rep(1:2, each=2), name="polyline")
  > grid.animate("polyline",
  +              x=animUnit(unit(rep(x[unlist(lapply(2:n, seq))], 2),
  +                              "native"),
  +                         id=rep(1:2, each=sum(2:n)),
  +                         timeid=rep(1:(n - 1), 2:n)),
  +              y=animUnit(unit(c(y1[unlist(lapply(2:n, seq))],
  +                                y2[unlist(lapply(2:n, seq))]),
  +                              "native"),
  +                         id=rep(1:2, each=sum(2:n)),
  +                         timeid=rep(1:(n - 1), 2:n)),
  +              duration=10)
  > grid.export("anim-polyline-complex.svg")
  > 
  > # Animating segments
  > 
  > # Simple case
  > # (single segment, animation only has two values, only animate x0)
  > grid.newpage()
  > grid.text("45 degree line becomes vertical (on right)",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.segments(.1, .1, .9, .9, name="segments")
  > grid.animate("segments",
  +              x0=c(.1, .9),
  +              duration=3)
  > grid.export("anim-segments-simple.svg")
  > 
  > # Complex case
  > # (multiple segments, animation has three values, animate x0 and y0)
  > grid.newpage()
  > grid.text("crossed lines swing out to vertical then shorten",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.segments(c(.1, .9), .1, c(.9, .1), .9, name="segments")
  > grid.animate("segments",
  +              x0=cbind(c(.1, .9, .9), c(.9, .1, .1)),
  +              y0=c(.1, .1, .5),
  +              duration=3)
  > grid.export("anim-segments-complex.svg")
  > 
  > # Animating polygons
  > 
  > # Simple case
  > # (polygon only has three points,
  > #  animation only has two points, only animate x)
  > grid.newpage()
  > grid.text("Single polygon slides to the right",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.polygon(c(.1, .2, .3),
  +               c(.4, .6, .4), name="polygon")
  > grid.animate("polygon",
  +              x=animUnit(unit(c(.1, .2, .3,
  +                                .7, .8, .9),
  +                              unit="npc"),
  +                         timeid=rep(1:2, each=3)),
  +              duration=3)
  > grid.export("anim-polygon-simple.svg")
  > 
  > # Complex case
  > # (two polygons, animation has many points, animate x and y)
  > grid.newpage()
  > grid.text("Two polygons shrink and grow (flipped) then revert",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.polygon(c(.2, .3, .4,
  +                .6, .7, .8),
  +              c(.4, .6, .4, .6, .4, .6),
  +              id=rep(1:2, each=3), name="polygon")
  > grid.animate("polygon",
  +              x=animUnit(unit(c(.2, .3, .4,
  +                                .4, .3, .2,
  +                                .2, .3, .4,
  +  
  +                                .6, .7, .8,
  +                                .8, .7, .6,
  +                                .6, .7, .8),
  +                              "npc"),
  +                         id=rep(1:2, each=9),
  +                         timeid=rep(rep(1:3, each=3), 2)),
  +              y=animUnit(unit(c(.4, .6, .4,
  +                                .6, .4, .6,
  +                                .4, .6, .4,
  +                                
  +                                .6, .4, .6,
  +                                .4, .6, .4,
  +                                .6, .4, .6),
  +                              "npc"),
  +                         id=rep(1:2, each=9),
  +                         timeid=rep(rep(1:3, each=3), 2)),
  +              duration=5)
  > grid.export("anim-polygon-complex.svg")
  > 
  > # Animating paths
  > 
  > # Simple case
  > # (path has one sub-path,
  > #  animation only has two points, only animate x)
  > grid.newpage()
  > grid.text("Single simple path (triangle) slides to the right",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.path(c(.1, .2, .3),
  +           c(.4, .6, .4),
  +           gp=gpar(fill="black"),
  +           name="path")
  > grid.animate("path",
  +              x=animUnit(unit(c(.1, .2, .3,
  +                                .7, .8, .9),
  +                              unit="npc"),
  +                         timeid=rep(1:2, each=3)),
  +              duration=3)
  > grid.export("anim-path-simple.svg")
  > 
  > # Complex case
  > # (two polygons, animation has many points, animate x and y)
  > grid.newpage()
  > grid.text("Single complex path transmogrifies as it slides to the right",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.path(c(.1, .1, .4, .4,
  +             .2, .2, .3, .3),
  +           c(.2, .8, .8, .2,
  +             .4, .6, .6, .4),
  +           id=rep(1:2, each=4),
  +           rule="evenodd",
  +           gp=gpar(fill="black"),
  +           name="path")
  > grid.animate("path",
  +              x=animUnit(unit(c(.1, .1, .4, .4,
  +                                .2, .2, .3, .3,
  + 
  +                                .35, .35, .65, .65,
  +                                .45, .45, .55, .55,
  +                
  +                                .6, .6, .9, .9,
  +                                .7, .7, .8, .8),
  +                              unit="npc"),
  +                         id=rep(rep(1:2, each=4), 3),
  +                         timeid=rep(1:3, each=8)),
  +              y=animUnit(unit(c(.2, .8, .8, .2,
  +                                .4, .6, .6, .4,
  + 
  +                                .4, .6, .6, .4,
  +                                .2, .8, .8, .2,
  + 
  +                                .2, .8, .8, .2,
  +                                .4, .6, .6, .4),
  +                              unit="npc"),
  +                         id=rep(rep(1:2, each=4), 3),
  +                         timeid=rep(1:3, each=8)),               
  +              duration=3)
  > grid.export("anim-path-complex.svg")
  > 
  > # Simple case
  > # (single raster, anim only x, anim values are just numeric)
  > grid.newpage()
  > grid.text("One raster moves across",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.raster(1:10/11, x=.2, y=.2, width=.1, height=.1, name="raster")
  > grid.animate("raster", x=c(.2, .8), duration=3)
  > grid.export("anim-raster-simple.svg")
  > 
  > # Complex case
  > # (multiple rasters, anim x/y/width/height, anim values are matrices and lists)
  > grid.newpage()
  > grid.text("Three rasters: one goes up, one goes across, and
  + one goes diagonal and gets smaller",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.raster(1:10/11, x=rep(.2, 3), y=.2, width=.1, height=.1, name="raster")
  > grid.animate("raster",
  +              x=cbind(c(.2, .8), c(.2, .8), .2),
  +              y=cbind(.2, c(.2, .8), c(.2, .8)),
  +              width=list(unit(.1, "npc"),
  +                unit(c(.1, 1), c("npc", "cm")),
  +                unit(.1, "npc")),
  +              height=list(unit(.1, "npc"),
  +                unit(c(.1, 1), c("npc", "cm")),
  +                unit(.1, "npc")),             
  +              duration=3)
  > grid.export("anim-raster-complex.svg")
  > 
  > # Simple case
  > # (single xspline, anim only x, anim values are just numeric)
  > grid.newpage()
  > grid.text("Two xsplines move across",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.xspline(c(.3, .1, .5, .3),
  +              c(.2, .5, .5, .2),
  +              open=TRUE, shape=1,
  +              name="xspline-1")
  > grid.xspline(c(.3, .1, .5),
  +              c(.6, .9, .9),
  +              open=FALSE, shape=1,
  +              gp=gpar(fill="grey"),
  +              name="xspline-2")
  > grid.animate("xspline-1",
  +              x=animUnit(unit(c(.3, .1, .5, .3,
  +                                .7, .5, .9, .7),
  +                              "npc"),
  +                         timeid=rep(1:2, each=4)),
  +              duration=3)
  > grid.animate("xspline-2",
  +              x=cbind(c(.3, .1, .5),
  +                      c(.7, .5, .9)),
  +              duration=3)
  > grid.export("anim-xspline-simple.svg")
  > 
  > # Complex case
  > # (four xsplines, animation has many points, animate x and y)
  > grid.newpage()
  > grid.text("Four xsplines shrink and grow (flipped) then revert",
  +           y=unit(1, "lines"))
  > grid.rect()
  > grid.xspline(c(.3, .1, .5, .3,
  +                .7, .5, .9, .7),
  +              c(.2, .5, .5, .2,
  +                .2, .5, .5, .2),
  +              shape=1,
  +              id=rep(1:2, each=4), name="xspline-open")
  > grid.xspline(c(.3, .1, .5,
  +                .7, .5, .9),
  +              c(.6, .9, .9,
  +                .6, .9, .9),
  +              open=FALSE, shape=1,
  +              gp=gpar(fill="grey"),
  +              id=rep(1:2, each=3), name="xspline-closed")
  > grid.animate("xspline-open",
  +              x=animUnit(unit(c(.3, .1, .5, .3,
  +                                .5, .3, .7, .5,
  +                                .7, .5, .9, .7,
  + 
  +                                .7, .5, .9, .7,
  +                                .5, .3, .7, .5,
  +                                .3, .1, .5, .3),
  +                              "npc"),
  +                         id=rep(1:2, each=12),
  +                         timeid=rep(rep(1:3, each=4), 2)),
  +              y=animUnit(unit(c(.2, .5, .5, .2,
  +                                .5, .2, .2, .5,
  +                                .2, .5, .5, .2,
  +                
  +                                .2, .5, .5, .2,
  +                                .5, .2, .2, .5,
  +                                .2, .5, .5, .2),
  +                              "npc"),
  +                         id=rep(1:2, each=12),
  +                         timeid=rep(rep(1:3, each=4), 2)),
  +              duration=5)
  > grid.animate("xspline-closed",
  +              x=animUnit(unit(c(.3, .1, .5,
  +                                .5, .3, .7,
  +                                .7, .5, .9,
  + 
  +                                .7, .5, .9,
  +                                .5, .3, .7,
  +                                .3, .1, .5),
  +                              "npc"),
  +                         id=rep(1:2, each=9),
  +                         timeid=rep(rep(1:3, each=3), 2)),
  +              y=animUnit(unit(c(.6, .9, .9,
  +                                .9, .6, .6,
  +                                .6, .9, .9,
  + 
  +                                .6, .9, .9,
  +                                .9, .6, .6,
  +                                .6, .9, .9),
  +                              "npc"),
  +                         id=rep(1:2, each=9),
  +                         timeid=rep(rep(1:3, each=3), 2)),
  +              duration=5)
  > grid.export("anim-xspline-complex.svg")
  > 
  > 
  > ############################################
  > 
  > # Multiple animations on same grob
  > grid.newpage()
  > grid.rect(x=.1, y=.1, width=.1, height=.1, name="r")
  > grid.animate("r", x=c(.1, .9))
  > grid.animate("r", x=c(.9, .1), begin=3)
  > grid.export("anim-rect-multi.svg")
  >  
  > # Animate group
  > grid.newpage()
  > grid.rect(x=.1, y=.1, width=.1, height=.1, name="r")
  > grid.animate("r", visibility=c("visible", "hidden"), group=TRUE)
  > grid.export("anim-group.svg")
  > 
  > 
  > proc.time()
     user  system elapsed 
     2.29    0.18    2.43 
Running the tests in 'tests/testattrib.R' failed.
Complete output:
  > 
  > 
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > # A very simple test
  > dev.new(width=6, height=6)
  dev.new(): using pdf(file="Rplots1.pdf")
  > # Test script chunk
  > grid.script(file="test.script")
  > # Some default settings
  > pushViewport(viewport(gp=gpar(col="black", fill=NA)))
  > grid.circle(r=0.1, gp=gpar(fill="red"), name="circgrob")
  > # Test setting SVG attribute
  > grid.garnish("circgrob", onclick="circle_click(evt)")
  > popViewport()
  > 
  > grid.export()
  > dev.off()
  null device 
            1 
  > 
  > 
  > # Single attribute value on single grob
  > grid.newpage()
  > grid.circle(r=.1, gp=gpar(fill="black"), name="c")
  > grid.garnish("c", onmousedown="alert('ouch')")
  > grid.export("testattrcircle.svg")
  > 
  > # Multiple attribute values on single grob
  > grid.newpage()
  > pushViewport(viewport())
  > grid.points(1:3/4, 1:3/4, pch=c(1, 10, 16), name="p")
  > grid.garnish("p", 
  +              onmousedown=c("alert('pch=1')",
  +                "alert('pch=10')",
  +                "alert('pch=16')"),
  +              group=FALSE)
  > grid.export("testattrpoints.svg")
  > 
  > # Multiple garnishes (one with single value, one with multiple values)
  > grid.newpage()
  > grid.circle(x=1:3/4, r=.1, gp=gpar(fill="black"), name="c")
  > grid.garnish("c",
  +              onmouseover=c("alert('c1')", "alert('c2')", "alert('c3')"),
  +              group=FALSE)
  > grid.garnish("c",
  +              onmousedown="alert('click me!')")
  > grid.export("testmultattr.svg")
  >              
  > # Sneak an SVG attribute through via gpar()
  > grid.newpage()
  > grid.text("test",
  +           gp=gpar("text-decoration"="line-through"),
  +           name="tt")
  > grid.export("testsvgattr.svg")
  > 
  > proc.time()
     user  system elapsed 
     0.92    0.17    1.06 
Running the tests in 'tests/testclasses.R' failed.
Complete output:
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > pdf(file = NULL)
  > 
  > pushViewport(viewport())
  > grid.rect()
  > grid.circle()
  > grid.text("hello, world!")
  > popViewport()
  > 
  > # All grobs and viewports should now be exported with a class attribute
  > # holding the value of their R class()
  > grid.export("test-classes.svg", addClasses = TRUE)
  > dev.off()
  null device 
            1 
  > 
  > proc.time()
     user  system elapsed 
     0.57    0.12    0.68 
Running the tests in 'tests/testelement.R' failed.
Complete output:
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > dev.new(width=6, height=6)
  dev.new(): using pdf(file="Rplots3.pdf")
  > grid.element("test")
  > grid.element("testParent",
  +              children = gList(commentGrob("This is a child comment"),
  +                               elementGrob("firstChild"),
  +                               rectGrob(),
  +                               elementGrob("thirdChild",
  +                                           attrs = list(anAttrib = "value"))))
  > # Create a 'title' element with descriptive text
  > grid.element("title", children = gList(
  +              textNodeGrob("A gridSVG image with customised SVG content")))
  > grid.export("element-test.svg")
  > dev.off()
  null device 
            1 
  > 
  > proc.time()
     user  system elapsed 
     0.64    0.14    0.76 
Running the tests in 'tests/testfilter.R' failed.
Complete output:
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > # There are many filter effect primitives and many of them are
  > # quite complex so this file could end up having plenty more tests!
  > 
  > pdf(file = NULL)
  > 
  > # First, lets draw some text that we're then going to filter
  > grid.text("hello, world!", gp = gpar(fontsize = 96),
  +           name = "backtext")
  > # Draw a copy over the top with white text that will be left alone
  > grid.text("hello, world!", gp = gpar(fontsize = 96, col = "white"),
  +           name = "foretext")
  > 
  > # We want to create a filter that takes the text thicker, and then blurs it
  > f <- filterEffect(list(feMorphology(operator = "dilate",
  +                                     radius = unit(1, "mm")),
  +                        feGaussianBlur(sd = 1)))
  > # Apply the filter
  > grid.filter("backtext", f)
  > 
  > # Now lets export this 
  > grid.export("filter-test.svg")
  > dev.off()
  null device 
            1 
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.65    0.07    0.71 
Running the tests in 'tests/testgradientfill.R' failed.
Complete output:
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > pdf(file = NULL)
  > 
  > # Define a linear gradient
  > lg <- linearGradient(col = c("blue", "red"))
  > # Register it 
  > registerGradientFill("lingrad", lg)
  > 
  > # Do the same thing for radial gradient but also set the focus for the
  > # radial fill to be off-centre
  > rg <- radialGradient(fx = 0.3, fy = 0.3,
  +                      col = c("white", "black"), stops = c(0, 2))
  > registerGradientFill("radgrad", rg)
  > 
  > # Create rects that we are going to be gradient filling
  > grid.rect(x = 0.2, width = 0.2, height = 0.2, name = "linearfill")
  > grid.rect(x = 0.8, width = 0.2, height = 0.2, name = "radialfill")
  > 
  > # Now apply the gradients
  > grid.gradientFill("linearfill", label = "lingrad", alpha = 0.7)
  > grid.gradientFill("radialfill", label = "radgrad")
  > 
  > grid.export("gradient-test.svg")
  > dev.off()
  null device 
            1 
  > 
  > proc.time()
     user  system elapsed 
     0.53    0.15    0.67 
Running the tests in 'tests/testlink.R' failed.
Complete output:
  > 
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > # A very simple test
  > dev.new(width=6, height=6)
  dev.new(): using pdf(file="Rplots6.pdf")
  > # Some default settings
  > pushViewport(viewport(gp=gpar(col="black", fill=NA)))
  > grid.text("Click me", name="txtgrob")
  > grid.hyperlink("txtgrob", href="http://cran.stat.auckland.ac.nz")
  > popViewport()
  > 
  > grid.export()
  > dev.off()
  null device 
            1 
  > 
  > # A scatterplot and two dot plots designed to be
  > # linked together
  > 
  > # Some data
  > data(iris)
  > 
  > # A scatterplot of x vs y
  > dev.new(width=6, height=6)
  dev.new(): using pdf(file="Rplots7.pdf")
  > # Some default settings
  > pushViewport(viewport(gp=gpar(col="black", fill=NA)))
  > pushViewport(plotViewport(c(5, 5, 4, 2)))
  > pushViewport(dataViewport(iris$Sepal.Length, iris$Sepal.Width))
  > grid.rect()
  > grid.xaxis(name="xaxis")
  > grid.yaxis(name="yaxis")
  > grid.hyperlink("xaxis", "linkdotx.svg")
  > grid.hyperlink("yaxis", "linkdoty.svg")
  > grid.points(iris$Sepal.Length[iris$Species == "setosa"],
  +             iris$Sepal.Width[iris$Species == "setosa"],
  +             gp=gpar(col="red"))
  > grid.points(iris$Sepal.Length[iris$Species == "versicolor"],
  +             iris$Sepal.Width[iris$Species == "versicolor"],
  +             gp=gpar(col="green"))
  > grid.points(iris$Sepal.Length[iris$Species == "virginica"],
  +             iris$Sepal.Width[iris$Species == "virginica"],
  +             gp=gpar(col="blue"))
  > grid.text("Sepal Length", y=unit(-3, "lines"))
  > grid.text("Sepal Width", x=unit(-3, "lines"), rot=90)
  > popViewport(3)
  > grid.export("linkscatter.svg")
  > dev.off()
  null device 
            1 
  > 
  > # A dot plot of x
  > dev.new(width=6, height=3)
  dev.new(): using pdf(file="Rplots8.pdf")
  > # Some default settings
  > pushViewport(viewport(gp=gpar(col="black", fill=NA)))
  > pushViewport(plotViewport(c(5, 2, 4, 2)))
  > pushViewport(dataViewport(iris$Sepal.Length, yscale=c(0 ,1)))
  > grid.rect(gp=gpar(col="grey"))
  > grid.xaxis()
  > grid.points(iris$Sepal.Length[iris$Species == "setosa"],
  +             rnorm(50, .5, .05),
  +             size=unit(2, "char"),
  +             gp=gpar(col=NULL, fill="red", alpha=0.3))
  > grid.points(iris$Sepal.Length[iris$Species == "versicolor"],
  +             rnorm(50, .5, .05),
  +             size=unit(2, "char"),
  +             gp=gpar(col=NULL, fill="green", alpha=0.3))
  > grid.points(iris$Sepal.Length[iris$Species == "virginica"],
  +             rnorm(50, .5, .05),
  +             size=unit(2, "char"),
  +             gp=gpar(col=NULL, fill="blue", alpha=0.3))
  > grid.text("Sepal Length", y=unit(-3, "lines"))
  > grid.text(name="returnlink",
  +           "Return to Scatterplot",
  +           y=unit(1, "npc") + unit(1, "lines"),
  +           gp=gpar(col="grey"))
  > grid.hyperlink("returnlink", "linkscatter.svg")
  > popViewport(3)
  > grid.export("linkdotx.svg")
  > dev.off()
  null device 
            1 
  > 
  > # A dot plot of y
  > dev.new(width=6, height=3)
  dev.new(): using pdf(file="Rplots9.pdf")
  > # Some default settings
  > pushViewport(viewport(gp=gpar(col="black", fill=NA)))
  > pushViewport(plotViewport(c(5, 2, 4, 2)))
  > pushViewport(dataViewport(iris$Sepal.Width, yscale=c(0 ,1)))
  > grid.rect(gp=gpar(col="grey"))
  > grid.xaxis()
  > grid.points(iris$Sepal.Width[iris$Species == "setosa"],
  +             rnorm(50, .5, .05),
  +             size=unit(2, "char"),
  +             gp=gpar(col=NULL, fill="red", alpha=0.3))
  > grid.points(iris$Sepal.Width[iris$Species == "versicolor"],
  +             rnorm(50, .5, .05),
  +             size=unit(2, "char"),
  +             gp=gpar(col=NULL, fill="green", alpha=0.3))
  > grid.points(iris$Sepal.Width[iris$Species == "virginica"],
  +             rnorm(50, .5, .05),
  +             size=unit(2, "char"),
  +             gp=gpar(col=NULL, fill="blue", alpha=0.3))
  > grid.text("Sepal Width", y=unit(-3, "lines"))
  > grid.text(name="returnlink",
  +           "Return to Scatterplot",
  +           y=unit(1, "npc") + unit(1, "lines"),
  +           gp=gpar(col="grey"))
  > grid.hyperlink("returnlink", "linkscatter.svg")
  > popViewport(3)
  > grid.export("linkdoty.svg")
  > dev.off()
  null device 
            1 
  > 
  > 
  > # Check link to overall grob works
  > 
  > grid.newpage()
  > grid.draw(hyperlinkGrob(linesGrob(gp=gpar(lwd=20)),
  +                         href="http://www.stat.auckland.ac.nz"))
  > grid.export("testGroupOfOneHyperlink.svg")
  > 
  > grid.newpage()
  > grid.draw(hyperlinkGrob(segmentsGrob(1:3/4, gp=gpar(lwd=20)),
  +                         href="http://www.stat.auckland.ac.nz"))
  > grid.export("testGroupOfManyHyperlink.svg")
  > 
  > # Test *individual* hrefs
  > 
  > grid.newpage()
  > grid.draw(hyperlinkGrob(linesGrob(gp=gpar(lwd=20)),
  +                         href="http://www.stat.auckland.ac.nz",
  +                         group=FALSE))
  > grid.export("testIndividualOneHyperlink.svg")
  > 
  > grid.newpage()
  > grid.draw(hyperlinkGrob(segmentsGrob(1:3/4, gp=gpar(lwd=20)),
  +                         href="http://www.stat.auckland.ac.nz",
  +                         group=FALSE))
  > grid.export("testIndividualManyHyperlink.svg")
  > 
  > grid.newpage()
  > grid.draw(hyperlinkGrob(segmentsGrob(1:3/4, gp=gpar(lwd=20)),
  +                         href=c("http://www.stat.auckland.ac.nz",
  +                           "http://slashdot.org",
  +                           "http://soccernet.com"),
  +                         group=FALSE))
  > grid.export("testIndividualManyHyperlinks.svg")
  > 
  > proc.time()
     user  system elapsed 
     1.71    0.29    2.00 
Running the tests in 'tests/testpatternfill.R' failed.
Complete output:
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > pdf(file = NULL)
  > grid.newpage()
  > # We are just going to be drawing a cross for our pattern
  > crossGrob <- gTree(children = gList(
  +     linesGrob(),
  +     linesGrob(x = unit(0:1, "npc"), y = unit(1:0, "npc"),
  +               gp = gpar(lwd = 1))
  + ))
  > 
  > # Call the pattern "cross"
  > # Using a small device size because the line widths
  > # will be too small otherwise
  > registerPatternFill("cross", grob = crossGrob,
  +                     dev.width = 1, dev.height = 1)
  > 
  > grid.circle(name = "filledcircle")
  > # Applying the pattern semi-transparently to the circle
  > grid.patternFill("filledcircle", label = "cross", alpha = 0.5)
  > grid.export("pattern-test.svg")
  > dev.off()
  null device 
            1 
  > 
  > # Now lets create a new pattern that uses the existing pattern
  > # but much larger
  > pdf(file = NULL)
  > grid.newpage()
  > registerPatternFillRef("bigcross", "cross",
  +                        width = 0.3, height = 0.3)
  > grid.circle(name = "filledcircle")
  > grid.patternFill("filledcircle", label = "bigcross", alpha = 0.5)
  > grid.export("pattern-test-ref.svg")
  > dev.off()
  null device 
            1 
  > 
  > # Test pattern offset
  > pdf(file = NULL)
  > grid.newpage()
  > grid.rect(y=1, height=.5, just="top", name="zero-offset")
  > grid.patternFill("zero-offset", label="cross")
  > offsetPattern <- pattern(crossGrob, x=unit(1, "cm"),
  +                          dev.width=1, dev.height=1)
  > grid.rect(y=0, height=.5, just="bottom", name="non-zero-offset")
  > grid.patternFill("non-zero-offset", offsetPattern)
  > grid.export("pattern-test-offset.svg")
  > dev.off()
  null device 
            1 
  > 
  > 
  > proc.time()
     user  system elapsed 
     1.14    0.10    1.23 
Running the tests in 'tests/testpendulum.R' failed.
Complete output:
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > dev.new(width=6, height=6)
  dev.new(): using pdf(file="Rplots10.pdf")
  > 
  > grid.newpage()
  > # Some default settings
  > pushViewport(viewport(gp=gpar(col="black", fill=NA)))
  > 
  > n <- 30
  > L <- 50 #mm
  > A <- 20 #mm
  > t <- seq(0, 2*pi, length=n)
  > x <- A*cos(t)
  > v <- -A*sin(t)
  > theta <- atan(x/L)
  > y <- L*cos(theta)
  > 
  > pushViewport(viewport(layout=grid.layout(4, 1,
  +                          widths=unit(2.2*A, "null"),
  +                          heights=unit(c(1, L + 10, 2.2*A, 2),
  +                            c("lines", "null", "null", "lines")),
  +                          respect=TRUE)))
  > pushViewport(viewport(layout.pos.row=2,
  +                        xscale=A * c(-1.1, 1.1),
  +                        yscale=c(0, L + 10)))
  > grid.rect()
  > grid.lines(name="chain",
  +            x=unit(c(0.5, x[1]), c("npc", "native")),
  +            y=unit(1, "npc") - unit(c(0, abs(y)[1]), c("npc", "native")))
  > grid.animate("chain",
  +              x=animUnit(unit(c(rep(0.5, n), x),
  +                              c(rep(c("npc", "native"), each=n))),
  +                         timeid=rep(1:n, 2)),
  +              y=animUnit(unit.c(unit(rep(1, n), "npc"),
  +                         unit(1, "npc") - unit(y, "native")),
  +                         timeid=rep(1:n, 2)),
  +              duration=5, rep=TRUE)
  > grid.circle(name="weight",
  +             x=unit(x[1], "native"),
  +             y=unit(1, "npc") - unit(y[1], "native"),
  +             r=unit(1, "mm"),
  +             gp=gpar(fill="black"))
  > grid.animate("weight",
  +              x=unit(x, "native"),
  +              y=unit(1, "npc") - unit(abs(y), "native"),
  +              duration=5, rep=TRUE)
  > popViewport()
  > 
  > pushViewport(viewport(layout.pos.row=3,
  +                        xscale=A * c(-1.1, 1.1),
  +                        yscale=A * c(-1.1, 1.1)))
  > grid.rect()
  > grid.lines(x=unit(c(0, 0), "native"),
  +            gp=gpar(lty="dashed", col="grey"))
  > grid.lines(y=unit(c(0, 0), "native"),
  +            gp=gpar(lty="dashed", col="grey"))
  > grid.text("Displacement", y=unit(-1, "lines"))
  > grid.text("Velocity", x=unit(-1, "lines"), rot=90)
  > grid.circle(name="key",
  +             x=unit(x[1], "native"),
  +             y=unit(v[1], "native"),
  +             r=unit(1, "mm"),
  +             gp=gpar(fill="black"))
  > grid.animate("key",
  +              x=unit(x, "native"),
  +              y=unit(v, "native"),
  +              duration=5, rep=TRUE)
  > popViewport(2)
  > 
  > popViewport()
  > 
  > grid.export("pendulum.svg")
  > 
  > dev.off()
  null device 
            1 
  > 
  > proc.time()
     user  system elapsed 
     0.82    0.12    0.93 
Running the tests in 'tests/testplot.R' failed.
Complete output:
  > 
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > dev.new(width=6, height=6)
  dev.new(): using pdf(file="Rplots11.pdf")
  > grid.rect(gp=gpar(col="black", fill=NA))
  > set.seed(1000)
  > grid.multipanel(vp=viewport(w=.7, h=.7, gp=gpar(col="black", fill=NA)),
  +                 newpage=FALSE)
  > grid.export("plot.svg")
  > dev.off()
  null device 
            1 
  > 
  > proc.time()
     user  system elapsed 
     2.79    0.12    2.90 
Running the tests in 'tests/testvp.R' failed.
Complete output:
  > 
  > # Test that 'vp' slots [viewports (vpTrees, vpLists, vpStacks) and vpPaths]
  > # are being recorded correctly
  > 
  > library(grid)
  > library(gridSVG)
  
  Attaching package: 'gridSVG'
  
  The following objects are masked from 'package:grid':
  
      linearGradient, pattern, radialGradient
  
  The following object is masked from 'package:grDevices':
  
      dev.off
  
  > 
  > grid.newpage()
  > vp <- viewport(width=.5, height=.5, gp=gpar(fill="grey"))
  > grid.rect(vp=vp)
  > grid.export("grob-viewport.svg")
  > 
  > grid.newpage()
  > vp <- vpStack(viewport(width=.5, height=.5, gp=gpar(fill="grey")),
  +               viewport(gp=gpar(col="red")))
  > grid.rect(vp=vp)
  > grid.export("grob-vpStack.svg")
  > 
  > grid.newpage()
  > vp <- vpList(viewport(width=.5, height=.5, gp=gpar(fill="grey")),
  +              viewport(gp=gpar(col="red")))
  > grid.rect(vp=vp)
  > grid.export("grob-vpList.svg")
  > 
  > grid.newpage()
  > vp <- vpTree(viewport(width=.5, height=.5),
  +              vpList(viewport(width=.5, height=.5, gp=gpar(fill="grey")),
  +                     viewport(gp=gpar(col="red"))))
  > grid.rect(vp=vp)
  > grid.export("grob-vpTree.svg")
  > 
  > grid.newpage()
  > vp <- vpTree(viewport(width=.5, height=.5, name="p"),
  +              vpList(viewport(width=.5, height=.5, gp=gpar(fill="grey"),
  +                              name="c1"),
  +                     viewport(gp=gpar(col="red"),
  +                              name="c2")))
  > pushViewport(vp)
  > upViewport(0)
  > grid.rect(vp="p::c1")
  > grid.export("grob-vpPath.svg")
  > 
  > grid.newpage()
  > vp <- viewport(width=.5, height=.5, gp=gpar(fill="grey"))
  > grid.draw(gTree(children=gList(rectGrob()), vp=vp))
  > grid.export("gTree-viewport.svg")
  > 
  > # Pathological
  > grid.newpage()
  > vp <- vpTree(viewport(width=.5, height=.5, name="p"),
  +              vpList(viewport(width=.5, height=.5, gp=gpar(fill="grey"),
  +                              name="c1"),
  +                     viewport(gp=gpar(col="red"),
  +                              name="c2")))
  > pushViewport(vp)
  > upViewport(0)
  > grid.draw(gTree(childrenvp=vp,
  +                 children=gList(rectGrob(vp="p::c1")),
  +                 vp="p::c1"))
  > grid.export("gTree-vpPath.svg")
  > 
  > proc.time()
     user  system elapsed 
     1.04    0.12    1.14