AssimpImporterTests Class Reference
Inherits from | XCTestCase |
---|---|
Declared in | AssimpImporterTests.m |
Overview
The test class for AssimpImporter.
This class tests the model files placed in a directory named assets, which has subdirectories: apple, of and assimp; which are the owners of the model files. (Note: of represents open frameworks).
Each asset owner subdirectory is further classified into: * models - which contain open source model files * models-properietary - which contain properietary model files.
Each model directory categorized by license has a subdirectory for each file format that AssimpKit supports.
The list of file formats that AssimpKit supports is in valid-extensions.txt file under assets directory.
Set up and tear down
– setUp
The common initialization for each test method.
- (void)setUp
Discussion
The common initialization for each test method.
This method initializes the assets path from the TEST_ASSETS_PATH which is a processor macro defined in the AssimpSceneKit_LogicTests target defined in both OSX-Example and iOS-Example projects.
Declared In
AssimpImporterTests.m
– tearDown
The common clean up for each test method.
- (void)tearDown
Discussion
The common clean up for each test method.
Declared In
AssimpImporterTests.m
Check node geometry
– checkNodeGeometry:nodeName:withSceneNode:aiScene:testLog:
Checks the scenekit node geometry has the correct vertex, normal and texture coordinate geometry sources for the specifed assimp node.
- (void)checkNodeGeometry:(const struct aiNode *)aiNode nodeName:(NSString *)nodeName withSceneNode:(SCNNode *)sceneNode aiScene:(const struct aiScene *)aiScene testLog:(ModelLog *)testLog
Parameters
aiNode |
The assimp node. |
---|---|
nodeName |
The node name. |
sceneNode |
The scenekit node, whose geometry is tested. |
aiScene |
The assimp scene. |
testLog |
The log for the file being tested. |
Discussion
Checks the scenekit node geometry has the correct vertex, normal and texture coordinate geometry sources for the specifed assimp node.
Declared In
AssimpImporterTests.m
Check node materials
– checkNodeMaterials:nodeName:withSceneNode:aiScene:modelPath:testLog:
Check the scenekit node’s materials from the corrersponding material materials of the specified node.
- (void)checkNodeMaterials:(const struct aiNode *)aiNode nodeName:(NSString *)nodeName withSceneNode:(SCNNode *)sceneNode aiScene:(const struct aiScene *)aiScene modelPath:(NSString *)modelPath testLog:(ModelLog *)testLog
Parameters
aiNode |
The assimp node. |
---|---|
nodeName |
The node name. |
sceneNode |
The scenekit node. |
aiScene |
The assimp scene. |
modelPath |
The path to the file being tested. |
testLog |
The log for the file being tested. |
Discussion
Check the scenekit node’s materials from the corrersponding material materials of the specified node.
This checks each material property of the material.
Declared In
AssimpImporterTests.m
Check lights
– checkLights:withScene:testLog:
Checks the lights in the scenekit scene correspond to the lights in the assimp scene.
- (void)checkLights:(const struct aiScene *)aiScene withScene:(SCNScene *)scene testLog:(ModelLog *)testLog
Parameters
aiScene |
The assimp. scene. |
---|---|
scene |
The scenekit scene. |
testLog |
The log for the file being tested. |
Discussion
Checks the lights in the scenekit scene correspond to the lights in the assimp scene.
Declared In
AssimpImporterTests.m
Check node
– checkNode:withSceneNode:aiScene:modelPath:testLog:
Checks the scenekit node corresponds to the assimp node and has the correct geometry and materials.
- (void)checkNode:(const struct aiNode *)aiNode withSceneNode:(SCNNode *)sceneNode aiScene:(const struct aiScene *)aiScene modelPath:(NSString *)modelPath testLog:(ModelLog *)testLog
Parameters
aiNode |
The assimp node. |
---|---|
sceneNode |
The scenekit node. |
aiScene |
The scenekit scene. |
modelPath |
The path to the file being tested. |
testLog |
The log for the file being tested. |
Discussion
Checks the scenekit node corresponds to the assimp node and has the correct geometry and materials.
Declared In
AssimpImporterTests.m
Check cameras.
– checkCameras:withScene:testLog:
Checks the cameras in the scenekit scene correspond to the cameras in the assimp scene.
- (void)checkCameras:(const struct aiScene *)aiScene withScene:(SCNScene *)scene testLog:(ModelLog *)testLog
Parameters
aiScene |
The assimp. scene. |
---|---|
scene |
The scenekit scene. |
testLog |
The log for the file being tested. |
Discussion
Checks the cameras in the scenekit scene correspond to the cameras in the assimp scene.
Declared In
AssimpImporterTests.m
Check animations
– checkPositionChannels:aiAnimation:channelKeys:duration:testLog:
Checks the animation data for bone positions in scenekit scene contains the animation data from the assimp scene for each bone in the animation.
- (void)checkPositionChannels:(const struct aiNodeAnim *)aiNodeAnim aiAnimation:(const struct aiAnimation *)aiAnimation channelKeys:(NSDictionary *)channelKeys duration:(float)duration testLog:(ModelLog *)testLog
Parameters
aiNodeAnim |
The assimp node. |
---|---|
aiAnimation |
The assimp animation. |
channelKeys |
The bone channels in the assimp animation. |
duration |
The duration of the assimp animation. |
testLog |
The log for the file being tested. |
Discussion
Checks the animation data for bone positions in scenekit scene contains the animation data from the assimp scene for each bone in the animation.
Declared In
AssimpImporterTests.m
– checkRotationChannels:aiAnimation:channelKeys:duration:testLog:
Checks the animation data for bone orientations in scenekit scene contains the animation data from the assimp scene for each bone in the animation.
- (void)checkRotationChannels:(const struct aiNodeAnim *)aiNodeAnim aiAnimation:(const struct aiAnimation *)aiAnimation channelKeys:(NSDictionary *)channelKeys duration:(float)duration testLog:(ModelLog *)testLog
Parameters
aiNodeAnim |
The assimp node. |
---|---|
aiAnimation |
The assimp animation. |
channelKeys |
The bone channels in the assimp animation. |
duration |
The duration of the assimp animation. |
testLog |
The log for the file being tested. |
Discussion
Checks the animation data for bone orientations in scenekit scene contains the animation data from the assimp scene for each bone in the animation.
Declared In
AssimpImporterTests.m
– checkScalingChannels:aiAnimation:channelKeys:duration:testLog:
Checks the animation data for bone scales in scenekit scene contains the animation data from the assimp scene for each bone in the animation.
- (void)checkScalingChannels:(const struct aiNodeAnim *)aiNodeAnim aiAnimation:(const struct aiAnimation *)aiAnimation channelKeys:(NSDictionary *)channelKeys duration:(float)duration testLog:(ModelLog *)testLog
Parameters
aiNodeAnim |
The assimp node. |
---|---|
aiAnimation |
The assimp animation. |
channelKeys |
The bone channels in the assimp animation. |
duration |
The duration of the assimp animation. |
testLog |
The log for the file being tested. |
Discussion
Checks the animation data for bone scales in scenekit scene contains the animation data from the assimp scene for each bone in the animation.
Declared In
AssimpImporterTests.m
– checkAnimations:withScene:modelPath:testLog:
Checks the animation data for bones in scenekit scene contains the animation data from the assimp scene for each bone in the animation.
- (void)checkAnimations:(const struct aiScene *)aiScene withScene:(SCNAssimpScene *)scene modelPath:(NSString *)modelPath testLog:(ModelLog *)testLog
Parameters
aiScene |
The assimp scene. |
---|---|
scene |
The scenekit scene. |
modelPath |
The path to the file being tested. |
testLog |
The log for the file being tested. |
Discussion
Checks the animation data for bones in scenekit scene contains the animation data from the assimp scene for each bone in the animation.
Declared In
AssimpImporterTests.m
– checkModel:testLog:
Checks the scene kit scene corresponds to the assimp scene.
- (void)checkModel:(NSString *)path testLog:(ModelLog *)testLog
Parameters
path |
The path to the model file being tested. |
---|---|
testLog |
The log for the file being tested. |
Discussion
Checks the scene kit scene corresponds to the assimp scene.
This is the entry point check method for each model file that is tested.
This verifies that: 1. The scenekit scene has the same node hierarchy as the assimp scene where each node has the correct geometry with geometry sources, elements and textures. 2. The scenekit has the correct lights. 3. The scenekit scene has the correct cameras. 4. If the scenekit scene has animations, it checks that the key frames created for the animation data are correct for values, timing, duration and the bone channel to which the key frame belongs.
Declared In
AssimpImporterTests.m
Test all models
– getModelFiles
Creates an array of the model files that can be tested.
- (NSArray *)getModelFiles
Return Value
The array of model files that can be tested.
Discussion
Creates an array of the model files that can be tested.
This filters the assets directory for the file formats that are supported by AssimpKit.
The list of valid file formats is stored in assets/valid-extensions.txt.
See: The test class description for more details about the assets directory.
Declared In
AssimpImporterTests.m
– testAssimpModelFormats
The test method that tests the structure and serialization of all the testable models.
- (void)testAssimpModelFormats
Discussion
The test method that tests the structure and serialization of all the testable models.
For every valid supported file extension: 1. The scene graph is checked by comparing it with a separate scene graph loaded using Assimp. 2. For every model that passes the verification test in 1 above: 1. The model scene is serialized. 2. The animation scenes, if existing, are serialized.
The pass percentage is 90% for the structure test. The pass percentage is 99% for the serialization test.
Declared In
AssimpImporterTests.m