library(rgl)

test_that("rgl.user2window and rgl.window2user work", {
	xyz <- rbind(x = c(2, 4, 6))
	abc <- rbind(x = c(0.1, 0.2, 0.3))
	open3d()
	mfrow3d(2, 2)
	points3d(1:10, 1:10, 1:10)
	expect_equal(rgl.window2user(rgl.user2window(xyz)), xyz)
	expect_equal(rgl.user2window(rgl.window2user(abc)), abc)
	next3d()
	points3d(1:10, 1:10, 1:10)
	expect_equal(rgl.window2user(rgl.user2window(xyz)), xyz)
	expect_equal(rgl.user2window(rgl.window2user(abc)), abc)
	next3d()
	points3d(1:10, 1:10, 1:10)
	expect_equal(rgl.window2user(rgl.user2window(xyz)), xyz)
	expect_equal(rgl.user2window(rgl.window2user(abc)), abc)
	next3d()
	points3d(1:10, 1:10, 1:10)
	expect_equal(rgl.window2user(rgl.user2window(xyz)), xyz)
	expect_equal(rgl.user2window(rgl.window2user(abc)), abc)
})
