Open Source Tomb Raider Engine
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

mtk_tga.cpp 998B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*!
  2. * \file test/mtk_tga.cpp
  3. * \brief The TGA reader Unit Test
  4. *
  5. * \author xythobuz
  6. */
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <greatest.h>
  10. #include <mtk_tga.h>
  11. #define TESTFILE "data/font-0.tga"
  12. FILE *f = NULL;
  13. TEST checkFile() {
  14. ASSERTm("File wasn't opened. Please run the suite!", f != NULL);
  15. ASSERT_FALSEm("File is invalid?!", mtk_image__tga_check(f));
  16. PASS();
  17. }
  18. TEST loadFile() {
  19. unsigned char *image;
  20. unsigned int width, height;
  21. char type;
  22. ASSERTm("File wasn't opened. Please run the suite!", f != NULL);
  23. ASSERT_FALSEm("File couldn't be loaded!", mtk_image__tga_load(f, &image, &width, &height, &type));
  24. printf("\nWidth: %u\nHeight: %u\nType: %d\n", width, height, type);
  25. PASS();
  26. }
  27. SUITE(tgaSuite) {
  28. f = fopen(TESTFILE, "r");
  29. RUN_TEST(checkFile);
  30. RUN_TEST(loadFile);
  31. fclose(f);
  32. }
  33. GREATEST_MAIN_DEFS();
  34. int main(int argc, char *argv[]) {
  35. GREATEST_MAIN_BEGIN();
  36. RUN_SUITE(tgaSuite);
  37. GREATEST_MAIN_END();
  38. }