Commits

Chris Reuter committed 0dfd45c

Bug fix: tests didn't (always) return a valid status.

gdImageAALine_thickness.c didn't explicitly return 0 on success.

gdimageline_bug5.c was not an actual test at all. It now confirms that the
tested operation (a line draw) alters the image it draws on. (Not ideal
but better than what it did before.)

  • Participants
  • Parent commits 16ccce6

Comments (0)

Files changed (2)

tests/gdimageline/gdImageAALine_thickness.c

 	}
 
 	gdImageDestroy(im);
+
+    return 0;
 }

tests/gdimageline/gdimageline_bug5.c

 
 int main() {
 	/* Declare the image */
-	gdImagePtr im;
+	gdImagePtr im, ref;
 
 	/* Declare output files */
 	/* FILE *pngout; */
 	/* white background */
 	gdImageFill(im, 1, 1, white);
 
+    /* Make a reference copy. */
+    ref = gdImageClone(im);
+
 	gdImageSetAntiAliased(im, black);
 
-	/* This line fails! */
+	/* This line used to fail. */
 	gdImageLine(im, 28562, 631, 34266, 750, gdAntiAliased);
 
-	/* Open a file for writing. "wb" means "write binary", important under MSDOS, harmless under Unix. */
-	/* pngout = fopen("test.png", "wb"); */
+    gdTestAssert(gdMaxPixelDiff(im, ref) > 0);
+
+#if 0
+    {
+        FILE *pngout;
 
-	/* Output the image to the disk file in PNG format. */
-	/* gdImagePng(im, pngout); */
+        /* Open a file for writing. "wb" means "write binary",
+         * important under MSDOS, harmless under Unix. */
+        pngout = fopen("test.png", "wb");
 
-	/* Close the files. */
-	/* fclose(pngout); */
+        /* Output the image to the disk file in PNG format. */
+        gdImagePng(im, pngout);
+
+        /* Close the files. */
+        fclose(pngout);
+    }
+#endif
 
 	/* Destroy the image in memory. */
 	gdImageDestroy(im);
+    gdImageDestroy(ref);
+
+    return gdNumFailures();
 }