[education/rkward] /: More test fixes

Thomas Friedrichsmeier null at kde.org
Sun Apr 10 12:08:51 BST 2022


Git commit b52ed60ac8b79f2ab9e76adac09c554cb165f22c by Thomas Friedrichsmeier.
Committed on 10/04/2022 at 11:08.
Pushed by tfry into branch 'master'.

More test fixes

M  +4    -3    rkward/plugins/plots/barplot.js
M  +1    -1    tests/distributions.R
M  +8    -6    tests/plots/barplot.rkcommands.R
M  +1    -1    tests/plots/histogram.rkcommands.R
M  +3    -3    tests/plots/histogram.rkout

https://invent.kde.org/education/rkward/commit/b52ed60ac8b79f2ab9e76adac09c554cb165f22c

diff --git a/rkward/plugins/plots/barplot.js b/rkward/plugins/plots/barplot.js
index f9872054..7fa84ac8 100644
--- a/rkward/plugins/plots/barplot.js
+++ b/rkward/plugins/plots/barplot.js
@@ -26,9 +26,10 @@ function doPrintout (full) {
 		echo (getValue ('tabulate_options.code.calculate'));
 	} else {
 		echo ('x <- ' + varname + "\n");
-		comment ('barplot is a bit picky about attributes, so we need to convert to vector explicitly');
-		echo ('if(!is.matrix(x)) x <- as.vector(x)\n');
-		echo ('if(!is.matrix(x) && is.data.frame(x)) x <- data.matrix(x)\n');
+		comment ('barplot is a bit picky about attributes, so we need to convert to vector or matrix explicitly');
+		echo ('if(!is.matrix(x)) {\n');
+		echo ('\tif (is.data.frame(x)) x <- data.matrix(x) else x <- as.vector(x)\n');
+		echo ('}\n');
 	}
 
 	if (limit) {
diff --git a/tests/distributions.R b/tests/distributions.R
index 29b3cd5b..8ae9ac0d 100644
--- a/tests/distributions.R
+++ b/tests/distributions.R
@@ -94,7 +94,7 @@ suite <- new ("RKTestSuite", id="distributions",
 		}),
 		new ("RKTest", id="gumbel_probabilities", call=function () {
 			rk.call.plugin ("rkward::gumbel_probabilities", location.real="0.0", logp.state="0", lower.state="1", mode.string="p", q.tsv="", scale.real="1.0", submit.mode="submit")
-		}),
+		}, libraries=c ("FAdist")),
 		new ("RKTest", id="logistic_probabilities", call=function () {
 			rk.call.plugin ("rkward::logistic_probabilities", location.real="0.0", logp.state="0", lower.state="1", mode.string="p", q.tsv="", scale.real="1.0", submit.mode="submit")
 		}),
diff --git a/tests/plots/barplot.rkcommands.R b/tests/plots/barplot.rkcommands.R
index e037b1d2..565360f3 100644
--- a/tests/plots/barplot.rkcommands.R
+++ b/tests/plots/barplot.rkcommands.R
@@ -1,9 +1,10 @@
 local({
 ## Print result
 x <- swiss[["Catholic"]]
-# barplot is a bit picky about attributes, so we need to convert to vector explicitly
-if(!is.matrix(x)) x <- as.vector(x)
-if(!is.matrix(x) && is.data.frame(x)) x <- data.matrix(x)
+# barplot is a bit picky about attributes, so we need to convert to vector or matrix explicitly
+if(!is.matrix(x)) {
+	if (is.data.frame(x)) x <- data.matrix(x) else x <- as.vector(x)
+}
 names(x) <- rownames (swiss)
 rk.header ("Barplot", parameters=list ("Variable"=rk.get.description (swiss[["Catholic"]]), "colors"="rainbow", "Type"="juxtaposed", "Legend"="FALSE"))
 
@@ -21,9 +22,10 @@ rk.graph.off ()
 local({
 ## Print result
 x <- test_table
-# barplot is a bit picky about attributes, so we need to convert to vector explicitly
-if(!is.matrix(x)) x <- as.vector(x)
-if(!is.matrix(x) && is.data.frame(x)) x <- data.matrix(x)
+# barplot is a bit picky about attributes, so we need to convert to vector or matrix explicitly
+if(!is.matrix(x)) {
+	if (is.data.frame(x)) x <- data.matrix(x) else x <- as.vector(x)
+}
 rk.header ("Barplot", parameters=list ("Variable"=rk.get.description (test_table), "colors"="default", "Type"="stacked", "Legend"="TRUE"))
 
 rk.graph.on ()
diff --git a/tests/plots/histogram.rkcommands.R b/tests/plots/histogram.rkcommands.R
index 27e11f76..5a43400e 100644
--- a/tests/plots/histogram.rkcommands.R
+++ b/tests/plots/histogram.rkcommands.R
@@ -7,7 +7,7 @@ rk.header ("Histogram", list ("Variable"=rk.get.description (swiss[["Education"]
 rk.header ("Density curve", parameters=list("Bandwidth"="nrd",
 	"Adjust Bandwidth"="4.00",
 	"resolution"="512.00",
-	"Remove Missing Values"="yes"))
+	"Remove Missing Values"="yes"), level=3)
 
 rk.graph.on ()
 try ({
diff --git a/tests/plots/histogram.rkout b/tests/plots/histogram.rkout
index 7f7603cc..239cd0a9 100644
--- a/tests/plots/histogram.rkout
+++ b/tests/plots/histogram.rkout
@@ -7,12 +7,12 @@
 <li>Scale: Density</li>
 </ul>
 DATE<br />
-<h1>Density curve</h1>
-<h2>Parameters</h2>
+<h3>Density curve</h3>
+<h4>Parameters</h4>
 <ul><li>Bandwidth: nrd</li>
 <li>Adjust Bandwidth: 4.00</li>
 <li>resolution: 512.00</li>
 <li>Remove Missing Values: yes</li>
 </ul>
-DATE<br />
+<br />
 <img src="graph.png" width="480" height="480"><br>


More information about the rkward-tracker mailing list