Package com.irurueta.geometry.io
Class LoaderIteratorPLYTest
java.lang.Object
com.irurueta.geometry.io.LoaderIteratorPLYTest
- All Implemented Interfaces:
LoaderListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final float[]private static final int[]private intprivate booleanprivate static final doubleprivate booleanprivate static final intprivate static final intprivate floatprivate booleanprivate intprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcheckDefaultChunk(DataChunk chunk, int components, boolean checkBlue) Checks that a chunk contains the data generated by default byPLYTestFileBuilder.private voidcheckLocked(LoaderPLY loader) formats()Provides the supported storage formats.private static Stream<org.junit.jupiter.params.provider.Arguments> Provides all combinations of storage format and data type.private booleanprivate booleanprivate booleanprivate boolean(package private) voidload_whenFileEndsInsideVertices_throwsException(String format, Path dir) Checks that a file truncated in the middle of the vertices is rejected.(package private) voidChecks that a file without face element cannot be iterated.(package private) voidChecks that unknown elements declared before the vertices are rejected, because no reader is set for their properties.Loads all chunks of a file.(package private) voidnext_whenAllPropertiesUseSameType_returnsExpectedChunk(String format, String type, Path dir) Checks that files using every data type for coordinates, colors, normals and faces can be loaded in every storage mode, so that all value readers are executed.(package private) voidChecks that ASCII coordinates that cannot be parsed are rejected for every data type.(package private) voidChecks that ASCII values that cannot be parsed are rejected as a corrupted file.(package private) voidnext_whenChunkIsTooSmall_returnsSeveralChunks(String format, Path dir) Checks that faces are split into several chunks when they do not fit in one chunk.(package private) voidChecks that mixed data types, three color components and unsupported texture properties are handled in every storage mode.(package private) voidChecks that duplicate vertices are kept when allowed.(package private) voidChecks that a face larger than the chunk is rejected.(package private) voidnext_whenFaceHasTwoIndices_throwsLoaderException(String format, Path dir) Checks that a face with fewer than three indices is rejected.(package private) voidChecks that a face referencing a missing vertex is rejected.(package private) voidnext_whenFaceIsPentagon_triangulatesFace(String format, Path dir) Checks that polygons with five vertices are triangulated.(package private) voidnext_whenFaceIsQuad_triangulatesFace(String format, Path dir) Checks that polygons with more than three vertices are triangulated.(package private) voidnext_whenFileIsTruncated_throwsException(String format, Path dir) Checks that a file truncated in the middle of the faces is rejected.(package private) voidChecks that calling next when there are no more chunks fails.(package private) voidChecks that files without optional properties can be loaded in every storage mode.voidvoidonLoadProgressChange(Loader loader, float progress) voidonLoadStart(Loader loader) private void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) voidtestLoad()(package private) void(package private) void(package private) voidtypes()Provides all data types.
-
Field Details
-
ERROR
private static final double ERROR- See Also:
-
MAX_VERTICES
private static final int MAX_VERTICES- See Also:
-
BYTES_TO_TRUNCATE
private static final int BYTES_TO_TRUNCATE- See Also:
-
DEFAULT_COORDS
private static final float[] DEFAULT_COORDS -
DEFAULT_INDICES
private static final int[] DEFAULT_INDICES -
N_DEFAULT_VERTICES
private static final int N_DEFAULT_VERTICES- See Also:
-
startValid
private boolean startValid -
endValid
private boolean endValid -
progressValid
private boolean progressValid -
lockedValid
private boolean lockedValid -
startCounter
private int startCounter -
endCounter
private int endCounter -
previousProgress
private float previousProgress
-
-
Constructor Details
-
LoaderIteratorPLYTest
LoaderIteratorPLYTest()
-
-
Method Details
-
testConstructors
- Throws:
IOException
-
testHasSetFileAndIsReady
- Throws:
LockedExceptionIOException
-
testGetSetFileSizeLimitToKeepInMemory
- Throws:
LockedExceptionIOException
-
testGetSetListener
- Throws:
LockedExceptionIOException
-
testGetSetMaxVerticesInChunk
- Throws:
LockedExceptionIOException
-
testGetSetAllowDuplicateVerticesInChunk
- Throws:
LockedExceptionIOException
-
testGetSetMaxStreamPositions
- Throws:
LockedExceptionIOException
-
testIsValidFile
- Throws:
LockedExceptionIOException
-
testLoad
-
testLoadAndIterate
@Test void testLoadAndIterate() throws IllegalArgumentException, LockedException, NotReadyException, IOException, LoaderException, NotAvailableException -
testLoadAndIterateRealFile
@Test void testLoadAndIterateRealFile() throws LockedException, NotReadyException, IOException, LoaderException, NotAvailableException -
testLoadAndIterateRealFileWithNormals
@Test void testLoadAndIterateRealFileWithNormals() throws LockedException, NotReadyException, IOException, LoaderException, NotAvailableException -
next_whenAllPropertiesUseSameType_returnsExpectedChunk
@ParameterizedTest @MethodSource("formatsAndTypes") void next_whenAllPropertiesUseSameType_returnsExpectedChunk(String format, String type, @TempDir Path dir) throws Exception Checks that files using every data type for coordinates, colors, normals and faces can be loaded in every storage mode, so that all value readers are executed.- Parameters:
format- storage format name.type- data type name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenColorsNormalsAndTextureArePresent_returnsExpectedChunk
@ParameterizedTest @MethodSource("formats") void next_whenColorsNormalsAndTextureArePresent_returnsExpectedChunk(String format, @TempDir Path dir) throws Exception Checks that mixed data types, three color components and unsupported texture properties are handled in every storage mode.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenOnlyCoordinatesArePresent_returnsChunkWithoutColors
@ParameterizedTest @MethodSource("formats") void next_whenOnlyCoordinatesArePresent_returnsChunkWithoutColors(String format, @TempDir Path dir) throws Exception Checks that files without optional properties can be loaded in every storage mode.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenDuplicateVerticesAreAllowed_repeatsVertices
@ParameterizedTest @MethodSource("formats") void next_whenDuplicateVerticesAreAllowed_repeatsVertices(String format, @TempDir Path dir) throws Exception Checks that duplicate vertices are kept when allowed.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenChunkIsTooSmall_returnsSeveralChunks
@ParameterizedTest @MethodSource("formats") void next_whenChunkIsTooSmall_returnsSeveralChunks(String format, @TempDir Path dir) throws Exception Checks that faces are split into several chunks when they do not fit in one chunk.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenFaceIsQuad_triangulatesFace
@ParameterizedTest @MethodSource("formats") void next_whenFaceIsQuad_triangulatesFace(String format, @TempDir Path dir) throws Exception Checks that polygons with more than three vertices are triangulated.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenFaceIsPentagon_triangulatesFace
@ParameterizedTest @MethodSource("formats") void next_whenFaceIsPentagon_triangulatesFace(String format, @TempDir Path dir) throws Exception Checks that polygons with five vertices are triangulated.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenFaceHasTwoIndices_throwsLoaderException
@ParameterizedTest @MethodSource("formats") void next_whenFaceHasTwoIndices_throwsLoaderException(String format, @TempDir Path dir) throws Exception Checks that a face with fewer than three indices is rejected.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenFaceDoesNotFitInChunk_throwsLoaderException
@ParameterizedTest @MethodSource("formats") void next_whenFaceDoesNotFitInChunk_throwsLoaderException(String format, @TempDir Path dir) throws Exception Checks that a face larger than the chunk is rejected.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenFaceIndexIsOutOfRange_throwsLoaderException
@ParameterizedTest @MethodSource("formats") void next_whenFaceIndexIsOutOfRange_throwsLoaderException(String format, @TempDir Path dir) throws Exception Checks that a face referencing a missing vertex is rejected.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenFileIsTruncated_throwsException
@ParameterizedTest @MethodSource("formats") void next_whenFileIsTruncated_throwsException(String format, @TempDir Path dir) throws Exception Checks that a file truncated in the middle of the faces is rejected.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
load_whenFileEndsInsideVertices_throwsException
@ParameterizedTest @MethodSource("formats") void load_whenFileEndsInsideVertices_throwsException(String format, @TempDir Path dir) throws Exception Checks that a file truncated in the middle of the vertices is rejected.- Parameters:
format- storage format name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenNoMoreChunks_throwsNotAvailableException
Checks that calling next when there are no more chunks fails.- Parameters:
dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenAsciiValueIsNotANumber_throwsException
Checks that ASCII values that cannot be parsed are rejected as a corrupted file.- Parameters:
dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
next_whenAsciiCoordinateIsNotANumber_throwsLoaderException
@ParameterizedTest @MethodSource("types") void next_whenAsciiCoordinateIsNotANumber_throwsLoaderException(String type, @TempDir Path dir) throws Exception Checks that ASCII coordinates that cannot be parsed are rejected for every data type.- Parameters:
type- data type name.dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
load_whenUnknownElementPrecedesVertices_throwsLoaderException
@Test void load_whenUnknownElementPrecedesVertices_throwsLoaderException(@TempDir Path dir) throws Exception Checks that unknown elements declared before the vertices are rejected, because no reader is set for their properties.- Parameters:
dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
load_whenThereAreNoFaces_throwsLoaderException
Checks that a file without face element cannot be iterated.- Parameters:
dir- temporary directory.- Throws:
Exception- if any unexpected error occurs.
-
formats
Provides the supported storage formats.- Returns:
- storage formats.
-
types
Provides all data types.- Returns:
- data type names.
-
formatsAndTypes
Provides all combinations of storage format and data type.- Returns:
- arguments.
-
loadAll
private static List<DataChunk> loadAll(File file, int maxVerticesInChunk, boolean allowDuplicateVertices) throws Exception Loads all chunks of a file.- Parameters:
file- file to be loaded.maxVerticesInChunk- maximum number of vertices in a chunk.allowDuplicateVertices- true to allow duplicate vertices in a chunk.- Returns:
- loaded chunks.
- Throws:
Exception- if any error occurs.
-
checkDefaultChunk
Checks that a chunk contains the data generated by default byPLYTestFileBuilder.- Parameters:
chunk- chunk to be checked.components- number of color components.checkBlue- true to check blue component (int typed blue components are not read by the loader).
-
onLoadStart
- Specified by:
onLoadStartin interfaceLoaderListener
-
onLoadEnd
- Specified by:
onLoadEndin interfaceLoaderListener
-
onLoadProgressChange
- Specified by:
onLoadProgressChangein interfaceLoaderListener
-
checkLocked
-
resetListener
private void resetListener() -
isStartValid
private boolean isStartValid() -
isEndValid
private boolean isEndValid() -
isProgressValid
private boolean isProgressValid() -
isLockedValid
private boolean isLockedValid()
-