The R Project SVN R

Rev

Rev 89985 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89985 Rev 90304
Line 123... Line 123...
123
                             "-c", "'FileName (r) file runpdfbegin 1 1 pdfpagecount {pdfgetpage /MediaBox get {=print ( ) print} forall (\n) print} for quit'"),
123
                             "-c", "'FileName (r) file runpdfbegin 1 1 pdfpagecount {pdfgetpage /MediaBox get {=print ( ) print} forall (\n) print} for quit'"),
124
                     stdout = TRUE)
124
                     stdout = TRUE)
125
    psize <- as.numeric(strsplit(psize, " ", fixed = TRUE)[[1L]][c(3, 4)])
125
    psize <- as.numeric(strsplit(psize, " ", fixed = TRUE)[[1L]][c(3, 4)])
126
    stopifnot(psize/72 == c(4, 5))
126
    stopifnot(psize/72 == c(4, 5))
127
}
127
}
-
 
128
 
-
 
129
### ------------------------------------ 9 ----------------------------------
-
 
130
## option 'strip.white' admits TRUE, FALSE, "all" (with partial
-
 
131
## matching), and "true" and "false" (with partial matching) for
-
 
132
## backward compatibility; defaults to TRUE, historically
-
 
133
## irrespective of the value in '.defaults'
-
 
134
stopifnot(exprs = {
-
 
135
    isTRUE (RweaveLatexOptions(list(strip.white = TRUE,    .defaults = NULL))$strip.white)
-
 
136
    isFALSE(RweaveLatexOptions(list(strip.white = FALSE,   .defaults = NULL))$strip.white)
-
 
137
    isTRUE (RweaveLatexOptions(list(strip.white = "true",  .defaults = NULL))$strip.white)
-
 
138
    isTRUE (RweaveLatexOptions(list(strip.white = "t",     .defaults = NULL))$strip.white)
-
 
139
    isFALSE(RweaveLatexOptions(list(strip.white = "false", .defaults = NULL))$strip.white)
-
 
140
    isFALSE(RweaveLatexOptions(list(strip.white = "f",     .defaults = NULL))$strip.white)
-
 
141
    isTRUE (RweaveLatexOptions(list(                       .defaults = NULL))$strip.white)
-
 
142
    RweaveLatexOptions(list(strip.white = "all", .defaults = NULL))$strip.white == "all"
-
 
143
    RweaveLatexOptions(list(strip.white = "a",   .defaults = NULL))$strip.white == "all"
-
 
144
})
-
 
145
 
-
 
146
## non-lowercase values of 'strip.white' are accepted, with a warning
-
 
147
## (many variants of TRUE and FALSE are caught by 'as.logical')
-
 
148
optTR  <- list(strip.white = "TR",  .defaults = NULL)
-
 
149
optFA  <- list(strip.white = "FA",  .defaults = NULL)
-
 
150
optALL <- list(strip.white = "ALL", .defaults = NULL)
-
 
151
optA   <- list(strip.white = "A",   .defaults = NULL)
-
 
152
tools::assertWarning(resTR  <- RweaveLatexOptions(optTR))
-
 
153
tools::assertWarning(resFA  <- RweaveLatexOptions(optFA))
-
 
154
tools::assertWarning(resALL <- RweaveLatexOptions(optALL))
-
 
155
tools::assertWarning(resA   <- RweaveLatexOptions(optALL))
-
 
156
stopifnot(exprs = {
-
 
157
    isTRUE (resTR$strip.white)
-
 
158
    isFALSE(resFA$strip.white)
-
 
159
    resALL$strip.white == "all"
-
 
160
    resA$strip.white   == "all"
-
 
161
})