1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2021, assimp team
7 
8 All rights reserved.
9 
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the following
12 conditions are met:
13 
14 * Redistributions of source code must retain the above
15 copyright notice, this list of conditions and the
16 following disclaimer.
17 
18 * Redistributions in binary form must reproduce the above
19 copyright notice, this list of conditions and the
20 following disclaimer in the documentation and/or other
21 materials provided with the distribution.
22 
23 * Neither the name of the assimp team, nor the names of its
24 contributors may be used to endorse or promote products
25 derived from this software without specific prior
26 written permission of the assimp team.
27 
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 ---------------------------------------------------------------------------
40 */
41 
42 #include "UnitTestPCH.h"
43 
44 #include <assimp/postprocess.h>
45 #include <assimp/Importer.hpp>
46 
47 using namespace Assimp;
48 
TEST(utACImportExport,importClosedLine)49 TEST(utACImportExport, importClosedLine) {
50     Assimp::Importer importer;
51     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/closedLine.ac", aiProcess_ValidateDataStructure);
52     ASSERT_NE(nullptr, scene);
53 }
54 
TEST(utACImportExport,importNoSurfaces)55 TEST(utACImportExport, importNoSurfaces) {
56     Assimp::Importer importer;
57     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/nosurfaces.ac", aiProcess_ValidateDataStructure);
58     ASSERT_NE(nullptr, scene);
59 }
60 
TEST(utACImportExport,importOpenLine)61 TEST(utACImportExport, importOpenLine) {
62     Assimp::Importer importer;
63     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/openLine.ac", aiProcess_ValidateDataStructure);
64     ASSERT_NE(nullptr, scene);
65 }
66 
TEST(utACImportExport,importSampleSubdiv)67 TEST(utACImportExport, importSampleSubdiv) {
68     Assimp::Importer importer;
69     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/sample_subdiv.ac", aiProcess_ValidateDataStructure);
70     ASSERT_NE(nullptr, scene);
71 }
72 
TEST(utACImportExport,importSphereWithLight)73 TEST(utACImportExport, importSphereWithLight) {
74     Assimp::Importer importer;
75     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/SphereWithLight.ac", aiProcess_ValidateDataStructure);
76     ASSERT_NE(nullptr, scene);
77 }
78 
TEST(utACImportExport,importSphereWithLightUTF16)79 TEST(utACImportExport, importSphereWithLightUTF16) {
80     Assimp::Importer importer;
81     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/SphereWithLight_UTF16LE.ac", aiProcess_ValidateDataStructure);
82     // FIXME: this is probably wrong, loading the file should succeed
83     ASSERT_EQ(nullptr, scene);
84 }
85 
TEST(utACImportExport,importSphereWithLightUTF8BOM)86 TEST(utACImportExport, importSphereWithLightUTF8BOM) {
87     Assimp::Importer importer;
88     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/SphereWithLight_UTF8BOM.ac", aiProcess_ValidateDataStructure);
89     ASSERT_NE(nullptr, scene);
90 }
91 
TEST(utACImportExport,importSphereWithLightUvScaling4X)92 TEST(utACImportExport, importSphereWithLightUvScaling4X) {
93     Assimp::Importer importer;
94     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/SphereWithLightUvScaling4X.ac", aiProcess_ValidateDataStructure);
95     ASSERT_NE(nullptr, scene);
96 }
97 
TEST(utACImportExport,importWuson)98 TEST(utACImportExport, importWuson) {
99     Assimp::Importer importer;
100     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/Wuson.ac", aiProcess_ValidateDataStructure);
101     ASSERT_NE(nullptr, scene);
102 }
103 
TEST(utACImportExport,importWusonACC)104 TEST(utACImportExport, importWusonACC) {
105     Assimp::Importer importer;
106     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/Wuson.acc", aiProcess_ValidateDataStructure);
107     ASSERT_NE(nullptr, scene);
108 }
109 
TEST(utACImportExport,testFormatDetection)110 TEST(utACImportExport, testFormatDetection) {
111     Assimp::Importer importer;
112     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/TestFormatDetection", aiProcess_ValidateDataStructure);
113     ASSERT_NE(nullptr, scene);
114 }
115