Commits

Anonymous committed 61d9d37 Merge

Merged failing test in to default branch. Fix confirmed on MinGW, at least.

  • Participants
  • Parent commits b06d502, 3471a73

Comments (0)

Files changed (4)

tests/system_tests/alpha_palette.png

Added
New image

tests/system_tests/chancount/main.cpp

+// Copyright 2008 Edd Dawson.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file BOOST_LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <pngxx/read.hpp>
+#include <imagexx/raster_details.hpp>
+
+#include <iostream>
+#include <iterator>
+#include <stdexcept>
+#include <vector>
+
+int main(int argc, char **argv)
+{
+    if (argc != 2)
+    {
+        std::cout <<
+            "usage:\n"
+            "      chancount <pngfile>\n"
+            "\n"
+            "This program will load the file specified and return the number of channels in the image.";
+
+        return 0;
+    }
+
+    try
+    {
+        std::vector<unsigned char> raster;
+        imagexx::raster_details d = pngxx::read_image(argv[1], back_inserter(raster));
+        return d.channels();
+    }
+    catch (const std::exception &ex)
+    {
+        std::cerr << "error: " << ex.what() << '\n';
+        return 0;
+    }
+}
+

tests/system_tests/chancount/slamfile

+# Copyright 2009 Edd Dawson.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+sources : common : *.cpp
+
+defines : debug : DEBUG
+defines : release : NDEBUG
+
+depends : common : ../../..
+include : common : ../../../include ../../../../imagexx/include
+
+flags : common : strict iso
+flags : debug : debug optimize-off
+flags : release : optimize
+
+target : common : chancount
+type : common : executable
+
+dir : common : obj/$(toolset)/$(variant)

tests/system_tests/tests.script

 # Create some short-hand variables
 > load = load/obj/$(toolset)/$(variant)/load
 > save = save/obj/$(toolset)/$(variant)/save
+> chancount = chancount/obj/$(toolset)/$(variant)/chancount
 
 # Load a bunch of PNG images and check that the rasters are as described in the .desc files
 
 ! check_return $(save) rgb_uncompressed.desc 0
 ! check_return $(save) rgba_uncompressed.desc 0
 ! check_return $(save) pal16_uncompressed.desc 0
+
+# Load the PNG file to check the correct number of channels are found.
+! check_return $(chancount) alpha_palette.png 4