Skip to content

Commit

Permalink
Merge pull request #34 from statnet/no_install_test
Browse files Browse the repository at this point in the history
fixes #24 and hopefully #32
  • Loading branch information
skyebend committed May 2, 2018
2 parents dda80cb + 4b62efa commit 8158b36
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ndtv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ChangeLog for ndtv
v0.12
- correction requested by CRAN to not install optional 3rd-party Java library when testing
v0.11
- corrections to render.d3movie to avoid errors in frames when no edges are active and vis properties are mapped to edge attributes.
v0.10
Expand Down
4 changes: 2 additions & 2 deletions ndtv/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: ndtv
Type: Package
Title: Network Dynamic Temporal Visualizations
Version: 0.12
Date: 2016-9-16
Version: 0.12.1
Date: 2018-4-1
Authors@R:c(
person("Skye", "Bender-deMoll", role=c("cre","aut"), email="skyebend@uw.edu"),
person("Martina", "Morris", role=c("ctb"), email="morrism@u.washington.edu"))
Expand Down
1 change: 1 addition & 0 deletions ndtv/R/render.d3_animation.R
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ cachePlotValues<-function(slice,renderList,plotArgs,onset,terminus,vertices,edge
# but don't do it if it is an edge-related attribute and there are no edges
if(network.edgecount(slice) == 0 && arg%in%c('edge.col','edge.lty','edge.lwd','edge.label','edge.label.cex','edge.label.col','edge.len','edge.curve','edge.steps','loop.steps')){
# don't expand, because plotArgs.network will give error because it can not distingusih between no edges existing and no attribute existing
dataVals<-NULL
} else {
dataVals<-plotArgs.network(x=slice,argName=arg,argValue=dataVals)
}
Expand Down
7 changes: 7 additions & 0 deletions ndtv/tests/d3_animation_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,12 @@ add.edges.active(test,1,2,onset=0,terminus=2)
activate.edge.attribute(test,'weight',1, onset=1,terminus=2)
expect_error( render.d3movie(test,edge.lwd='weight'),regexp = 'had illegal missing values for')

#errors on empty slice with vertex.cex specified
#https://github.com/statnet/ndtv/issues/24
test<-network.initialize(2)
add.edges.active(test,1,2,onset=0,terminus=1)
activate.edge.attribute(test,'edge.col','blue',onset = 0,terminus=1)
render.d3movie(test,edge.col='edge.col')



5 changes: 4 additions & 1 deletion ndtv/tests/layout_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ expect_equal(ncol(coords),2)
}

# ------------- MDSJ tests -------

test_that("MDSJ algorithms",{
# these need to be optionally enabled because they won't run if java and mdsj library not installed
skip_on_cran()
if (!is.null(ndtv:::check.mdsj()) ){
wtest<-network.initialize(5)
add.edges.active(wtest,tail = 1,head=2,onset=0,terminus=10)
Expand All @@ -176,6 +177,8 @@ expect_equal(dim(dim2mat),c(10,2))
dim1mat<-network.layout.animate.MDSJ(test,layout.par=list(dimensions=1))
expect_equal(dim(dim1mat),c(10,1))
}
})




Expand Down
6 changes: 5 additions & 1 deletion ndtv/tests/proximity.timeline_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ data(McFarland_cls33_10_16_96)
proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),vertex.cex=(cls33_10_16_96%v%'type'=='instructor')*4+1,labels.at=45)

# test algorithm types
test_that("algorithms work",{
# isoMDS is default, so already tested
proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),mode='sammon')
proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),mode='cmdscale')
proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),mode='gvNeato')
# only check MDSJ if allready installed
# only check MDSJ if allready installed (and not on CRAN)
skip_on_cran()
has.mdsj<-ndtv:::check.mdsj(ask=FALSE)
if(!is.null(has.mdsj)){
proximity.timeline(cls33_10_16_96,onsets=seq(0,45,5),termini=seq(2.5,47.5,5),mode='MDSJ')
}

})

# test grid option and verbose options
proximity.timeline(cls33_10_16_96,onsets=seq(0,10,5),termini=seq(2.5,12.5,5),grid=FALSE,verbose=FALSE)

Expand Down

0 comments on commit 8158b36

Please sign in to comment.