Add gfx/rect_io.h

This commit is contained in:
David Capello 2014-11-07 10:30:02 -03:00
parent 24e0939ad2
commit 9df732e27b
2 changed files with 30 additions and 15 deletions

27
src/gfx/rect_io.h Normal file
View File

@ -0,0 +1,27 @@
// Aseprite Gfx Library
// Copyright (C) 2001-2014 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef GFX_RECT_IO_H_INCLUDED
#define GFX_RECT_IO_H_INCLUDED
#pragma once
#include "gfx/rect.h"
#include <iosfwd>
namespace gfx {
std::ostream& operator<<(std::ostream& os, const Rect& rect)
{
return os << "("
<< rect.x << ", "
<< rect.y << ", "
<< rect.w << ", "
<< rect.h << ")";
}
}
#endif

View File

@ -6,26 +6,14 @@
#include <gtest/gtest.h>
#include "gfx/rect.h"
#include "gfx/size.h"
#include "gfx/border.h"
#include "gfx/rect.h"
#include "gfx/rect_io.h"
#include "gfx/size.h"
using namespace std;
using namespace gfx;
namespace gfx {
ostream& operator<<(ostream& os, const Rect& rect)
{
return os << "("
<< rect.x << ", "
<< rect.y << ", "
<< rect.w << ", "
<< rect.h << ")";
}
}
TEST(Rect, Ctor)
{
EXPECT_EQ(Rect(0, 0, 0, 0), Rect());