25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

77 satır
1.8 KiB

  1. #include "UnitTestPCH.h"
  2. #include "utExport.h"
  3. #ifndef ASSIMP_BUILD_NO_EXPORT
  4. CPPUNIT_TEST_SUITE_REGISTRATION (ExporterTest);
  5. void ExporterTest :: setUp (void)
  6. {
  7. ex = new Assimp::Exporter();
  8. im = new Assimp::Importer();
  9. pTest = im->ReadFile("../../test/models/X/test.x",0);
  10. }
  11. void ExporterTest :: tearDown (void)
  12. {
  13. delete ex;
  14. delete im;
  15. }
  16. void ExporterTest :: testExportToFile (void)
  17. {
  18. const char* file = "unittest_output.dae";
  19. CPPUNIT_ASSERT_EQUAL(AI_SUCCESS,ex->Export(pTest,"collada",file));
  20. // check if we can read it again
  21. CPPUNIT_ASSERT(im->ReadFile(file,0));
  22. }
  23. void ExporterTest :: testExportToBlob (void)
  24. {
  25. const aiExportDataBlob* blob = ex->ExportToBlob(pTest,"collada");
  26. CPPUNIT_ASSERT(blob);
  27. CPPUNIT_ASSERT(blob->data);
  28. CPPUNIT_ASSERT(blob->size > 0);
  29. CPPUNIT_ASSERT(!blob->name.length);
  30. // XXX test chained blobs (i.e. obj file with accompanying mtl script)
  31. // check if we can read it again
  32. CPPUNIT_ASSERT(im->ReadFileFromMemory(blob->data,blob->size,0,"dae"));
  33. }
  34. void ExporterTest :: testCppExportInterface (void)
  35. {
  36. CPPUNIT_ASSERT(ex->GetExportFormatCount() > 0);
  37. for(size_t i = 0; i < ex->GetExportFormatCount(); ++i) {
  38. const aiExportFormatDesc* const desc = ex->GetExportFormatDescription(i);
  39. CPPUNIT_ASSERT(desc);
  40. CPPUNIT_ASSERT(desc->description && strlen(desc->description));
  41. CPPUNIT_ASSERT(desc->fileExtension && strlen(desc->fileExtension));
  42. CPPUNIT_ASSERT(desc->id && strlen(desc->id));
  43. }
  44. CPPUNIT_ASSERT(ex->IsDefaultIOHandler());
  45. }
  46. void ExporterTest :: testCExportInterface (void)
  47. {
  48. CPPUNIT_ASSERT(aiGetExportFormatCount() > 0);
  49. for(size_t i = 0; i < aiGetExportFormatCount(); ++i) {
  50. const aiExportFormatDesc* const desc = aiGetExportFormatDescription(i);
  51. CPPUNIT_ASSERT(desc);
  52. // rest has aleady been validated by testCppExportInterface
  53. }
  54. }
  55. #endif