utBlenderIntermediate.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2025, assimp team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the assimp team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the assimp team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. #include "UnitTestPCH.h"
  35. #include "AssetLib/Blender/BlenderIntermediate.h"
  36. #include <assimp/camera.h>
  37. #include <assimp/light.h>
  38. #include <assimp/mesh.h>
  39. #include <assimp/texture.h>
  40. using namespace ::Assimp;
  41. using namespace ::Assimp::Blender;
  42. class BlenderIntermediateTest : public ::testing::Test {
  43. // empty
  44. };
  45. #define NAME_1 "name1"
  46. #define NAME_2 "name2"
  47. // Updated this test after fixing #1776:
  48. // A comparator in C++ is used for ordering and must implement strict weak ordering,
  49. // which means it must return false for equal values.
  50. // The C++ standard defines and expects this behavior: true if lhs < rhs, false otherwise.
  51. TEST_F(BlenderIntermediateTest, ConversionData_ObjectCompareTest) {
  52. Object obj1, obj2;
  53. strncpy(obj1.id.name, NAME_1, sizeof(obj1.id.name));
  54. strncpy(obj2.id.name, NAME_2, sizeof(obj2.id.name));
  55. Blender::ObjectCompare cmp_true_because_first_is_smaller_than_second;
  56. bool res(cmp_true_because_first_is_smaller_than_second(&obj1, &obj2));
  57. EXPECT_TRUE(res);
  58. Blender::ObjectCompare cmp_false_because_equal;
  59. res = cmp_false_because_equal(&obj1, &obj1);
  60. EXPECT_FALSE(res);
  61. Blender::ObjectCompare cmp_false_because_first_is_greater_than_second;
  62. res = cmp_false_because_first_is_greater_than_second(&obj2, &obj1);
  63. EXPECT_FALSE(res);
  64. }