File: test-gcheckboxgroup.R

package info (click to toggle)
r-cran-gwidgets 0.0-54.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,360 kB
  • sloc: sh: 13; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 819 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## RUnit test
## prefix for function is test.

test.gcheckboxgroup <- function() {
  w <- gwindow()
  g <- ggroup(cont = w, horizontal = FALSE)

  items <- letters[1:5]
  
  cbg <- gcheckboxgroup(items, checked=c(TRUE,TRUE, FALSE,FALSE,FALSE), cont = g)

  ## svalue
  checkEquals(svalue(cbg), items[1:2])
  checkEqualsNumeric(svalue(cbg, index=TRUE), 1:2)

  ## svalue<-

  ## by logical
  svalue(cbg) <- c(TRUE,rep(FALSE,4))
  checkEquals(svalue(cbg), items[1])

  ## by name
  svalue(cbg) <- items[1:2]
  checkEquals(svalue(cbg), items[1:2])

  ## by index
  svalue(cbg, index=TRUE) <- 1:3
  checkEquals(svalue(cbg), items[1:3])

  ## [
  checkEquals(cbg[1:2], items[1:2])
  checkEquals(cbg[], items[])

  ## [<-
  items <- toupper(items)
  cbg[] <- items
  checkEquals(cbg[], items[])

  ## clean up
  dispose(w)
}