Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
deepayan committed Sep 28, 2010
1 parent 6f1fa96 commit ebbaa4f
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo/animation.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pendulum <-
view$addAction(pauseAct)

## random restart
timer <- qtimer(30, step)
## timer <- qtimer(30, step)
restartAct <- Qt$QAction("Restart", view)
restartAct$setShortcut(Qt$QKeySequence("Ctrl+R"))
qconnect(restartAct, signal = "triggered",
Expand Down
66 changes: 66 additions & 0 deletions demo/repaint.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

## too much repainting and focus

scene <- qscene()
root <- qlayer(scene)

points <-
qlayer(root,
paintFun = function(item, painter, exposed) {
mosaiq.points(runif(10), runif(10),
painter = painter)
},
row = 1L, col = 0L,
cache = TRUE,
limits = qrect(c(0, 1), c(0, 1)))


points2 <-
qlayer(root,
paintFun = function(item, painter, exposed) {
mosaiq.points(runif(10), runif(10),
painter = painter, col = "orange")
},
row = 0L, col = 0L,
cache = TRUE,
limits = qrect(c(0, 1), c(0, 1)))

(v <- qplotView(scene, opengl = FALSE))

timerHandler <- function()
{
x <- points #v$scene()
a <- x$hasFocus()
x$clearFocus()
## x$update()
v$update()
b <- x$hasFocus()
x$setFocus()
## x$update()
v$update()
print(c(a, b))
}

timer <- ## 1-second timer
qtimer(1000, handler = timerHandler)


timer$start()
timer$stop()



qtpaint:::qupdate.QGraphicsView
qtpaint:::qupdate.QGraphicsScene

v$update()
v$viewport()$repaint()

scene$clearFocus()
v$scene()$update()
scene$setFocus()
v$scene()$update()




21 changes: 21 additions & 0 deletions demo/spacing.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

## Observations about spacing

tmp <- rlnorm(100)
df <- data.frame(x = runif(200),
y = c(tmp, 2 * tmp),
g = gl(2, 100))


## This is OK

mosaiq.xyplot(x, y, margin = ~g, data = df, layout = c(1, 2))

## This has one row taller, apparently because the axis labeling is
## absent. stretch factors are cumulative?

## No axis on bottom row (OK without the 'alternating' argument)
library(mosaiq)
mosaiq.xyplot(x, y, margin = ~g, data = df, layout = c(1, 2),
alternating = list(y = c(1, 0)))

0 comments on commit ebbaa4f

Please sign in to comment.