[rkward-cvs] SF.net SVN: rkward:[3020] trunk/rkward/tests/rkward_application_tests.R

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Sep 12 17:27:09 UTC 2010


Revision: 3020
          http://rkward.svn.sourceforge.net/rkward/?rev=3020&view=rev
Author:   tfry
Date:     2010-09-12 17:27:08 +0000 (Sun, 12 Sep 2010)

Log Message:
-----------
Add an initial plot history test. Contains only regular plots, so far. Try to mix in trellis plots makes the test fail.

Modified Paths:
--------------
    trunk/rkward/tests/rkward_application_tests.R

Modified: trunk/rkward/tests/rkward_application_tests.R
===================================================================
--- trunk/rkward/tests/rkward_application_tests.R	2010-09-12 16:48:07 UTC (rev 3019)
+++ trunk/rkward/tests/rkward_application_tests.R	2010-09-12 17:27:08 UTC (rev 3020)
@@ -77,7 +77,79 @@
 			stopifnot (all.equal (as.numeric (dev.list ()), 3))
 			dev.off ()
 			stopifnot (is.null (dev.list ()))
-		})
+		}),
+		new ("RKTest", id="plot_history_basics", call=function () {
+			graphics.off()
+			Sys.sleep (2)	# wait for everything to settle
+			rk.clear.plot.history()
+			options(rk.graphics.hist.max.plotsize=1000)
+			rk.toggle.plot.history(TRUE)
+			rk.verify.plot.hist.limits (5)
+			.pop.notify <<- FALSE
+
+			plots <- list ()
+			plot (1, 1)
+			plots[[1]] <- recordPlot()
+			plot (2, 2)
+			plots[[2]] <- recordPlot()
+			plot (3, 3)
+			plots[[3]] <- recordPlot()
+			rk.force.append.plot ()
+			stopifnot (dev.cur() == 2)
+			x11 ()
+			plot (4, 4)
+			plots[[4]] <- recordPlot()
+			plot (5, 5)
+			plots[[5]] <- recordPlot()
+			stopifnot (dev.cur() == 3)
+
+			## Navigation
+			rk.previous.plot (2)
+			stopifnot (dev.cur() == 3)
+			dev.set (2)
+			stopifnot (identical (recordPlot(), plots[[2]]))
+			rk.next.plot (2)
+			stopifnot (identical (recordPlot(), plots[[3]]))
+
+			rk.previous.plot (3)
+			dev.set (3)
+			stopifnot (identical (recordPlot(), plots[[4]]))
+			rk.next.plot (3)
+			stopifnot (identical (recordPlot(), plots[[5]]))
+
+			dev.set (2)
+			rk.goto.plot (2, 1)
+			stopifnot (identical (recordPlot(), plots[[1]]))
+
+			## Removing
+			# The plot should be removed in device 3, too
+			rk.removethis.plot (2)
+			stopifnot (identical (recordPlot(), plots[[2]]))
+			dev.set (3)
+			rk.first.plot (3)
+			stopifnot (identical (recordPlot(), plots[[2]]))
+
+			# this time, the plot was shown in both devices. It should not have be removed in the other!
+			rk.removethis.plot (3)
+			stopifnot (identical (recordPlot(), plots[[3]]))
+			dev.set (2)
+			stopifnot (identical (recordPlot(), plots[[2]]))
+
+			## Reaching the history limit
+			# three plots in history at this time, and one pending in device 2
+			dev.set (3)
+			rk.first.plot ()
+			stopifnot (identical (recordPlot(), plots[[3]]))
+			rk.last.plot ()
+			stopifnot (identical (recordPlot(), plots[[5]]))
+			dev.set (2)
+			plot (1, 1)
+			plot (1, 1)
+			# five plots in history at this time, and one pending in device 2
+			rk.force.append.plot ()	# first should have been popped, now
+			rk.first.plot ()
+			stopifnot (identical (recordPlot(), plots[[4]]))
+		}, libraries=c ("lattice"))
 	# postCalls are run *after* all tests. Use this to clean up
 	), postCalls = list (
 		function () {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list