Browse Source

Moved TGA Unit Test

Thomas Buck 10 years ago
parent
commit
7ea5994520
3 changed files with 68 additions and 39 deletions
  1. 2
    2
      Makefile
  2. 0
    37
      src/mtk_tga.cpp
  3. 66
    0
      test/mtk_tga.cpp

+ 2
- 2
Makefile View File

@@ -371,8 +371,8 @@ endif
371 371
 
372 372
 TGA.test:
373 373
 	mkdir -p $(BUILD_TEST_DIR)
374
-	$(CC) $(TEST_FLAGS) -DUNIT_TEST_TGA \
375
-		src/mtk_tga.cpp -o $(BUILD_TEST_DIR)/TGA.test
374
+	$(CC) $(TEST_FLAGS) \
375
+		src/mtk_tga.cpp test/mtk_tga.cpp -o $(BUILD_TEST_DIR)/TGA.test
376 376
 
377 377
 #################################################################
378 378
 

+ 0
- 37
src/mtk_tga.cpp View File

@@ -489,40 +489,3 @@ int mtk_image__tga_save_filename(unsigned char *image,
489 489
   return v;
490 490
 }
491 491
 
492
-
493
-#ifdef UNIT_TEST_TGA
494
-int main(int argc, char *argv[])
495
-{
496
-  FILE *f;
497
-  unsigned char *image;
498
-  unsigned int width;
499
-  unsigned int height;
500
-  char type;
501
-
502
-  if (argc > 1)
503
-  {
504
-    f = fopen(argv[1], "r");
505
-
506
-    if (!f)
507
-    {
508
-      perror("Failed to open file> ");
509
-      return -1;
510
-    }
511
-
512
-    if (!mtk_image__tga_check(f))
513
-    {
514
-      if (!mtk_image__tga_load(f, &image, &width, &height, &type))
515
-      {
516
-        printf("Loaded %s successfully!\n", argv[1]);
517
-        delete [] image;
518
-      }
519
-    }
520
-
521
-    fclose(f);
522
-  } else {
523
-      printf("Usage: %s testfile.tga\n", argv[0]);
524
-  }
525
-
526
-  return 0;
527
-}
528
-#endif

+ 66
- 0
test/mtk_tga.cpp View File

@@ -0,0 +1,66 @@
1
+/*================================================================
2
+ *
3
+ * Project : Freyja
4
+ * Author  : Mongoose
5
+ * Website : http://www.westga.edu/~stu7440/
6
+ * Email   : stu7440@westga.edu
7
+ * Object  :
8
+ * License : GPL See file COPYING, also (C) 2000 Mongoose
9
+ * Comments: TGA plug-in
10
+ *
11
+ *           TODO: type should pass more info
12
+ *                 2 bits for RGBA | RGB | GREY
13
+ *                 val for depth
14
+ *
15
+ *           This file was generated using Mongoose's C++
16
+ *           template generator script.  <stu7440@westga.edu>
17
+ *
18
+ *-- History ------------------------------------------------
19
+ *
20
+ * 2001-10-25:
21
+ * Mongoose - support for screen origin bit
22
+ *
23
+ * 2000-10-15:
24
+ * Mongoose - Created
25
+ ================================================================*/
26
+
27
+#include <string.h>
28
+#include <stdarg.h>
29
+
30
+#include <mtk_tga.h>
31
+
32
+int main(int argc, char *argv[])
33
+{
34
+  FILE *f;
35
+  unsigned char *image;
36
+  unsigned int width;
37
+  unsigned int height;
38
+  char type;
39
+
40
+  if (argc > 1)
41
+  {
42
+    f = fopen(argv[1], "r");
43
+
44
+    if (!f)
45
+    {
46
+      perror("Failed to open file> ");
47
+      return -1;
48
+    }
49
+
50
+    if (!mtk_image__tga_check(f))
51
+    {
52
+      if (!mtk_image__tga_load(f, &image, &width, &height, &type))
53
+      {
54
+        printf("Loaded %s successfully!\n", argv[1]);
55
+        delete [] image;
56
+      }
57
+    }
58
+
59
+    fclose(f);
60
+  } else {
61
+      printf("Usage: %s testfile.tga\n", argv[0]);
62
+  }
63
+
64
+  return 0;
65
+}
66
+

Loading…
Cancel
Save