[rkward-cvs] [rkward] packages/rkwarddev: unit tests for all XML generating functions are complete and working. some minor fixes to some of them.
m.eik michalke
meik.michalke at uni-duesseldorf.de
Wed Dec 17 17:09:20 UTC 2014
Git commit 76bab960748285dd1840917e988d6ebc5b94da34 by m.eik michalke.
Committed on 17/12/2014 at 17:08.
Pushed by meikm into branch 'master'.
unit tests for all XML generating functions are complete and working. some minor fixes to some of them.
M +7 -2 packages/rkwarddev/ChangeLog
M +3 -3 packages/rkwarddev/DESCRIPTION
M +2 -10 packages/rkwarddev/R/rk.XML.require.R
M +57 -42 packages/rkwarddev/R/rk.XML.values.R
M +1 -1 packages/rkwarddev/R/rk.XML.valueslot.R
M +111 -104 packages/rkwarddev/R/rk.XML.vars.R
M +1 -1 packages/rkwarddev/R/rkwarddev-package.R
M +5 -1 packages/rkwarddev/inst/NEWS.Rd
M +- -- packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
M +1 -6 packages/rkwarddev/man/rk.XML.require.Rd
M +14 -3 packages/rkwarddev/man/rk.XML.values.Rd
M +1 -1 packages/rkwarddev/man/rk.XML.valueslot.Rd
M +9 -5 packages/rkwarddev/man/rk.XML.vars.Rd
M +1 -1 packages/rkwarddev/man/rkwarddev-package.Rd
M +241 -98 packages/rkwarddev/tests/generate_test_standards.R
M +- -- packages/rkwarddev/tests/testthat/XML_test_standards.RData
M +528 -6 packages/rkwarddev/tests/testthat/test_XML_generation.R
http://commits.kde.org/rkward/76bab960748285dd1840917e988d6ebc5b94da34
diff --git a/packages/rkwarddev/ChangeLog b/packages/rkwarddev/ChangeLog
index cb576ed..c2424c1 100644
--- a/packages/rkwarddev/ChangeLog
+++ b/packages/rkwarddev/ChangeLog
@@ -1,6 +1,6 @@
ChangeLog for package rkwarddev
-changes in version 0.06-6 (2014-12-14)
+changes in version 0.06-6 (2014-12-17)
fixed:
- rk.XML.optionset() does now allow to re-use objects defined in the same
function call (i.e., refer to optioncolumns in the logic section)
@@ -20,6 +20,8 @@ fixed:
- join() referenced a wrong object name if "var" was of class rk.JS.arr
- rk.XML.about() had a malformed error message
- rk.plugin.component() called XMLAttrs() with too many arguments
+ - rk.XML.values() and rk.XML.vars() do now handle all combinations of "horiz"
+ and "add.nodes" properly
added:
- all "help" values can now be a list of character strings or XiMpLe nodes,
to have more control over the markup
@@ -39,6 +41,8 @@ added:
- new function R.comment() to generate JavaScript "comment()" calls
- first unit tests using the testthat package
- added documentation to the used S4 classes
+ - enhanced rk.XML.values() to also accept "options" and "duplicates", and
+ rk.XML.vars() to also accept "duplicates"
changed:
- function i18n() was changed to be used in JavaScript generation only;
this breaks code using the function introduced with 0.06-4, but that was to
@@ -51,7 +55,8 @@ changed:
- internally, moved the definitions of valid child nodes and modifiers as
well as default getter functions and modifiers to separate files, so
they're more obvious to find and check
- - rk.XML.input() now checks wheter "size" is exactly one of "small", "medium" or "large"
+ - rk.XML.input() now checks wheter "size" is exactly one of "small",
+ "medium" or "large"
removed:
- the functions rk.set.language() rk.get.language() were no longer useful
and therefore removed
diff --git a/packages/rkwarddev/DESCRIPTION b/packages/rkwarddev/DESCRIPTION
index 7f7ec97..90ae19f 100644
--- a/packages/rkwarddev/DESCRIPTION
+++ b/packages/rkwarddev/DESCRIPTION
@@ -8,8 +8,8 @@ Depends:
Suggests:
testthat
Enhances: rkward
-Description: Provides functions to create plugin skeletons and XML structures
- for RKWard.
+Description: Provides functions to create plugin skeletons and XML
+ structures for RKWard.
License: GPL (>= 3)
Encoding: UTF-8
LazyLoad: yes
@@ -17,7 +17,7 @@ URL: http://rkward.sourceforge.net
Authors at R: c(person(given="m.eik", family="michalke",
email="meik.michalke at hhu.de", role=c("aut", "cre")))
Version: 0.06-6
-Date: 2014-12-14
+Date: 2014-12-17
Collate:
'00_class_01_rk.JS.arr.R'
'00_class_02_rk.JS.var.R'
diff --git a/packages/rkwarddev/R/rk.XML.require.R b/packages/rkwarddev/R/rk.XML.require.R
index f5b72d3..766fdd4 100644
--- a/packages/rkwarddev/R/rk.XML.require.R
+++ b/packages/rkwarddev/R/rk.XML.require.R
@@ -27,9 +27,6 @@
#' preferred over \code{map} if that file is in the same package.
#' @param map Character string, should be \code{"namespace::id"} of another .pluginmap to be included.
#' Can be used to address plugin maps which are not part of the same plugin package.
-#' @param localized Logical, only useful for plugins with static internationalisation. Adds the \code{localized}
-#' attribute if set to \code{TRUE}; \code{file} must then point to the default pluginmap in a subdirectory
-#' containing all localised pluginmaps.
#' @return An object of class \code{XiMpLe.node}.
#' @export
#' @seealso \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
@@ -37,7 +34,7 @@
#' test.require <- rk.XML.require("another.pluginmap")
#' cat(pasteXML(test.require))
-rk.XML.require <- function(file=NULL, map=NULL, localized=FALSE){
+rk.XML.require <- function(file=NULL, map=NULL){
# one of file or map *must* be used
if(is.null(file) && is.null(map)){
stop(simpleError("'file' or 'map' must be specified!"))
@@ -48,22 +45,17 @@ rk.XML.require <- function(file=NULL, map=NULL, localized=FALSE){
} else {}
# now that we know one of both is set
- set.localized <- NULL
if(!is.null(file)){
if(length(file) > 1 || !is.character(file)){
stop(simpleError("'file' must be a character string!"))
} else {}
- # check for i18n
- if(isTRUE(localized)){
- set.localized <- "true"
- } else {}
} else {
if(length(map) > 1 || !is.character(map)){
stop(simpleError("'map' must be a character string!"))
} else {}
}
- node <- XMLNode("require", attrs=list(localized=set.localized, file=file, map=map))
+ node <- XMLNode("require", attrs=list(file=file, map=map))
return(node)
}
diff --git a/packages/rkwarddev/R/rk.XML.values.R b/packages/rkwarddev/R/rk.XML.values.R
index d50adbb..3e3fa9b 100644
--- a/packages/rkwarddev/R/rk.XML.values.R
+++ b/packages/rkwarddev/R/rk.XML.values.R
@@ -25,8 +25,14 @@
#'
#' @param label Character string, a text label for the value browser.
#' @param slot.text Character string, a text label for the value selection slot.
+#' @param options A named list with string values to choose from. The names of the list elements will become
+#' labels of the options, \code{val} defines the value to submit if the value is selected, and
+#' \code{chk=TRUE} should be set in the one option which is checked by default. You might also provide an \code{i18n}
+#' for this particular option (see \code{i18n}). Objects generated with \code{\link[rkwarddev:rk.XML.option]{rk.XML.option}}
+#' are accepted as well.
#' @param required Logical, whether the selection of values is mandatory or not.
#' @param multi Logical, whether the valueslot holds only one or several objects.
+#' @param duplicates Logical, if \code{multi=TRUE} defines whether the same entry may be added multiple times. Sets \code{multi=TRUE}.
#' @param min If \code{multi=TRUE} defines how many objects must be selected.
#' @param any If \code{multi=TRUE} defines how many objects must be selected at least if any
#' are selected at all.
@@ -56,53 +62,62 @@
#' test.values <- rk.XML.values("Select some values", "Vars go here")
#' cat(pasteXML(test.values))
-rk.XML.values <- function(label, slot.text, required=FALSE, multi=FALSE, min=1, any=1, max=0,
- horiz=TRUE, add.nodes=NULL, frame.label=NULL, id.name="auto", help=NULL, component=rk.get.comp()){
+rk.XML.values <- function(label, slot.text, options=list(label=c(val=NULL, chk=FALSE, i18n=NULL)),
+ required=FALSE, multi=FALSE, duplicates=FALSE, min=1, any=1, max=0,
+ horiz=TRUE, add.nodes=NULL, frame.label=NULL, id.name="auto", help=NULL, component=rk.get.comp()){
- if(identical(id.name, "auto")){
- ## if this ID generation get's changed, change it in rk.XML.valueslot(), too!
- value.sel.attr <- list(id=auto.ids(label, prefix=ID.prefix("valueselector", length=3)))
- value.slot.id <- auto.ids(slot.text, prefix=ID.prefix("valueslot", length=4))
- } else if(!is.null(id.name)){
- value.sel.attr <- list(id=id.name[[2]])
- value.slot.id <- id.name[[3]]
- } else {}
+ if(identical(id.name, "auto")){
+ ## if this ID generation get's changed, change it in rk.XML.valueslot(), too!
+ value.sel.attr <- list(id=auto.ids(label, prefix=ID.prefix("valueselector", length=3)))
+ value.slot.id <- auto.ids(slot.text, prefix=ID.prefix("valueslot", length=4))
+ } else if(!is.null(id.name)){
+ value.sel.attr <- list(id=id.name[[2]])
+ value.slot.id <- id.name[[3]]
+ } else {}
- v.selector <- rk.XML.valueselector(
- label=label,
- id.name=value.sel.attr[["id"]])
+ v.selector <- rk.XML.valueselector(
+ label=label,
+ options=options,
+ id.name=value.sel.attr[["id"]])
- v.slot <- rk.XML.valueslot(
- label=slot.text,
- source=v.selector,
- required=required,
- multi=multi,
- min=min,
- any=any,
- max=max,
- id.name=value.slot.id,
- help=help,
- component=component)
+ v.slot <- rk.XML.valueslot(
+ label=slot.text,
+ source=v.selector,
+ required=required,
+ multi=multi,
+ duplicates=duplicates,
+ min=min,
+ any=any,
+ max=max,
+ id.name=value.slot.id,
+ help=help,
+ component=component)
- slot.content <- list(v.slot)
+ slot.content <- list(v.slot)
- # do we need to add extra nodes to the valueslot?
- if(!is.null(add.nodes)){
- for (this.node in add.nodes) {
- slot.content[[length(slot.content)+1]] <- this.node
- }
- } else {}
-
- if(isTRUE(horiz)){
- aligned.chld <- rk.XML.row(list(rk.XML.col(v.selector), rk.XML.col(slot.content)))
- } else {
- aligned.chld <- list(v.selector, unlist(slot.content))
- }
+ # do we need to add extra nodes to the valueslot?
+ if(!is.null(add.nodes)){
+ for (this.node in child.list(add.nodes)) {
+ slot.content[[length(slot.content)+1]] <- this.node
+ }
+ } else {}
- values.frame <- rk.XML.frame(
- children=child.list(aligned.chld),
- label=frame.label,
- id.name=id.name[[1]])
+ if(isTRUE(horiz)){
+ values.frame <- rk.XML.frame(
+ rk.XML.row(list(rk.XML.col(v.selector), rk.XML.col(slot.content))),
+ label=frame.label,
+ id.name=id.name[[1]]
+ )
+ } else {
+ values.frame <- rk.XML.frame(
+ v.selector,
+ label=frame.label,
+ id.name=id.name[[1]]
+ )
+ for (this.node in slot.content) {
+ XMLChildren(values.frame) <- append(XMLChildren(values.frame), this.node)
+ }
+ }
- return(values.frame)
+ return(values.frame)
}
diff --git a/packages/rkwarddev/R/rk.XML.valueslot.R b/packages/rkwarddev/R/rk.XML.valueslot.R
index 98bea33..b1367f5 100644
--- a/packages/rkwarddev/R/rk.XML.valueslot.R
+++ b/packages/rkwarddev/R/rk.XML.valueslot.R
@@ -23,7 +23,7 @@
#' from), or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used). If it is not
#' a \code{<valueselector>} node, you must also specify a valid property for the node.
#' @param property Character string, valid property for a XiMpLe node defined by \code{source}. In the XML code, it
-#' will cause the use of \code{source_property} instead of \code{source}. Only used if \code{source} ist not a
+#' will cause the use of \code{source_property} instead of \code{source}. Only used if \code{source} is not a
#' \code{<valueselector>} node.
#' @param required Logical, whether the selection of values is mandatory or not.
#' @param multi Logical, whether the valueslot holds only one or several objects.
diff --git a/packages/rkwarddev/R/rk.XML.vars.R b/packages/rkwarddev/R/rk.XML.vars.R
index eef2981..81c72a5 100644
--- a/packages/rkwarddev/R/rk.XML.vars.R
+++ b/packages/rkwarddev/R/rk.XML.vars.R
@@ -9,11 +9,11 @@
#
# rkwarddev is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with rkwarddev. If not, see <http://www.gnu.org/licenses/>.
+# along with rkwarddev. If not, see <http://www.gnu.org/licenses/>.
#' Create a variable selector for RKWard plugins
@@ -27,140 +27,147 @@
#' @param slot.text Character string, a text label for the variable selection slot.
#' @param required Logical, whether the selection of variables is mandatory or not.
#' @param multi Logical, whether the varslot holds only one or several objects.
+#' @param duplicates Logical, if \code{multi=TRUE} defines whether the same entry may be added multiple times. Sets \code{multi=TRUE}.
#' @param min If \code{multi=TRUE} defines how many objects must be selected.
#' @param any If \code{multi=TRUE} defines how many objects must be selected at least if any
-#' are selected at all.
+#' are selected at all.
#' @param max If \code{multi=TRUE} defines how many objects can be selected in total
-#' (0 means any number).
+#' (0 means any number).
#' @param dim The number of dimensions, an object needs to have. If \code{dim=0} any number
-#' of dimensions is acceptable.
+#' of dimensions is acceptable.
#' @param min.len The minimum length, an object needs to have.
#' @param max.len The maximum length, an object needs to have. If \code{NULL}, defaults to the largest
-#' integer number representable on the system.
+#' integer number representable on the system.
#' @param classes An optional character vector, defining class names to which the selection must be limited.
#' @param types If you specify one or more variables types here, the varslot will only accept objects of those
-#' types. Valid types are "unknown", "number", "string", "factor", "invalid". Optional, use with great care,
-#' the user should not be prevented from making valid choices, and rkward does not always know the type
-#' of a variable!
+#' types. Valid types are "unknown", "number", "string", "factor", "invalid". Optional, use with great care,
+#' the user should not be prevented from making valid choices, and rkward does not always know the type
+#' of a variable!
#' @param horiz Logical. If \code{TRUE}, the varslot will be placed next to the selector,
-#' if \code{FALSE} below it.
+#' if \code{FALSE} below it.
#' @param add.nodes A list of objects of class \code{XiMpLe.node} to be placed after the varslot.
#' @param frame.label Character string, a text label for the whole frame.
#' @param formula.dependent Character string, if not \code{NULL} will cause the addition of a second
-#' varslot for the dependent variable(s), using the text of \code{formula.dependent} as its label. Also
-#' a \code{<formula>} node will be added, using both varslots for \code{fixed_factors} and \code{dependent}
-#' respectively.
+#' varslot for the dependent variable(s), using the text of \code{formula.dependent} as its label. Also
+#' a \code{<formula>} node will be added, using both varslots for \code{fixed_factors} and \code{dependent}
+#' respectively.
#' @param dep.options A named list with optional attributes for the \code{dependent} varslot, if \code{formula.dependent}
-#' is not \code{NULL}. Valid options are \code{required}, \code{multi}, \code{min}, \code{any}, \code{max},
-#' \code{dim}, \code{min.len}, \code{max.len}, \code{classes} and \code{types}. If an options is undefined, it defaults
-#' to the same values like the main options of this function.
+#' is not \code{NULL}. Valid options are \code{required}, \code{multi}, \code{min}, \code{any}, \code{max},
+#' \code{dim}, \code{min.len}, \code{max.len}, \code{classes} and \code{types}. If an options is undefined, it defaults
+#' to the same values like the main options of this function.
#' @param id.name Character vector, unique IDs for the frame (first entry), the varselector (second entry)
-#' and varslot (third entry). If \code{formula.dependent} is not \code{NULL}, a fourth and fifth entry is needed as well,
-#' for the dependent varslot and the formula node, respectively.
-#' If \code{"auto"}, IDs will be generated automatically from \code{label} and \code{slot.text}.
+#' and varslot (third entry). If \code{formula.dependent} is not \code{NULL}, a fourth and fifth entry is needed as well,
+#' for the dependent varslot and the formula node, respectively.
+#' If \code{"auto"}, IDs will be generated automatically from \code{label} and \code{slot.text}.
#' @param help Character string or list of character values and XiMpLe nodes, will be used as the \code{text} value for a setting node in the .rkh file.
-#' If set to \code{FALSE}, \code{\link[rkwarddev:rk.rkh.scan]{rk.rkh.scan}} will ignore this node.
-#' Also needs \code{component} to be set accordingly!
+#' If set to \code{FALSE}, \code{\link[rkwarddev:rk.rkh.scan]{rk.rkh.scan}} will ignore this node.
+#' Also needs \code{component} to be set accordingly!
#' @param component Character string, name of the component this node belongs to. Only needed if you
-#' want to use the scan features for automatic help file generation; needs \code{help} to be set
-#' accordingly, too!
+#' want to use the scan features for automatic help file generation; needs \code{help} to be set
+#' accordingly, too!
#' @return An object of class \code{XiMpLe.node}.
#' @export
#' @seealso
-#' \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}},
-#' \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}},
-#' and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
+#' \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}},
+#' \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}},
+#' and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
#' @examples
#' test.vars <- rk.XML.vars("Select some vars", "Vars go here")
#' cat(pasteXML(test.vars))
-rk.XML.vars <- function(label, slot.text, required=FALSE, multi=FALSE, min=1, any=1, max=0,
- dim=0, min.len=0, max.len=NULL, classes=NULL, types=NULL, horiz=TRUE, add.nodes=NULL,
- frame.label=NULL, formula.dependent=NULL, dep.options=list(), id.name="auto",
- help=NULL, component=rk.get.comp()){
+rk.XML.vars <- function(label, slot.text, required=FALSE, multi=FALSE, duplicates=FALSE, min=1, any=1, max=0,
+ dim=0, min.len=0, max.len=NULL, classes=NULL, types=NULL, horiz=TRUE, add.nodes=NULL,
+ frame.label=NULL, formula.dependent=NULL, dep.options=list(), id.name="auto",
+ help=NULL, component=rk.get.comp()){
- if(identical(id.name, "auto")){
- ## if this ID generation get's changed, change it in rk.XML.varslot(), too!
- var.sel.attr <- list(id=auto.ids(label, prefix=ID.prefix("varselector", length=3)))
- var.slot.id <- auto.ids(slot.text, prefix=ID.prefix("varslot", length=4))
- if(!is.null(formula.dependent)){
- var.dep.id <- auto.ids(formula.dependent, prefix=ID.prefix("varslot", length=4))
- frml.id <- auto.ids(formula.dependent, prefix=ID.prefix("formula", length=3))
- } else {}
- } else if(!is.null(id.name)){
- var.sel.attr <- list(id=id.name[[2]])
- var.slot.id <- id.name[[3]]
- if(!is.null(formula.dependent)){
- var.dep.id <- id.name[[4]]
- frml.id <- id.name[[5]]
+ if(identical(id.name, "auto")){
+ ## if this ID generation get's changed, change it in rk.XML.varslot(), too!
+ var.sel.attr <- list(id=auto.ids(label, prefix=ID.prefix("varselector", length=3)))
+ var.slot.id <- auto.ids(slot.text, prefix=ID.prefix("varslot", length=4))
+ if(!is.null(formula.dependent)){
+ var.dep.id <- auto.ids(formula.dependent, prefix=ID.prefix("varslot", length=4))
+ frml.id <- auto.ids(formula.dependent, prefix=ID.prefix("formula", length=3))
+ } else {}
+ } else if(!is.null(id.name)){
+ var.sel.attr <- list(id=id.name[[2]])
+ var.slot.id <- id.name[[3]]
+ if(!is.null(formula.dependent)){
+ var.dep.id <- id.name[[4]]
+ frml.id <- id.name[[5]]
+ } else {}
} else {}
- } else {}
- var.sel.attr[["label"]] <- label
+ var.sel.attr[["label"]] <- label
- v.selector <- rk.XML.varselector(
- label=label,
- id.name=var.sel.attr[["id"]])
+ v.selector <- rk.XML.varselector(
+ label=label,
+ id.name=var.sel.attr[["id"]])
- v.slot <- rk.XML.varslot(
- label=slot.text,
- source=v.selector,
- required=required,
- multi=multi,
- min=min,
- any=any,
- max=max,
- dim=dim,
- min.len=min.len,
- max.len=max.len,
- classes=classes,
- types=types,
- id.name=var.slot.id,
- help=help,
- component=component)
+ v.slot <- rk.XML.varslot(
+ label=slot.text,
+ source=v.selector,
+ required=required,
+ multi=multi,
+ duplicates=duplicates,
+ min=min,
+ any=any,
+ max=max,
+ dim=dim,
+ min.len=min.len,
+ max.len=max.len,
+ classes=classes,
+ types=types,
+ id.name=var.slot.id,
+ help=help,
+ component=component)
- slot.content <- list(v.slot)
+ slot.content <- list(v.slot)
- if(!is.null(formula.dependent)){
- dep.opt.names <- names(dep.options)
- dep.slot <- rk.XML.varslot(
- label=formula.dependent,
- source=v.selector,
- required=if ("required" %in% dep.opt.names) {dep.options[["required"]]} else {FALSE},
- multi=if ("multi" %in% dep.opt.names) {dep.options[["multi"]]} else {FALSE},
- min=if ("min" %in% dep.opt.names) {dep.options[["min"]]} else {1},
- any=if ("any" %in% dep.opt.names) {dep.options[["any"]]} else {1},
- max=if ("max" %in% dep.opt.names) {dep.options[["max"]]} else {0},
- dim=if ("dim" %in% dep.opt.names) {dep.options[["dim"]]} else {0},
- min.len=if ("min.len" %in% dep.opt.names) {dep.options[["min.len"]]} else {0},
- max.len=if ("max.len" %in% dep.opt.names) {dep.options[["max.len"]]} else {NULL},
- classes=if ("classes" %in% dep.opt.names) {dep.options[["classes"]]} else {NULL},
- types=if ("types" %in% dep.opt.names) {dep.options[["types"]]} else {NULL},
- id.name=var.dep.id,
- help=help,
- component=component)
- slot.content[[length(slot.content) + 1]] <- dep.slot
- formula.node <- rk.XML.formula(fixed=v.slot, dependent=dep.slot, id.name=frml.id)
- slot.content[[length(slot.content) + 1]] <- formula.node
- } else {}
+ if(!is.null(formula.dependent)){
+ dep.opt.names <- names(dep.options)
+ dep.slot <- rk.XML.varslot(
+ label=formula.dependent,
+ source=v.selector,
+ required=if ("required" %in% dep.opt.names) {dep.options[["required"]]} else {FALSE},
+ multi=if ("multi" %in% dep.opt.names) {dep.options[["multi"]]} else {FALSE},
+ min=if ("min" %in% dep.opt.names) {dep.options[["min"]]} else {1},
+ any=if ("any" %in% dep.opt.names) {dep.options[["any"]]} else {1},
+ max=if ("max" %in% dep.opt.names) {dep.options[["max"]]} else {0},
+ dim=if ("dim" %in% dep.opt.names) {dep.options[["dim"]]} else {0},
+ min.len=if ("min.len" %in% dep.opt.names) {dep.options[["min.len"]]} else {0},
+ max.len=if ("max.len" %in% dep.opt.names) {dep.options[["max.len"]]} else {NULL},
+ classes=if ("classes" %in% dep.opt.names) {dep.options[["classes"]]} else {NULL},
+ types=if ("types" %in% dep.opt.names) {dep.options[["types"]]} else {NULL},
+ id.name=var.dep.id,
+ help=help,
+ component=component)
+ slot.content[[length(slot.content) + 1]] <- dep.slot
+ formula.node <- rk.XML.formula(fixed=v.slot, dependent=dep.slot, id.name=frml.id)
+ slot.content[[length(slot.content) + 1]] <- formula.node
+ } else {}
- # do we need to add extra nodes to the varslot?
- if(!is.null(add.nodes)){
- for (this.node in add.nodes) {
- slot.content[[length(slot.content)+1]] <- this.node
- }
- } else {}
+ # do we need to add extra nodes to the varslot?
+ if(!is.null(add.nodes)){
+ for (this.node in child.list(add.nodes)) {
+ slot.content[[length(slot.content)+1]] <- this.node
+ }
+ } else {}
- if(isTRUE(horiz)){
- aligned.chld <- rk.XML.row(list(rk.XML.col(v.selector), rk.XML.col(slot.content)))
- } else {
- aligned.chld <- list(v.selector, unlist(slot.content))
- }
+ if(isTRUE(horiz)){
+ vars.frame <- rk.XML.frame(
+ rk.XML.row(list(rk.XML.col(v.selector), rk.XML.col(slot.content))),
+ label=frame.label,
+ id.name=id.name[[1]])
+ } else {
+ vars.frame <- rk.XML.frame(
+ v.selector,
+ label=frame.label,
+ id.name=id.name[[1]])
+ for (this.node in slot.content) {
+ XMLChildren(vars.frame) <- append(XMLChildren(vars.frame), this.node)
+ }
- vars.frame <- rk.XML.frame(
- children=child.list(aligned.chld),
- label=frame.label,
- id.name=id.name[[1]])
+ }
- return(vars.frame)
+ return(vars.frame)
}
diff --git a/packages/rkwarddev/R/rkwarddev-package.R b/packages/rkwarddev/R/rkwarddev-package.R
index ee41d1a..2bfe6b2 100644
--- a/packages/rkwarddev/R/rkwarddev-package.R
+++ b/packages/rkwarddev/R/rkwarddev-package.R
@@ -4,7 +4,7 @@
#' Package: \tab rkwarddev\cr
#' Type: \tab Package\cr
#' Version: \tab 0.06-6\cr
-#' Date: \tab 2014-12-14\cr
+#' Date: \tab 2014-12-17\cr
#' Depends: \tab R (>= 2.9.0),methods,XiMpLe (>= 0.03-21),rkward (>= 0.5.7)\cr
#' Enhances: \tab rkward\cr
#' Encoding: \tab UTF-8\cr
diff --git a/packages/rkwarddev/inst/NEWS.Rd b/packages/rkwarddev/inst/NEWS.Rd
index 1a084ea..4ba2a26 100644
--- a/packages/rkwarddev/inst/NEWS.Rd
+++ b/packages/rkwarddev/inst/NEWS.Rd
@@ -1,7 +1,7 @@
\name{NEWS}
\title{News for Package 'rkwarddev'}
\encoding{UTF-8}
-\section{Changes in rkwarddev version 0.06-6 (2014-12-14)}{
+\section{Changes in rkwarddev version 0.06-6 (2014-12-17)}{
\subsection{fixed}{
\itemize{
\item \code{rk.XML.optionset()} does now allow to re-use objects defined in the same
@@ -44,6 +44,8 @@
\item new function \code{R.comment()} to generate JavaScript "\code{comment()}" calls
\item first unit tests using the testthat package
\item added documentation to the used S4 classes
+ \item enhanced \code{rk.XML.values()} to also accept \code{"options"} and \code{"duplicates"}, and
+ \code{rk.XML.vars()} to also accept \code{"duplicates"}
}
}
\subsection{changed}{
@@ -59,6 +61,8 @@
\item internally, moved the definitions of valid child nodes and modifiers as
well as default getter functions and modifiers to separate files, so
they're more obvious to find and check
+ \item \code{rk.XML.input()} now checks wheter \code{"size"} is exactly one of \code{"small"},
+ \code{"medium"} or \code{"large"}
}
}
\subsection{removed}{
diff --git a/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf b/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
index 45b45cc..d94cd95 100644
Binary files a/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf and b/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf differ
diff --git a/packages/rkwarddev/man/rk.XML.require.Rd b/packages/rkwarddev/man/rk.XML.require.Rd
index cc5303b..836a1e4 100644
--- a/packages/rkwarddev/man/rk.XML.require.Rd
+++ b/packages/rkwarddev/man/rk.XML.require.Rd
@@ -3,7 +3,7 @@
\alias{rk.XML.require}
\title{Create XML "require" node for RKWard plugins}
\usage{
-rk.XML.require(file = NULL, map = NULL, localized = FALSE)
+rk.XML.require(file = NULL, map = NULL)
}
\arguments{
\item{file}{Character string,
@@ -13,11 +13,6 @@ preferred over \code{map} if that file is in the same package.}
\item{map}{Character string,
should be \code{"namespace::id"} of another .pluginmap to be included.
Can be used to address plugin maps which are not part of the same plugin package.}
-
-\item{localized}{Logical,
- only useful for plugins with static internationalisation. Adds the \code{localized}
-attribute if set to \code{TRUE}; \code{file} must then point to the default pluginmap in a subdirectory
-containing all localised pluginmaps.}
}
\value{
An object of class \code{XiMpLe.node}.
diff --git a/packages/rkwarddev/man/rk.XML.values.Rd b/packages/rkwarddev/man/rk.XML.values.Rd
index 1719e81..ceed367 100644
--- a/packages/rkwarddev/man/rk.XML.values.Rd
+++ b/packages/rkwarddev/man/rk.XML.values.Rd
@@ -3,9 +3,10 @@
\alias{rk.XML.values}
\title{Create a value selector for RKWard plugins}
\usage{
-rk.XML.values(label, slot.text, required = FALSE, multi = FALSE, min = 1,
- any = 1, max = 0, horiz = TRUE, add.nodes = NULL,
- frame.label = NULL, id.name = "auto", help = NULL,
+rk.XML.values(label, slot.text, options = list(label = c(val = NULL, chk =
+ FALSE, i18n = NULL)), required = FALSE, multi = FALSE,
+ duplicates = FALSE, min = 1, any = 1, max = 0, horiz = TRUE,
+ add.nodes = NULL, frame.label = NULL, id.name = "auto", help = NULL,
component = rk.get.comp())
}
\arguments{
@@ -13,10 +14,20 @@ rk.XML.values(label, slot.text, required = FALSE, multi = FALSE, min = 1,
\item{slot.text}{Character string, a text label for the value selection slot.}
+\item{options}{A named list with string values to choose from. The names of the list elements will become
+labels of the options, \code{val} defines the value to submit if the value is selected,
+ and
+\code{chk=TRUE} should be set in the one option which is checked by default. You might also provide an \code{i18n}
+for this particular option (see \code{i18n}). Objects generated with \code{\link[rkwarddev:rk.XML.option]{rk.XML.option}}
+are accepted as well.}
+
\item{required}{Logical, whether the selection of values is mandatory or not.}
\item{multi}{Logical, whether the valueslot holds only one or several objects.}
+\item{duplicates}{Logical,
+ if \code{multi=TRUE} defines whether the same entry may be added multiple times. Sets \code{multi=TRUE}.}
+
\item{min}{If \code{multi=TRUE} defines how many objects must be selected.}
\item{any}{If \code{multi=TRUE} defines how many objects must be selected at least if any
diff --git a/packages/rkwarddev/man/rk.XML.valueslot.Rd b/packages/rkwarddev/man/rk.XML.valueslot.Rd
index 4953437..06f1b57 100644
--- a/packages/rkwarddev/man/rk.XML.valueslot.Rd
+++ b/packages/rkwarddev/man/rk.XML.valueslot.Rd
@@ -17,7 +17,7 @@ a \code{<valueselector>} node, you must also specify a valid property for the no
\item{property}{Character string,
valid property for a XiMpLe node defined by \code{source}. In the XML code, it
-will cause the use of \code{source_property} instead of \code{source}. Only used if \code{source} ist not a
+will cause the use of \code{source_property} instead of \code{source}. Only used if \code{source} is not a
\code{<valueselector>} node.}
\item{required}{Logical, whether the selection of values is mandatory or not.}
diff --git a/packages/rkwarddev/man/rk.XML.vars.Rd b/packages/rkwarddev/man/rk.XML.vars.Rd
index 40e99b5..39b36f9 100644
--- a/packages/rkwarddev/man/rk.XML.vars.Rd
+++ b/packages/rkwarddev/man/rk.XML.vars.Rd
@@ -3,11 +3,12 @@
\alias{rk.XML.vars}
\title{Create a variable selector for RKWard plugins}
\usage{
-rk.XML.vars(label, slot.text, required = FALSE, multi = FALSE, min = 1,
- any = 1, max = 0, dim = 0, min.len = 0, max.len = NULL,
- classes = NULL, types = NULL, horiz = TRUE, add.nodes = NULL,
- frame.label = NULL, formula.dependent = NULL, dep.options = list(),
- id.name = "auto", help = NULL, component = rk.get.comp())
+rk.XML.vars(label, slot.text, required = FALSE, multi = FALSE,
+ duplicates = FALSE, min = 1, any = 1, max = 0, dim = 0,
+ min.len = 0, max.len = NULL, classes = NULL, types = NULL,
+ horiz = TRUE, add.nodes = NULL, frame.label = NULL,
+ formula.dependent = NULL, dep.options = list(), id.name = "auto",
+ help = NULL, component = rk.get.comp())
}
\arguments{
\item{label}{Character string, a text label for the variable browser.}
@@ -18,6 +19,9 @@ rk.XML.vars(label, slot.text, required = FALSE, multi = FALSE, min = 1,
\item{multi}{Logical, whether the varslot holds only one or several objects.}
+\item{duplicates}{Logical,
+ if \code{multi=TRUE} defines whether the same entry may be added multiple times. Sets \code{multi=TRUE}.}
+
\item{min}{If \code{multi=TRUE} defines how many objects must be selected.}
\item{any}{If \code{multi=TRUE} defines how many objects must be selected at least if any
diff --git a/packages/rkwarddev/man/rkwarddev-package.Rd b/packages/rkwarddev/man/rkwarddev-package.Rd
index 29d509c..8995207 100644
--- a/packages/rkwarddev/man/rkwarddev-package.Rd
+++ b/packages/rkwarddev/man/rkwarddev-package.Rd
@@ -11,7 +11,7 @@ A collection of tools for RKWard plugin development.
Package: \tab rkwarddev\cr
Type: \tab Package\cr
Version: \tab 0.06-6\cr
-Date: \tab 2014-12-14\cr
+Date: \tab 2014-12-17\cr
Depends: \tab R (>= 2.9.0),methods,XiMpLe (>= 0.03-21),rkward (>= 0.5.7)\cr
Enhances: \tab rkward\cr
Encoding: \tab UTF-8\cr
diff --git a/packages/rkwarddev/tests/generate_test_standards.R b/packages/rkwarddev/tests/generate_test_standards.R
index de5dcce..f245de2 100644
--- a/packages/rkwarddev/tests/generate_test_standards.R
+++ b/packages/rkwarddev/tests/generate_test_standards.R
@@ -133,7 +133,8 @@ XMLTestNodes <- function(file=NULL, compress="xz", compression_level=-9){
embed <- rk.XML.embed(
component="componentID",
button=TRUE,
- label="an embed label"
+ label="an embed label",
+ i18n=list(context="context info here")
)
entry <- rk.XML.entry(
component=rk.XML.component(
@@ -156,7 +157,8 @@ XMLTestNodes <- function(file=NULL, compress="xz", compression_level=-9){
),
label="a frame label",
checkable=TRUE,
- chk=FALSE
+ chk=FALSE,
+ i18n=list(context="context info here")
)
help <- rk.XML.help(
"help_file.rkh"
@@ -179,16 +181,9 @@ XMLTestNodes <- function(file=NULL, compress="xz", compression_level=-9){
initial="init",
size="small",
required=TRUE,
+ i18n=list(context="context info here")
)
- insert <- rk.XML.insert(
- snippet=rk.XML.snippet(
- rk.XML.vars(
- "Variables",
- "Fixed",
- formula.dependent="Dependent"
- )
- )
- )
+ # insert: see below
logic=rk.XML.logic(
rk.XML.connect(
governor="myGovernor",
@@ -208,7 +203,8 @@ XMLTestNodes <- function(file=NULL, compress="xz", compression_level=-9){
fixed_width=TRUE,
fixed_height=TRUE,
horiz_headers=c("hone", "htwo", "hthree"),
- vert_headers=c("vone", "vtwo", "vthree")
+ vert_headers=c("vone", "vtwo", "vthree"),
+ i18n=list(context="context info here")
)
menu <- rk.XML.menu(
"Analysis",
@@ -218,14 +214,16 @@ XMLTestNodes <- function(file=NULL, compress="xz", compression_level=-9){
file="plugins/MyOtherGUIdialog.xml"
)
),
- index=3
+ index=3,
+ i18n=list(context="context info here")
)
optioncolumn <- rk.XML.optioncolumn(
connect=rk.XML.input(label="an optioncolumn label"),
modifier="text",
label=TRUE,
external=TRUE,
- default="rarely useful"
+ default="rarely useful",
+ i18n=list(context="context info here")
)
optiondisplay <- rk.XML.optiondisplay(
index=FALSE
@@ -233,7 +231,8 @@ XMLTestNodes <- function(file=NULL, compress="xz", compression_level=-9){
option <- rk.XML.option(
label="an option label",
val="value",
- chk=TRUE
+ chk=TRUE,
+ i18n=list(context="context info here")
)
optionset <- rk.XML.optionset(
content=list(
@@ -259,65 +258,209 @@ XMLTestNodes <- function(file=NULL, compress="xz", compression_level=-9){
page <- rk.XML.page(
rk.XML.text("a page text")
)
-# pluginmap <- rk.XML.pluginmap(
-# name="a plugin name",
-# about=NULL,
-# components=components,
-# hierarchy="test",
-# require=NULL,
-# x11.context=NULL,
-# import.context=NULL,
-# clean.name=TRUE,
-# hints=FALSE,
-# gen.info=TRUE,
-# dependencies=NULL,
-# namespace=name,
-# priority="medium"
-# )
-# plugin <- rk.XML.plugin(
-# )
-# preview <- rk.XML.preview(
-# )
-# radio <- rk.XML.radio(
-# )
-# require <- rk.XML.require(
-# )
-# row <- rk.XML.row(
-# )
-# saveobj <- rk.XML.saveobj(
-# )
-# select <- rk.XML.select(
-# )
-# set <- rk.XML.set(
-# )
-# snippet <- rk.XML.snippet(
-# )
-# snippets <- rk.XML.snippets(
-# )
-# spinbox <- rk.XML.spinbox(
-# )
-# stretch <- rk.XML.stretch(
-# )
-# XMLswitch <- rk.XML.switch(
-# )
-# tabbook <- rk.XML.tabbook(
-# )
-# text <- rk.XML.text(
-# )
-# valueselector <- rk.XML.valueselector(
-# )
-# valueslot <- rk.XML.valueslot(
-# )
-# values <- rk.XML.values(
-# )
-# varselector <- rk.XML.varselector(
-# )
-# varslot <- rk.XML.varslot(
-# )
-# vars <- rk.XML.vars(
-# )
-# wizard <- rk.XML.wizard(
-# )
+ # pluginmap: see below
+ # plugin: see below
+ preview <- rk.XML.preview(
+ label="a perview label",
+ i18n=list(context="context info here")
+ )
+ radio <- rk.XML.radio(
+ label="a radio label",
+ options=list(
+ value1=c(val="value1", chk=FALSE, i18n=list(context="value1 context info here")),
+ value2=option
+ ),
+ i18n=list(context="context info here")
+ )
+ require <- rk.XML.require(
+ file="your.pluginmap"
+# map="rkward::yourID"
+ )
+ row <- rk.XML.row(
+ preview
+ )
+ saveobj <- rk.XML.saveobj(
+ label="a saveobj label",
+ chk=TRUE,
+ checkable=TRUE,
+ initial="my.RData",
+ required=TRUE,
+ i18n=list(context="context info here")
+ )
+ select <- rk.XML.select(
+ label="a select label",
+ options=list(
+ value1=option,
+ value2=c(val="value2", chk=FALSE, i18n=list(context="value1 context info here"))
+ ),
+ i18n=list(context="context info here")
+ )
+ set <- rk.XML.set(
+ id=input,
+ set="required",
+ to=TRUE
+ )
+ snippet <- rk.XML.snippet(
+ rk.XML.vars(
+ "Variables",
+ "Fixed",
+ formula.dependent="Dependent"
+ )
+ )
+ snippets <- rk.XML.snippets(
+ snippet,
+ include
+ )
+ spinbox <- rk.XML.spinbox(
+ label="a spinbox label",
+ min=0,
+ max=23,
+ initial=17,
+ real=TRUE,
+ precision=1,
+ max.precision=5,
+ i18n=list(context="context info here")
+ )
+ stretch <- rk.XML.stretch(
+ before=rk.XML.text("a stretch text"),
+ after=rk.XML.text("more text")
+ )
+ XMLswitch <- rk.XML.switch(
+ rk.XML.cbox("foo"),
+ cases=list(
+ true=list(fixed_value="foo"),
+ false=list(fixed_value="bar")
+ )
+ )
+ tabbook <- rk.XML.tabbook("My Tabbook",
+ tabs=list(
+ "First Tab"=rk.XML.col(
+ rk.XML.cbox(label="foo", val="foo1", chk=TRUE)
+ ),
+ "Second Tab"=rk.XML.col(
+ rk.XML.cbox(label="bar", val="bar2")
+ )
+ ),
+ i18n=list(context="context info here")
+ )
+ text <- rk.XML.text(
+ "wow, cool text!",
+ type="warning",
+ i18n=list(context="context info here")
+ )
+ valueselector <- rk.XML.valueselector(
+ label="a valueselector label",
+ options=list(
+ value1=option,
+ value2=c(val="value2", chk=FALSE, i18n=list(context="value1 context info here"))
+ ),
+ i18n=list(context="context info here")
+ )
+ valueslot <- rk.XML.valueslot(
+ label="a valueslot label",
+ source=valueselector,
+ required=TRUE,
+ duplicates=TRUE,
+ min=2,
+ any=3,
+ max=10,
+ i18n=list(context="context info here")
+ )
+ values <- rk.XML.values(
+ label="a values label",
+ slot.text="some slot text",
+ options=list(
+ value1=option,
+ value2=c(val="value2", chk=FALSE, i18n=list(context="value1 context info here"))
+ ),
+ required=TRUE,
+ duplicates=TRUE,
+ min=2,
+ any=3,
+ max=10,
+ horiz=FALSE,
+ add.nodes=rk.XML.text("more text"),
+ frame.label="this is a frame"
+ )
+ varselector <- rk.XML.varselector(
+ label="a varselector label",
+ i18n=list(context="context info here")
+ )
+ varslot <- rk.XML.varslot(
+ label="a varslot label",
+ source=varselector,
+ required=TRUE,
+ duplicates=TRUE,
+ min=3,
+ any=5,
+ max=20,
+ dim=1,
+ min.len=2,
+ max.len=6,
+ classes=c("matrix"),
+ types=c("number"),
+ i18n=list(context="context info here")
+ )
+ vars <- rk.XML.vars(
+ label="a vars label",
+ slot.text="some more text",
+ required=TRUE,
+ duplicates=TRUE,
+ min=3,
+ any=5,
+ max=20,
+ dim=1,
+ min.len=2,
+ max.len=6,
+ classes=c("matrix"),
+ types=c("number"),
+ horiz=TRUE,
+ add.nodes=list(rk.XML.text("more text")),
+ frame.label="this is a frame",
+ formula.dependent="formulate some",
+ dep.options=list(min=3)
+ )
+ wizard <- rk.XML.wizard(
+ rk.XML.text("a wizard text"),
+ label="a wizard label",
+ recommended=TRUE,
+ i18n=list(context="context info here")
+ )
+
+ ## this is "below" ;-)
+ # re-using some previously defined objects
+ insert <- rk.XML.insert(
+ snippet=snippet
+ )
+ pluginmap <- rk.XML.pluginmap(
+ name="pluginName",
+ about=about,
+ components=components,
+ hierarchy=hierarchy,
+ require=require,
+ x11.context=context,
+ import.context=NULL,
+ clean.name=TRUE,
+ hints=FALSE,
+ gen.info=TRUE,
+ dependencies=dependencies,
+ priority="medium"
+ )
+ plugin <- rk.XML.plugin(
+ name="testPlugin",
+ dialog=dialog,
+ wizard=wizard,
+ logic=logic,
+ snippets=snippets,
+ help=TRUE,
+ include="../include_another_file.xml",
+ label="a plugin label",
+ clean.name=TRUE,
+ about=about,
+ dependencies=dependencies,
+ gen.info=TRUE,
+ i18n=list(context="context info here")
+ )
XML_test_standards <- list(
about=about,
@@ -353,30 +496,30 @@ XMLTestNodes <- function(file=NULL, compress="xz", compression_level=-9){
optiondisplay=optiondisplay,
option=option,
optionset=optionset,
- page=page#,
-# pluginmap=pluginmap,
-# plugin=plugin,
-# preview=preview,
-# radio=radio,
-# require=require,
-# row=row,
-# saveobj=saveobj,
-# select=select,
-# set=set,
-# snippet=snippet,
-# snippets=snippets,
-# spinbox=spinbox,
-# stretch=stretch,
-# switch=XMLswitch,
-# tabbook=tabbook,
-# text=text,
-# valueselector=valueselector,
-# valueslot=valueslot,
-# values=values,
-# varselector=varselector,
-# varslot=varslot,
-# vars=vars,
-# wizard=wizard
+ page=page,
+ pluginmap=pluginmap,
+ plugin=plugin,
+ preview=preview,
+ radio=radio,
+ require=require,
+ row=row,
+ saveobj=saveobj,
+ select=select,
+ set=set,
+ snippet=snippet,
+ snippets=snippets,
+ spinbox=spinbox,
+ stretch=stretch,
+ switch=XMLswitch,
+ tabbook=tabbook,
+ text=text,
+ valueselector=valueselector,
+ valueslot=valueslot,
+ values=values,
+ varselector=varselector,
+ varslot=varslot,
+ vars=vars,
+ wizard=wizard
)
if(is.null(file)){
diff --git a/packages/rkwarddev/tests/testthat/XML_test_standards.RData b/packages/rkwarddev/tests/testthat/XML_test_standards.RData
index a7c957c..2741a39 100644
Binary files a/packages/rkwarddev/tests/testthat/XML_test_standards.RData and b/packages/rkwarddev/tests/testthat/XML_test_standards.RData differ
diff --git a/packages/rkwarddev/tests/testthat/test_XML_generation.R b/packages/rkwarddev/tests/testthat/test_XML_generation.R
index f12e582..490909b 100644
--- a/packages/rkwarddev/tests/testthat/test_XML_generation.R
+++ b/packages/rkwarddev/tests/testthat/test_XML_generation.R
@@ -250,7 +250,8 @@ test_that("rk.XML.embed", {
thisNode <- rk.XML.embed(
component="componentID",
button=TRUE,
- label="an embed label"
+ label="an embed label",
+ i18n=list(context="context info here")
)
load("XML_test_standards.RData")
expect_that(
@@ -301,7 +302,8 @@ test_that("rk.XML.frame", {
),
label="a frame label",
checkable=TRUE,
- chk=FALSE
+ chk=FALSE,
+ i18n=list(context="context info here")
)
load("XML_test_standards.RData")
expect_that(
@@ -352,6 +354,7 @@ test_that("rk.XML.input", {
initial="init",
size="small",
required=TRUE,
+ i18n=list(context="context info here")
)
load("XML_test_standards.RData")
expect_that(
@@ -402,7 +405,8 @@ test_that("rk.XML.matrix", {
fixed_width=TRUE,
fixed_height=TRUE,
horiz_headers=c("hone", "htwo", "hthree"),
- vert_headers=c("vone", "vtwo", "vthree")
+ vert_headers=c("vone", "vtwo", "vthree"),
+ i18n=list(context="context info here")
)
load("XML_test_standards.RData")
expect_that(
@@ -419,7 +423,8 @@ test_that("rk.XML.menu", {
file="plugins/MyOtherGUIdialog.xml"
)
),
- index=3
+ index=3,
+ i18n=list(context="context info here")
)
load("XML_test_standards.RData")
expect_that(
@@ -433,7 +438,8 @@ test_that("rk.XML.optioncolumn", {
modifier="text",
label=TRUE,
external=TRUE,
- default="rarely useful"
+ default="rarely useful",
+ i18n=list(context="context info here")
)
load("XML_test_standards.RData")
expect_that(
@@ -455,7 +461,8 @@ test_that("rk.XML.option", {
thisNode <- rk.XML.option(
label="an option label",
val="value",
- chk=TRUE
+ chk=TRUE,
+ i18n=list(context="context info here")
)
load("XML_test_standards.RData")
expect_that(
@@ -501,6 +508,521 @@ test_that("rk.XML.page", {
)
})
+test_that("rk.XML.pluginmap", {
+ thisNode <- rk.XML.pluginmap(
+ name="pluginName",
+ about=rk.XML.about(
+ name="Square the circle",
+ author=c(
+ person(given="E.A.", family="Dölle",
+ email="doelle at eternalwondermaths.example.org", role="aut"),
+ person(given="A.", family="Assistant",
+ email="alterego at eternalwondermaths.example.org", role=c("cre","ctb"))
+ ),
+ about=list(
+ desc="Squares the circle using Heisenberg compensation.",
+ version="0.1-3",
+ date=as.Date("2014-12-12"),
+ url="http://eternalwondermaths.example.org/23/stc.html",
+ license="GPL",
+ category="Geometry")
+ ),
+ components=rk.XML.components(
+ rk.XML.component(
+ label="a components label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
+ ),
+ hierarchy=rk.XML.hierarchy(
+ rk.XML.menu("Analysis",
+ rk.XML.entry(
+ rk.XML.component(
+ label="a hierarchy label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
+ )
+ )
+ ),
+ require=rk.XML.require(
+ file="your.pluginmap"
+ ),
+ x11.context=rk.XML.context(
+ rk.XML.menu("Analysis",
+ rk.XML.entry(
+ rk.XML.component(
+ label="a context label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
+ )
+ )
+ ),
+ import.context=NULL,
+ clean.name=TRUE,
+ hints=FALSE,
+ gen.info=TRUE,
+ dependencies=rk.XML.dependencies(
+ dependencies=list(
+ rkward.min="0.6.3",
+ rkward.max="0.6.5",
+ R.min="3.1",
+ R.max="3.2"),
+ package=list(
+ c(name="heisenberg", min="0.11-2", max="0.14-1",
+ repository="http://hsb.example.org"),
+ c(name="DreamsOfPi", min="0.2", max="3.1", repository="http://dop.example.org")),
+ pluginmap=list(
+ c(name="heisenberg.pluginmap", url="http://eternalwondermaths.example.org/hsb"))
+ ),
+ priority="medium"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["pluginmap"]])
+ )
+})
+
+test_that("rk.XML.plugin", {
+ thisNode <- rk.XML.plugin(
+ name="testPlugin",
+ dialog=rk.XML.dialog(
+ rk.XML.col(
+ rk.XML.cbox(label="a dialog column label")
+ ),
+ label="a dialog label",
+ recommended=TRUE,
+ i18n=list(context="context info here")
+ ),
+ wizard=rk.XML.wizard(
+ rk.XML.text("a wizard text"),
+ label="a wizard label",
+ recommended=TRUE,
+ i18n=list(context="context info here")
+ ),
+ logic=rk.XML.logic(
+ rk.XML.connect(
+ governor="myGovernor",
+ client="myCLient"
+ )
+ ),
+ snippets=rk.XML.snippets(
+ rk.XML.snippet(
+ rk.XML.vars(
+ "Variables",
+ "Fixed",
+ formula.dependent="Dependent"
+ )
+ ),
+ rk.XML.include(
+ "../include_file.xml"
+ )
+ ),
+ help=TRUE,
+ include="../include_another_file.xml",
+ label="a plugin label",
+ clean.name=TRUE,
+ about=rk.XML.about(
+ name="Square the circle",
+ author=c(
+ person(given="E.A.", family="Dölle",
+ email="doelle at eternalwondermaths.example.org", role="aut"),
+ person(given="A.", family="Assistant",
+ email="alterego at eternalwondermaths.example.org", role=c("cre","ctb"))
+ ),
+ about=list(
+ desc="Squares the circle using Heisenberg compensation.",
+ version="0.1-3",
+ date=as.Date("2014-12-12"),
+ url="http://eternalwondermaths.example.org/23/stc.html",
+ license="GPL",
+ category="Geometry")
+ ),
+ dependencies=rk.XML.dependencies(
+ dependencies=list(
+ rkward.min="0.6.3",
+ rkward.max="0.6.5",
+ R.min="3.1",
+ R.max="3.2"),
+ package=list(
+ c(name="heisenberg", min="0.11-2", max="0.14-1",
+ repository="http://hsb.example.org"),
+ c(name="DreamsOfPi", min="0.2", max="3.1", repository="http://dop.example.org")),
+ pluginmap=list(
+ c(name="heisenberg.pluginmap", url="http://eternalwondermaths.example.org/hsb"))
+ ),
+ gen.info=TRUE,
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["plugin"]])
+ )
+})
+
+
+test_that("rk.XML.preview", {
+ thisNode <- rk.XML.preview(
+ label="a perview label",
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["preview"]])
+ )
+})
+
+test_that("rk.XML.radio", {
+ thisNode <- rk.XML.radio(
+ label="a radio label",
+ options=list(
+ value1=c(val="value1", chk=FALSE, i18n=list(context="value1 context info here")),
+ value2=rk.XML.option(
+ label="an option label",
+ val="value",
+ chk=TRUE,
+ i18n=list(context="context info here")
+ )
+ ),
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["radio"]])
+ )
+})
+
+test_that("rk.XML.require", {
+ thisNode <- rk.XML.require(
+ file="your.pluginmap"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["require"]])
+ )
+})
+
+test_that("rk.XML.row", {
+ thisNode <- rk.XML.row(
+ rk.XML.preview(
+ label="a perview label",
+ i18n=list(context="context info here")
+ )
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["row"]])
+ )
+})
+
+test_that("rk.XML.saveobj", {
+ thisNode <- rk.XML.saveobj(
+ label="a saveobj label",
+ chk=TRUE,
+ checkable=TRUE,
+ initial="my.RData",
+ required=TRUE,
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["saveobj"]])
+ )
+})
+
+test_that("rk.XML.select", {
+ thisNode <- rk.XML.select(
+ label="a select label",
+ options=list(
+ value1=rk.XML.option(
+ label="an option label",
+ val="value",
+ chk=TRUE,
+ i18n=list(context="context info here")
+ ),
+ value2=c(val="value2", chk=FALSE, i18n=list(context="value1 context info here"))
+ ),
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["select"]])
+ )
+})
+
+test_that("rk.XML.set", {
+ thisNode <- rk.XML.set(
+ id=rk.XML.input(
+ label="an input label",
+ initial="init",
+ size="small",
+ required=TRUE,
+ i18n=list(context="context info here")
+ ),
+ set="required",
+ to=TRUE
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["set"]])
+ )
+})
+
+test_that("rk.XML.snippet", {
+ thisNode <- rk.XML.snippet(
+ rk.XML.vars(
+ "Variables",
+ "Fixed",
+ formula.dependent="Dependent"
+ )
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["snippet"]])
+ )
+})
+
+test_that("rk.XML.snippets", {
+ thisNode <- rk.XML.snippets(
+ rk.XML.snippet(
+ rk.XML.vars(
+ "Variables",
+ "Fixed",
+ formula.dependent="Dependent"
+ )
+ ),
+ rk.XML.include(
+ "../include_file.xml"
+ )
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["snippets"]])
+ )
+})
+
+test_that("rk.XML.spinbox", {
+ thisNode <- rk.XML.spinbox(
+ label="a spinbox label",
+ min=0,
+ max=23,
+ initial=17,
+ real=TRUE,
+ precision=1,
+ max.precision=5,
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["spinbox"]])
+ )
+})
+
+test_that("rk.XML.stretch", {
+ thisNode <- rk.XML.stretch(
+ before=rk.XML.text("a stretch text"),
+ after=rk.XML.text("more text")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["stretch"]])
+ )
+})
+
+test_that("rk.XML.switch", {
+ thisNode <- rk.XML.switch(
+ rk.XML.cbox("foo"),
+ cases=list(
+ true=list(fixed_value="foo"),
+ false=list(fixed_value="bar")
+ )
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["switch"]])
+ )
+})
+
+test_that("rk.XML.tabbook", {
+ thisNode <- rk.XML.tabbook("My Tabbook",
+ tabs=list(
+ "First Tab"=rk.XML.col(
+ rk.XML.cbox(label="foo", val="foo1", chk=TRUE)
+ ),
+ "Second Tab"=rk.XML.col(
+ rk.XML.cbox(label="bar", val="bar2")
+ )
+ ),
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["tabbook"]])
+ )
+})
+
+test_that("rk.XML.text", {
+ thisNode <- rk.XML.text(
+ "wow, cool text!",
+ type="warning",
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["text"]])
+ )
+})
+
+test_that("rk.XML.valueselector", {
+ thisNode <- rk.XML.valueselector(
+ label="a valueselector label",
+ options=list(
+ value1=rk.XML.option(
+ label="an option label",
+ val="value",
+ chk=TRUE,
+ i18n=list(context="context info here")
+ ),
+ value2=c(val="value2", chk=FALSE, i18n=list(context="value1 context info here"))
+ ),
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["valueselector"]])
+ )
+})
+
+test_that("rk.XML.valueslot", {
+ thisNode <- rk.XML.valueslot(
+ label="a valueslot label",
+ source=rk.XML.valueselector(
+ label="a valueselector label",
+ options=list(
+ value1=rk.XML.option(
+ label="an option label",
+ val="value",
+ chk=TRUE,
+ i18n=list(context="context info here")
+ ),
+ value2=c(val="value2", chk=FALSE, i18n=list(context="value1 context info here"))
+ ),
+ i18n=list(context="context info here")
+ ),
+ required=TRUE,
+ duplicates=TRUE,
+ min=2,
+ any=3,
+ max=10,
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["valueslot"]])
+ )
+})
+
+test_that("rk.XML.values", {
+ thisNode <- rk.XML.values(
+ label="a values label",
+ slot.text="some slot text",
+ options=list(
+ value1=rk.XML.option(
+ label="an option label",
+ val="value",
+ chk=TRUE,
+ i18n=list(context="context info here")
+ ),
+ value2=c(val="value2", chk=FALSE, i18n=list(context="value1 context info here"))
+ ),
+ required=TRUE,
+ duplicates=TRUE,
+ min=2,
+ any=3,
+ max=10,
+ horiz=FALSE,
+ add.nodes=rk.XML.text("more text"),
+ frame.label="this is a frame"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["values"]])
+ )
+})
+
+test_that("rk.XML.varselector", {
+ thisNode <- rk.XML.varselector(
+ label="a varselector label",
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["varselector"]])
+ )
+})
+
+test_that("rk.XML.varslot", {
+ thisNode <- rk.XML.varslot(
+ label="a varslot label",
+ source=rk.XML.varselector(
+ label="a varselector label",
+ i18n=list(context="context info here")
+ ),
+ required=TRUE,
+ duplicates=TRUE,
+ min=3,
+ any=5,
+ max=20,
+ dim=1,
+ min.len=2,
+ max.len=6,
+ classes=c("matrix"),
+ types=c("number"),
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["varslot"]])
+ )
+})
+
+test_that("rk.XML.vars", {
+ thisNode <- rk.XML.vars(
+ label="a vars label",
+ slot.text="some more text",
+ required=TRUE,
+ duplicates=TRUE,
+ min=3,
+ any=5,
+ max=20,
+ dim=1,
+ min.len=2,
+ max.len=6,
+ classes=c("matrix"),
+ types=c("number"),
+ horiz=TRUE,
+ add.nodes=list(rk.XML.text("more text")),
+ frame.label="this is a frame",
+ formula.dependent="formulate some",
+ dep.options=list(min=3)
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["vars"]])
+ )
+})
+
+test_that("rk.XML.wizard", {
+ thisNode <- rk.XML.wizard(
+ rk.XML.text("a wizard text"),
+ label="a wizard label",
+ recommended=TRUE,
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["wizard"]])
+ )
+})
+
# test_that("", {
# thisNode <-
# load("XML_test_standards.RData")
More information about the rkward-tracker
mailing list