inst/tests/slider.R

w <- gwindow("slider spinbutton")
g <- ggroup(cont=w, horizontal=FALSE)

sl1 <- gslider(from=0, to=100, by=1, cont=g)
sl2 <- gslider(from=0, to=100, by=1, value=50, cont=g, handler=function(h,...) print("call handler"))


## test

## svalue
expect_equal(svalue(sl1), 0)
expect_equal(svalue(sl2), 50)

## svalue<-
svalue(sl2) <- 5
expect_equal(svalue(sl2), 5)


## handler
expect_output(sl2$invoke_change_handler(), "call handler")


## spinbutton

sp1 <- gspinbutton(from=0, to=100, by=1, cont=g)
sp2 <- gspinbutton(from=0, to=100, by=1, value=50, cont=g, handler=function(h,...) print("call handler"))


## test

## svalue
expect_equal(svalue(sp1), 0)
expect_equal(svalue(sp2), 50)

## svalue<-
svalue(sp2) <- 5
expect_equal(svalue(sp2), 5)


## handler
expect_output(sp2$invoke_change_handler(), "call handler")

Try the gWidgetsWWW2 package in your browser

Any scripts or data that you put into this service are public.

gWidgetsWWW2 documentation built on May 2, 2019, 6:10 p.m.