Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 <mtk_tga.h>
  10. #include "greatest.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. }