File: test-gcombobox.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 (46 lines) | stat: -rw-r--r-- 1,022 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
42
43
44
45
46
if(require(RUnit)) {
test.gcombobox <- function() {
    w <- gwindow()
    g <- ggroup(cont = w, horiz = FALSE)
    
    items <- letters
    m <- data.frame(letters[1:4], rep("quit",4), toupper(letters[1:4]))
    
    ## basic
    widget <- gcombobox(items, selected = 1, cont = g)
    
    ## svalue
    checkEquals(svalue(widget), items[1])
  checkEquals(svalue(widget, index=TRUE), 1) # index=TRUE

    ## svalue<-
    svalue(widget) <- "b"
    checkEquals(svalue(widget), "b")
    
    ## index
    svalue(widget, index=TRUE) <- 3
  checkEquals(svalue(widget), items[3])
    
    
    ## [
    checkEquals(widget[], items)
    
    ## [<-
    widget[] <- m[,1, drop=TRUE]
    checkEquals(widget[], m[,1,drop=TRUE])
    
    
    ## data frame
    widget <- gcombobox(m, cont = g)
    
    svalue(widget, index=TRUE) <- 1
    checkEquals(svalue(widget, index=TRUE), 1)
    
  ## [<- with data frame
    widget[] <- m[1:2,]
    svalue(widget, index=TRUE) <- 1
    checkEquals(svalue(widget, index=TRUE), 1)
    
  }

}