diff --git a/src/app/color_tests.cpp b/src/app/color_tests.cpp index 9e2b451ab..11d0c52d4 100644 --- a/src/app/color_tests.cpp +++ b/src/app/color_tests.cpp @@ -22,8 +22,12 @@ using namespace app; -inline std::ostream& operator<<(std::ostream& os, const Color& color) { - return os << color.toString(); +namespace app { + + inline std::ostream& operator<<(std::ostream& os, const Color& color) { + return os << color.toString(); + } + } TEST(Color, fromRgb) diff --git a/src/app/document_range_tests.cpp b/src/app/document_range_tests.cpp index 20e6825f2..4e03427dd 100644 --- a/src/app/document_range_tests.cpp +++ b/src/app/document_range_tests.cpp @@ -31,6 +31,15 @@ using namespace app; using namespace raster; +namespace app { + + std::ostream& operator<<(std::ostream& os, const DocumentRange& range) { + return os << "{ layers: [" << range.layerBegin() << ", " << range.layerEnd() << "]" + << ", frames: [" << range.frameBegin() << ", " << range.frameEnd() << "] }"; + } + +} + typedef base::UniquePtr DocumentPtr; #define EXPECT_LAYER_ORDER(a, b, c, d) \ @@ -123,11 +132,6 @@ inline DocumentRange frames_range(int frame) { return range(0, frame, 0, frame, DocumentRange::kFrames); } -std::ostream& operator<<(std::ostream& os, const DocumentRange& range) { - return os << "{ layers: [" << range.layerBegin() << ", " << range.layerEnd() << "]" - << ", frames: [" << range.frameBegin() << ", " << range.frameEnd() << "] }"; -} - TEST_F(DocRangeOps, MoveLayersNoOp) { // Move one layer to the same place diff --git a/src/base/version_tests.cpp b/src/base/version_tests.cpp index 04284f8a4..7f9d6242b 100644 --- a/src/base/version_tests.cpp +++ b/src/base/version_tests.cpp @@ -11,9 +11,12 @@ using namespace base; -std::ostream& operator<<(std::ostream& os, const Version& ver) -{ - return os << convert_to(ver); +namespace base { + + std::ostream& operator<<(std::ostream& os, const Version& ver) { + return os << convert_to(ver); + } + } TEST(Version, Ctor) diff --git a/src/css/css_tests.cpp b/src/css/css_tests.cpp index b25735b39..593ba1efb 100644 --- a/src/css/css_tests.cpp +++ b/src/css/css_tests.cpp @@ -9,20 +9,23 @@ #include "css/css.h" using namespace css; -using namespace std; -ostream& operator<<(ostream& os, const Value& value) -{ - os << "(" << value.type(); +namespace css { - if (value.type() == Value::Number) - os << ", " << value.number() << " [" << value.unit() << "]"; - else if (value.type() == Value::String) - os << ", " << value.string(); + std::ostream& operator<<(std::ostream& os, const Value& value) + { + os << "(" << value.type(); - os << ")"; - return os; -} + if (value.type() == Value::Number) + os << ", " << value.number() << " [" << value.unit() << "]"; + else if (value.type() == Value::String) + os << ", " << value.string(); + + os << ")"; + return os; + } + +} // namespace css TEST(Css, Style) { diff --git a/src/gfx/hsv_tests.cpp b/src/gfx/hsv_tests.cpp index 04270c984..a46e61f26 100644 --- a/src/gfx/hsv_tests.cpp +++ b/src/gfx/hsv_tests.cpp @@ -12,15 +12,19 @@ using namespace gfx; using namespace std; -ostream& operator<<(ostream& os, const Hsv& hsv) -{ - return os << "(" - << hsv.hueInt() << ", " - << hsv.saturationInt() << ", " - << hsv.valueInt() << "); real: (" - << hsv.hue() << ", " - << hsv.saturation() << ", " - << hsv.value() << ")"; +namespace gfx { + + ostream& operator<<(ostream& os, const Hsv& hsv) + { + return os << "(" + << hsv.hueInt() << ", " + << hsv.saturationInt() << ", " + << hsv.valueInt() << "); real: (" + << hsv.hue() << ", " + << hsv.saturation() << ", " + << hsv.value() << ")"; + } + } TEST(Hsv, Ctor) diff --git a/src/gfx/rect_tests.cpp b/src/gfx/rect_tests.cpp index a653375c7..59d8aa511 100644 --- a/src/gfx/rect_tests.cpp +++ b/src/gfx/rect_tests.cpp @@ -13,13 +13,17 @@ using namespace std; using namespace gfx; -ostream& operator<<(ostream& os, const Rect& rect) -{ - return os << "(" - << rect.x << ", " - << rect.y << ", " - << rect.w << ", " - << rect.h << ")"; +namespace gfx { + + ostream& operator<<(ostream& os, const Rect& rect) + { + return os << "(" + << rect.x << ", " + << rect.y << ", " + << rect.w << ", " + << rect.h << ")"; + } + } TEST(Rect, Ctor) diff --git a/src/gfx/region_tests.cpp b/src/gfx/region_tests.cpp index 70811dc04..da299241a 100644 --- a/src/gfx/region_tests.cpp +++ b/src/gfx/region_tests.cpp @@ -12,13 +12,16 @@ using namespace std; using namespace gfx; -ostream& operator<<(ostream& os, const Rect& rect) -{ - return os << "(" - << rect.x << ", " - << rect.y << ", " - << rect.w << ", " - << rect.h << ")"; +namespace gfx { + + ostream& operator<<(ostream& os, const Rect& rect) { + return os << "(" + << rect.x << ", " + << rect.y << ", " + << rect.w << ", " + << rect.h << ")"; + } + } ostream& operator<<(ostream& os, const Region& rgn) diff --git a/src/gfx/rgb_tests.cpp b/src/gfx/rgb_tests.cpp index c3bb26293..920b250d0 100644 --- a/src/gfx/rgb_tests.cpp +++ b/src/gfx/rgb_tests.cpp @@ -12,12 +12,15 @@ using namespace gfx; using namespace std; -ostream& operator<<(ostream& os, const Rgb& rgb) -{ - return os << "(" - << rgb.red() << ", " - << rgb.green() << ", " - << rgb.blue() << ")"; +namespace gfx { + + ostream& operator<<(ostream& os, const Rgb& rgb) { + return os << "(" + << rgb.red() << ", " + << rgb.green() << ", " + << rgb.blue() << ")"; + } + } TEST(Rgb, Ctor)