Merge pull request #2922 from mapnik/value-ostream-fix

fix #2921
This commit is contained in:
Artem Pavlenko 2015-06-23 17:53:35 +02:00
commit 717ab98788
3 changed files with 12 additions and 1 deletions

View file

@ -958,7 +958,6 @@ inline std::size_t hash_value(value const& val)
} // namespace value_adl_barrier
using value_adl_barrier::value;
using value_adl_barrier::operator<<;
namespace detail {

View file

@ -2,11 +2,14 @@
#include <mapnik/value_types.hpp>
#include <mapnik/value.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/util/conversions.hpp>
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <sstream>
#if defined(_MSC_VER) && _MSC_VER < 1900
#include <cstdio>
@ -289,6 +292,14 @@ SECTION("to string") {
vc[val2] = 1;
REQUIRE( vc[1] == static_cast<int>(1) );
// mapnik::value << to ostream
std::stringstream s;
mapnik::transcoder tr("utf-8");
mapnik::value_unicode_string ustr = tr.transcode("hello world!");
mapnik::value streamable(ustr);
s << streamable;
CHECK( s.str() == std::string("hello world!") );
}
catch (std::exception const & ex)
{

View file

@ -1,6 +1,7 @@
#include "catch.hpp"
// mapnik
#include <mapnik/value.hpp>
#include <mapnik/image_any.hpp>
#include <mapnik/color.hpp>
#include <mapnik/image_view_any.hpp>