[rkward-cvs] [rkward] packages/rkwarddev: more unit tests, and made rk.XML.input() a bit more strict
m.eik michalke
meik.michalke at uni-duesseldorf.de
Tue Dec 16 15:19:23 UTC 2014
Git commit 641dbbc0522a923b01812abcc7b1cd18f5e7accf by m.eik michalke.
Committed on 16/12/2014 at 15:18.
Pushed by meikm into branch 'master'.
more unit tests, and made rk.XML.input() a bit more strict
M +1 -0 packages/rkwarddev/ChangeLog
M +7 -3 packages/rkwarddev/R/rk.XML.input.R
M +321 -116 packages/rkwarddev/tests/generate_test_standards.R
M +- -- packages/rkwarddev/tests/testthat/XML_test_standards.RData
M +450 -193 packages/rkwarddev/tests/testthat/test_XML_generation.R
http://commits.kde.org/rkward/641dbbc0522a923b01812abcc7b1cd18f5e7accf
diff --git a/packages/rkwarddev/ChangeLog b/packages/rkwarddev/ChangeLog
index b9d5cd8..cb576ed 100644
--- a/packages/rkwarddev/ChangeLog
+++ b/packages/rkwarddev/ChangeLog
@@ -51,6 +51,7 @@ 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"
removed:
- the functions rk.set.language() rk.get.language() were no longer useful
and therefore removed
diff --git a/packages/rkwarddev/R/rk.XML.input.R b/packages/rkwarddev/R/rk.XML.input.R
index 42d2bb4..84dc410 100644
--- a/packages/rkwarddev/R/rk.XML.input.R
+++ b/packages/rkwarddev/R/rk.XML.input.R
@@ -55,9 +55,13 @@ rk.XML.input <- function(label, initial=NULL, size="medium", required=FALSE, id.
if(!is.null(initial)){
attr.list[["initial"]] <- initial
} else {}
- if(identical(size, "small") | identical(size, "large")){
- attr.list[["size"]] <- size
- } else {}
+ if(size %in% c("small", "medium", "large")){
+ if(!identical(size, "medium")){
+ attr.list[["size"]] <- size
+ } else {}
+ } else {
+ stop(simpleError("rk.XML.input: \"size\" must be one of \"small\", \"medium\" or \"large\"!"))
+ }
if(isTRUE(required)){
attr.list[["required"]] <- "true"
} else {}
diff --git a/packages/rkwarddev/tests/generate_test_standards.R b/packages/rkwarddev/tests/generate_test_standards.R
index 8f0699a..de5dcce 100644
--- a/packages/rkwarddev/tests/generate_test_standards.R
+++ b/packages/rkwarddev/tests/generate_test_standards.R
@@ -3,175 +3,380 @@ require(rkwarddev)
# returns the list if file=NULL
XMLTestNodes <- function(file=NULL, compress="xz", compression_level=-9){
- XML_test_standards <- list(
- about=rk.XML.about(
+ 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"))
- ),
+ 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")
- ),
- attribute=rk.XML.attribute(
+ 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")
+ )
+ attribute <- rk.XML.attribute(
id="testID",
label="an attribute label",
value="checked"
- ),
- browser=rk.XML.browser(
+ )
+ browser <- rk.XML.browser(
label="a browser label",
type="dir",
initial="/tmp/initial",
filter=c("*initial", "*csv"),
required=TRUE,
i18n=list(context="context info here")
- ),
- checkbox=rk.XML.cbox(
+ )
+ checkbox <- rk.XML.cbox(
label="a checbox label",
value="checked",
chk=TRUE,
un.value="unchecked",
i18n=list(context="context info here")
- ),
- code=rk.XML.code(
+ )
+ code <- rk.XML.code(
file="some_file.js"
- ),
- col=rk.XML.col(
+ )
+ col <- rk.XML.col(
rk.XML.cbox(label="a column label")
- ),
- component=rk.XML.component(
+ )
+ component <- rk.XML.component(
label="a component label",
file="plugins/MyGUIdialog.xml",
i18n=list(context="context info here")
- ),
- components=rk.XML.components(
+ )
+ components <- rk.XML.components(
rk.XML.component(
- label="a components label",
- file="plugins/MyOtherGUIdialog.xml"
+ label="a components label",
+ file="plugins/MyOtherGUIdialog.xml"
)
- ),
- connect=rk.XML.connect(
+ )
+ connect <- rk.XML.connect(
governor="myGovernor",
client="myCLient",
get="visible",
set="string",
not=TRUE,
reconcile=TRUE
- ),
- context=rk.XML.context(
+ )
+ context <- rk.XML.context(
rk.XML.menu("Analysis",
- rk.XML.entry(
- rk.XML.component(
- label="a context label",
- file="plugins/MyOtherGUIdialog.xml"
+ rk.XML.entry(
+ rk.XML.component(
+ label="a context label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
)
- )
)
- ),
- convert=rk.XML.convert(
+ )
+ convert <- rk.XML.convert(
sources=list(text=rk.XML.input("a convert label")),
mode=c(equals="myValue"),
required=TRUE
- ),
- copy=rk.XML.copy(
+ )
+ copy <- rk.XML.copy(
id="aCopyID",
as="page"
- ),
- dependencies=rk.XML.dependencies(
+ )
+ dependencies <- rk.XML.dependencies(
dependencies=list(
- rkward.min="0.6.3",
- rkward.max="0.6.5",
- R.min="3.1",
- R.max="3.2"),
+ 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")),
+ 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"))
- ),
- dependency_check=rk.XML.dependency_check(
+ c(name="heisenberg.pluginmap", url="http://eternalwondermaths.example.org/hsb"))
+ )
+ dependency_check <- rk.XML.dependency_check(
id.name="dependency",
dependencies=list(
- rkward.min="0.6.3",
- rkward.max="0.6.5",
- R.min="3.1",
- R.max="3.2"),
+ 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")),
+ 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"))
- ),
- dialog=rk.XML.dialog(
+ c(name="heisenberg.pluginmap", url="http://eternalwondermaths.example.org/hsb"))
+ )
+ dialog <- rk.XML.dialog(
rk.XML.col(
- rk.XML.cbox(label="a dialog column label")
+ rk.XML.cbox(label="a dialog column label")
),
label="a dialog label",
recommended=TRUE,
i18n=list(context="context info here")
- ),
- dropdown=rk.XML.dropdown(
- label="myDropdownMenu",
+ )
+ dropdown <- rk.XML.dropdown(
+ label="a dropdown label",
options=list(
- "First Option"=c(val="val1"),
- rk.XML.option(
- "Second Option", val="val2", id.name="auto",
- i18n=list(context="context info1 here")
- ),
- "Third Option"=c(val="val3", chk=TRUE)
+ "First Option"=c(val="val1"),
+ rk.XML.option(
+ "Second Option", val="val2", id.name="auto",
+ i18n=list(context="context info1 here")
+ ),
+ "Third Option"=c(val="val3", chk=TRUE)
),
i18n=list(context="context info2 here")
- )#,
-# embed=rk.XML.embed(),
-# entry=rk.XML.entry(),
-# external=rk.XML.external(),
-# formula=rk.XML.formula(),
-# frame=rk.XML.frame(),
-# help=rk.XML.help(),
-# hierarchy=rk.XML.hierarchy(),
-# include=rk.XML.include(),
-# input=rk.XML.input(),
-# insert=rk.XML.insert(),
-# logic=rk.XML.logic(),
-# matrix=rk.XML.matrix(),
-# menu=rk.XML.menu(),
-# optioncolumn=rk.XML.optioncolumn(),
-# optiondisplay=rk.XML.optiondisplay(),
-# option=rk.XML.option(),
-# optionset=rk.XML.optionset(),
-# page=rk.XML.page(),
-# pluginmap=rk.XML.pluginmap(),
-# 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(),
-# switch=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()
+ )
+ embed <- rk.XML.embed(
+ component="componentID",
+ button=TRUE,
+ label="an embed label"
+ )
+ entry <- rk.XML.entry(
+ component=rk.XML.component(
+ label="an entry component label",
+ file="plugins/MyOtherGUIdialog.xml"
+ ),
+ index=3
+ )
+ external <- rk.XML.external(
+ id="externalID",
+ default="none"
+ )
+ formula <- rk.XML.formula(
+ fixed=rk.XML.varslot("Fixed factors", source=test.varselector <- rk.XML.varselector("Select some vars")),
+ dependent=rk.XML.varslot("Dependent variables", source=test.varselector)
+ )
+ frame <- rk.XML.frame(
+ rk.XML.row(
+ rk.XML.cbox(label="a frame row label")
+ ),
+ label="a frame label",
+ checkable=TRUE,
+ chk=FALSE
+ )
+ help <- rk.XML.help(
+ "help_file.rkh"
+ )
+ hierarchy <- rk.XML.hierarchy(
+ rk.XML.menu("Analysis",
+ rk.XML.entry(
+ rk.XML.component(
+ label="a hierarchy label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
+ )
+ )
+ )
+ include <- rk.XML.include(
+ "../include_file.xml"
+ )
+ input <- rk.XML.input(
+ label="an input label",
+ initial="init",
+ size="small",
+ required=TRUE,
+ )
+ insert <- rk.XML.insert(
+ snippet=rk.XML.snippet(
+ rk.XML.vars(
+ "Variables",
+ "Fixed",
+ formula.dependent="Dependent"
+ )
+ )
+ )
+ logic=rk.XML.logic(
+ rk.XML.connect(
+ governor="myGovernor",
+ client="myCLient"
+ )
+ )
+ matrix <- rk.XML.matrix(
+ label="a matrix label",
+ mode="integer",
+ rows=3,
+ columns=3,
+ min=0,
+ max=100,
+ allow_missings=TRUE,
+ allow_user_resize_columns=FALSE,
+ allow_user_resize_rows=FALSE,
+ fixed_width=TRUE,
+ fixed_height=TRUE,
+ horiz_headers=c("hone", "htwo", "hthree"),
+ vert_headers=c("vone", "vtwo", "vthree")
+ )
+ menu <- rk.XML.menu(
+ "Analysis",
+ rk.XML.entry(
+ rk.XML.component(
+ label="a hierarchy label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
+ ),
+ index=3
+ )
+ optioncolumn <- rk.XML.optioncolumn(
+ connect=rk.XML.input(label="an optioncolumn label"),
+ modifier="text",
+ label=TRUE,
+ external=TRUE,
+ default="rarely useful"
+ )
+ optiondisplay <- rk.XML.optiondisplay(
+ index=FALSE
+ )
+ option <- rk.XML.option(
+ label="an option label",
+ val="value",
+ chk=TRUE
+ )
+ optionset <- rk.XML.optionset(
+ content=list(
+ rk.XML.row(
+ rk.XML.cbox(label="a content row label")
+ )
+ ),
+ optioncolumn=list(
+ rk.XML.optioncolumn("an optioncolumn")
+ ),
+ min_rows=1,
+ min_rows_if_any=1,
+ max_rows=5,
+ keycolumn="myKey",
+ logic=rk.XML.logic(
+ rk.XML.connect(
+ governor="myGovernor",
+ client="myCLient"
+ )
+ ),
+ optiondisplay=TRUE
+ )
+ 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(
+# )
+
+ XML_test_standards <- list(
+ about=about,
+ attribute=attribute,
+ browser=browser,
+ checkbox=checkbox,
+ code=code,
+ col=col,
+ component=component,
+ components=components,
+ connect=connect,
+ context=context,
+ convert=convert,
+ copy=copy,
+ dependencies=dependencies,
+ dependency_check=dependency_check,
+ dialog=dialog,
+ dropdown=dropdown,
+ embed=embed,
+ entry=entry,
+ external=external,
+ formula=formula,
+ frame=frame,
+ help=help,
+ hierarchy=hierarchy,
+ include=include,
+ input=input,
+ insert=insert,
+ logic=logic,
+ matrix=matrix,
+ menu=menu,
+ optioncolumn=optioncolumn,
+ 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
)
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 dc044be..a7c957c 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 3a27462..f12e582 100644
--- a/packages/rkwarddev/tests/testthat/test_XML_generation.R
+++ b/packages/rkwarddev/tests/testthat/test_XML_generation.R
@@ -6,248 +6,505 @@
context("XML")
test_that("rk.XML.about", {
- thisNode <- 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")
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["about"]])
- )
+ thisNode <- 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")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["about"]])
+ )
})
test_that("rk.XML.attribute", {
- thisNode <- rk.XML.attribute(
- id="testID",
- label="an attribute label",
- value="checked"
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["attribute"]])
- )
+ thisNode <- rk.XML.attribute(
+ id="testID",
+ label="an attribute label",
+ value="checked"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["attribute"]])
+ )
})
test_that("rk.XML.browser", {
- thisNode <- rk.XML.browser(
- label="a browser label",
- type="dir",
- initial="/tmp/initial",
- filter=c("*initial", "*csv"),
- required=TRUE,
- i18n=list(context="context info here")
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["browser"]])
- )
+ thisNode <- rk.XML.browser(
+ label="a browser label",
+ type="dir",
+ initial="/tmp/initial",
+ filter=c("*initial", "*csv"),
+ required=TRUE,
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["browser"]])
+ )
})
test_that("rk.XML.cbox", {
- thisNode <- rk.XML.cbox(
- label="a checbox label",
- value="checked",
- chk=TRUE,
- un.value="unchecked",
- i18n=list(context="context info here")
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["checkbox"]])
- )
+ thisNode <- rk.XML.cbox(
+ label="a checbox label",
+ value="checked",
+ chk=TRUE,
+ un.value="unchecked",
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["checkbox"]])
+ )
})
test_that("rk.XML.code", {
- thisNode <- rk.XML.code(
- file="some_file.js"
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["code"]])
- )
+ thisNode <- rk.XML.code(
+ file="some_file.js"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["code"]])
+ )
})
test_that("rk.XML.col", {
- thisNode <- rk.XML.col(
- rk.XML.cbox(label="a column label")
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["col"]])
- )
+ thisNode <- rk.XML.col(
+ rk.XML.cbox(label="a column label")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["col"]])
+ )
})
test_that("rk.XML.component", {
- thisNode <- rk.XML.component(
- label="a component label",
- file="plugins/MyGUIdialog.xml",
- i18n=list(context="context info here")
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["component"]])
- )
+ thisNode <- rk.XML.component(
+ label="a component label",
+ file="plugins/MyGUIdialog.xml",
+ i18n=list(context="context info here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["component"]])
+ )
})
test_that("rk.XML.components", {
- thisNode <- rk.XML.components(
- rk.XML.component(
- label="a components label",
- file="plugins/MyOtherGUIdialog.xml"
+ thisNode <- rk.XML.components(
+ rk.XML.component(
+ label="a components label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["components"]])
)
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["components"]])
- )
})
test_that("rk.XML.connect", {
- thisNode <- rk.XML.connect(
- governor="myGovernor",
- client="myCLient",
- get="visible",
- set="string",
- not=TRUE,
- reconcile=TRUE
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["connect"]])
- )
+ thisNode <- rk.XML.connect(
+ governor="myGovernor",
+ client="myCLient",
+ get="visible",
+ set="string",
+ not=TRUE,
+ reconcile=TRUE
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["connect"]])
+ )
})
test_that("rk.XML.context", {
- thisNode <- rk.XML.context(
- rk.XML.menu("Analysis",
- rk.XML.entry(
- rk.XML.component(
- label="a context label",
- file="plugins/MyOtherGUIdialog.xml"
+ thisNode <- rk.XML.context(
+ rk.XML.menu("Analysis",
+ rk.XML.entry(
+ rk.XML.component(
+ label="a context label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
+ )
)
- )
)
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["context"]])
- )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["context"]])
+ )
})
test_that("rk.XML.convert", {
- thisNode <- rk.XML.convert(
- sources=list(text=rk.XML.input("a convert label")),
- mode=c(equals="myValue"),
- required=TRUE
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["convert"]])
- )
+ thisNode <- rk.XML.convert(
+ sources=list(text=rk.XML.input("a convert label")),
+ mode=c(equals="myValue"),
+ required=TRUE
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["convert"]])
+ )
})
test_that("rk.XML.copy", {
- thisNode <- rk.XML.copy(
- id="aCopyID",
- as="page"
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["copy"]])
- )
+ thisNode <- rk.XML.copy(
+ id="aCopyID",
+ as="page"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["copy"]])
+ )
})
test_that("rk.XML.dependencies", {
- thisNode <- 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"))
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["dependencies"]])
- )
+ thisNode <- 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")
+ )
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["dependencies"]])
+ )
})
test_that("rk.XML.dependency_check", {
- thisNode <- rk.XML.dependency_check(
- id.name="dependency",
- 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"))
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["dependency_check"]])
- )
+ thisNode <- rk.XML.dependency_check(
+ id.name="dependency",
+ 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"))
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["dependency_check"]])
+ )
})
test_that("rk.XML.dialog", {
- thisNode <- 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")
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["dialog"]])
- )
+ thisNode <- 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")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["dialog"]])
+ )
})
test_that("rk.XML.dropdown", {
- thisNode <- rk.XML.dropdown(
- label="myDropdownMenu",
- options=list(
- "First Option"=c(val="val1"),
- rk.XML.option(
- "Second Option", val="val2", id.name="auto",
- i18n=list(context="context info1 here")
- ),
- "Third Option"=c(val="val3", chk=TRUE)
- ),
- i18n=list(context="context info2 here")
- )
- load("XML_test_standards.RData")
- expect_that(
- thisNode, equals(XML_test_standards[["dropdown"]])
- )
+ thisNode <- rk.XML.dropdown(
+ label="a dropdown label",
+ options=list(
+ "First Option"=c(val="val1"),
+ rk.XML.option(
+ "Second Option", val="val2", id.name="auto",
+ i18n=list(context="context info1 here")
+ ),
+ "Third Option"=c(val="val3", chk=TRUE)
+ ),
+ i18n=list(context="context info2 here")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["dropdown"]])
+ )
+})
+
+test_that("rk.XML.embed", {
+ thisNode <- rk.XML.embed(
+ component="componentID",
+ button=TRUE,
+ label="an embed label"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["embed"]])
+ )
+})
+
+test_that("rk.XML.entry", {
+ thisNode <- rk.XML.entry(
+ component=rk.XML.component(
+ label="an entry component label",
+ file="plugins/MyOtherGUIdialog.xml"
+ ),
+ index=3
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["entry"]])
+ )
+})
+
+test_that("rk.XML.external", {
+ thisNode <- rk.XML.external(
+ id="externalID",
+ default="none"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["external"]])
+ )
+})
+
+test_that("rk.XML.formula", {
+ thisNode <- rk.XML.formula(
+ fixed=rk.XML.varslot("Fixed factors", source=test.varselector <- rk.XML.varselector("Select some vars")),
+ dependent=rk.XML.varslot("Dependent variables", source=test.varselector)
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["formula"]])
+ )
+})
+
+test_that("rk.XML.frame", {
+ thisNode <- rk.XML.frame(
+ rk.XML.row(
+ rk.XML.cbox(label="a frame row label")
+ ),
+ label="a frame label",
+ checkable=TRUE,
+ chk=FALSE
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["frame"]])
+ )
+})
+
+test_that("rk.XML.help", {
+ thisNode <- rk.XML.help(
+ "help_file.rkh"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["help"]])
+ )
+})
+
+test_that("rk.XML.hierarchy", {
+ thisNode <- rk.XML.hierarchy(
+ rk.XML.menu("Analysis",
+ rk.XML.entry(
+ rk.XML.component(
+ label="a hierarchy label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
+ )
+ )
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["hierarchy"]])
+ )
+})
+
+test_that("rk.XML.include", {
+ thisNode <- rk.XML.include(
+ "../include_file.xml"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["include"]])
+ )
+})
+
+test_that("rk.XML.input", {
+ thisNode <- rk.XML.input(
+ label="an input label",
+ initial="init",
+ size="small",
+ required=TRUE,
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["input"]])
+ )
+})
+
+test_that("rk.XML.insert", {
+ thisNode <- rk.XML.insert(
+ snippet=rk.XML.snippet(
+ rk.XML.vars(
+ "Variables",
+ "Fixed",
+ formula.dependent="Dependent"
+ )
+ )
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["insert"]])
+ )
+})
+
+test_that("rk.XML.logic", {
+ thisNode <- rk.XML.logic(
+ rk.XML.connect(
+ governor="myGovernor",
+ client="myCLient"
+ )
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["logic"]])
+ )
+})
+
+test_that("rk.XML.matrix", {
+ thisNode <- rk.XML.matrix(
+ label="a matrix label",
+ mode="integer",
+ rows=3,
+ columns=3,
+ min=0,
+ max=100,
+ allow_missings=TRUE,
+ allow_user_resize_columns=FALSE,
+ allow_user_resize_rows=FALSE,
+ fixed_width=TRUE,
+ fixed_height=TRUE,
+ horiz_headers=c("hone", "htwo", "hthree"),
+ vert_headers=c("vone", "vtwo", "vthree")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["matrix"]])
+ )
+})
+
+test_that("rk.XML.menu", {
+ thisNode <- rk.XML.menu(
+ "Analysis",
+ rk.XML.entry(
+ rk.XML.component(
+ label="a hierarchy label",
+ file="plugins/MyOtherGUIdialog.xml"
+ )
+ ),
+ index=3
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["menu"]])
+ )
+})
+
+test_that("rk.XML.optioncolumn", {
+ thisNode <- rk.XML.optioncolumn(
+ connect=rk.XML.input(label="an optioncolumn label"),
+ modifier="text",
+ label=TRUE,
+ external=TRUE,
+ default="rarely useful"
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["optioncolumn"]])
+ )
+})
+
+test_that("rk.XML.optiondisplay", {
+ thisNode <- rk.XML.optiondisplay(
+ index=FALSE
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["optiondisplay"]])
+ )
+})
+
+test_that("rk.XML.option", {
+ thisNode <- rk.XML.option(
+ label="an option label",
+ val="value",
+ chk=TRUE
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["option"]])
+ )
+})
+
+test_that("rk.XML.optionset", {
+ thisNode <- rk.XML.optionset(
+ content=list(
+ rk.XML.row(
+ rk.XML.cbox(label="a content row label")
+ )
+ ),
+ optioncolumn=list(
+ rk.XML.optioncolumn("an optioncolumn")
+ ),
+ min_rows=1,
+ min_rows_if_any=1,
+ max_rows=5,
+ keycolumn="myKey",
+ logic=rk.XML.logic(
+ rk.XML.connect(
+ governor="myGovernor",
+ client="myCLient"
+ )
+ ),
+ optiondisplay=TRUE
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["optionset"]])
+ )
+})
+
+test_that("rk.XML.page", {
+ thisNode <- rk.XML.page(
+ rk.XML.text("a page text")
+ )
+ load("XML_test_standards.RData")
+ expect_that(
+ thisNode, equals(XML_test_standards[["page"]])
+ )
})
# test_that("", {
-# thisNode <-
-# load("XML_test_standards.RData")
-# expect_that(
-# thisNode, equals(XML_test_standards[[""]])
-# )
+# thisNode <-
+# load("XML_test_standards.RData")
+# expect_that(
+# thisNode, equals(XML_test_standards[[""]])
+# )
# })
More information about the rkward-tracker
mailing list