Chris Reuter avatar 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.)

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();
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.