add tests
authorLaurent Mazet <mazet@softndesign.org>
Thu, 10 Oct 2024 05:59:49 +0000 (07:59 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Thu, 10 Oct 2024 05:59:49 +0000 (07:59 +0200)
ndisplay.c

index 10920485ce3906f9b58108a9da98154e7980eecd..0030a067012e5dc9152e5884dd496b3934ff9dee 100644 (file)
@@ -200,9 +200,9 @@ int main (int argc, char *argv[])
                 for (y = 0; y < height; y++) {
 
                     int ind = x + xcursor + images[scale]->width * (y + ycursor);
-                    if (ind >= images[scale]->width * images[scale]->height) {
-                        continue;
-                    }
+                    //if (ind >= images[scale]->width * images[scale]->height) {
+                    //    continue;
+                    //}
                     color_t *color = findncolor (correction (images[scale]->red[ind], gf[0]),
                                                  correction (images[scale]->green[ind], gf[1]),
                                                  correction (images[scale]->blue[ind], gf[2]), COLORS);
@@ -328,6 +328,11 @@ int main (int argc, char *argv[])
 /* test: TERM=vt100 ndisplay.exe image/laurent4p.ppm 2>&1 | grep 'no color avaliable' */
 /* test: ndisplay.exe -h | grep usage */
 /* test: ndisplay.exe -v 2>&1 | grep missing */
+/* test: ndisplay.exe -g 2>&1 | grep 'no gamma specified' */
+/* test: ndisplay.exe -g -1.0 2>&1 | grep 'incorrect gamma' */
+/* test: ndisplay.exe -g 1.1:0:1.1 2>&1 | grep 'incorrect gamma' */
+/* test: ndisplay.exe -g 1.1:1.2 2>&1 | grep 'incorrect gamma' */
+/* test: ndisplay.exe -g 1.1,1.2,1.0 2>&1 | grep 'incorrect gamma' */
 /* test: ndisplay.exe image/bogus1.ppm 2>&1 | grep "can't read PNM file" */
 /* test: ndisplay.exe image/bogus2.ppm 2>&1 | grep "can't read PNM file" */
 /* test: ndisplay.exe image/bogus3.pbm 2>&1 | grep "can't read PNM file" */
@@ -341,6 +346,7 @@ int main (int argc, char *argv[])
 /* test: { echo u; sleep 1; echo lll; sleep 1; echo j; sleep 1; echo q; } | ndisplay.exe image/laurent4p.pgm */
 /* test: { echo o; sleep 1; echo o; sleep 1; echo q; } | ndisplay.exe image/laurent4p.ppm */
 /* test: { echo oooo; sleep 1; echo u; sleep 1; echo q; } | ndisplay.exe image/laurent4.pbm */
+/* test: { echo kklluLK; sleep 1; echo LLIJ; sleep 1; echo LLLLLKKKKooo; sleep 1; echo ijJI; sleep 1; echo q; } | ndisplay.exe image/laurent4.ppm -w */
 /* test: { sleep 1; echo q; } | ndisplay.exe image/laurent4.pgm */
 /* test: { sleep 1; echo q; } | ndisplay.exe image/laurent4b.pgm */
 /* test: { sleep 1; echo q; } | ndisplay.exe image/laurent4.ppm -g 1.2:3:1 */