forked from saalfeldlab/render
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix grid block creation bug and remove unused methods
- Loading branch information
Showing
2 changed files
with
38 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
render-app/src/test/java/org/janelia/alignment/util/GridTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.janelia.alignment.util; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Tests the {@link Grid} class. | ||
*/ | ||
public class GridTest { | ||
|
||
@Test | ||
public void testCreate() { | ||
final int tileWidth = 4096; | ||
final int tileHeight = 4096; | ||
final int[] blockSize = { 128, 128, 64 }; | ||
|
||
final long[] dimensions = { 34839, 19362, 29491}; | ||
final int[] gridBlockSize = { tileWidth, tileHeight, blockSize[2] }; | ||
|
||
final List<Grid.Block> blockList = Grid.create(dimensions, gridBlockSize, blockSize); | ||
|
||
Assert.assertNotNull("block list is null", blockList); | ||
Assert.assertEquals("invalid number of blocks", 20745, blockList.size()); | ||
|
||
final Grid.Block firstBlock = blockList.get(0); | ||
Assert.assertNotNull("first block is null", firstBlock); | ||
Assert.assertEquals("first block has invalid number of dimensions", | ||
3, firstBlock.numDimensions()); | ||
for (int d = 0; d < 3; ++d) { | ||
Assert.assertEquals("first block has invalid dimension " + d, | ||
gridBlockSize[d], firstBlock.dimension(d)); | ||
} | ||
} | ||
|
||
} |