#include "cc/base/tiling_data.h"
#include <algorithm>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
namespace cc {
namespace {
int NumTiles(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels) { … }
int XIndex(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int x_coord) { … }
int YIndex(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int y_coord) { … }
int MinBorderXIndex(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int x_coord) { … }
int MinBorderYIndex(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int y_coord) { … }
int MaxBorderXIndex(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int x_coord) { … }
int MaxBorderYIndex(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int y_coord) { … }
int PosX(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int x_index) { … }
int PosY(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int y_index) { … }
int SizeX(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int x_index) { … }
int SizeY(const gfx::Size& max_texture_size,
const gfx::Rect& tiling_rect,
int border_texels,
int y_index) { … }
class TilingDataTest : public ::testing::TestWithParam<gfx::Vector2d> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(TilingDataTest, NumTiles_NoTiling) { … }
TEST_P(TilingDataTest, NumTiles_TilingNoBorders) { … }
TEST_P(TilingDataTest, NumTiles_TilingWithBorders) { … }
TEST_P(TilingDataTest, TileXIndexFromSrcCoord) { … }
TEST_P(TilingDataTest, FirstBorderTileXIndexFromSrcCoord) { … }
TEST_P(TilingDataTest, LastBorderTileXIndexFromSrcCoord) { … }
TEST_P(TilingDataTest, TileYIndexFromSrcCoord) { … }
TEST_P(TilingDataTest, FirstBorderTileYIndexFromSrcCoord) { … }
TEST_P(TilingDataTest, LastBorderTileYIndexFromSrcCoord) { … }
TEST_P(TilingDataTest, TileSizeX) { … }
TEST_P(TilingDataTest, TileSizeY) { … }
TEST_P(TilingDataTest, TileSizeX_and_TilePositionX) { … }
TEST_P(TilingDataTest, TileSizeY_and_TilePositionY) { … }
TEST_P(TilingDataTest, SetTilingSize) { … }
TEST_P(TilingDataTest, SetMaxTextureSizeNoBorders) { … }
TEST_P(TilingDataTest, SetMaxTextureSizeBorders) { … }
TEST_P(TilingDataTest, ExpandRectToTileBounds) { … }
TEST_P(TilingDataTest, Assignment) { … }
TEST_P(TilingDataTest, LargeBorders) { … }
void TestIterate(const TilingData& data,
gfx::Rect rect,
int expect_left,
int expect_top,
int expect_right,
int expect_bottom,
bool include_borders) { … }
void TestIterateBorders(const TilingData& data,
gfx::Rect rect,
int expect_left,
int expect_top,
int expect_right,
int expect_bottom) { … }
void TestIterateNoBorders(const TilingData& data,
gfx::Rect rect,
int expect_left,
int expect_top,
int expect_right,
int expect_bottom) { … }
void TestIterateAll(const TilingData& data,
gfx::Rect rect,
int expect_left,
int expect_top,
int expect_right,
int expect_bottom) { … }
TEST_P(TilingDataTest, IteratorNoBorderTexels) { … }
TEST_P(TilingDataTest, BordersIteratorOneBorderTexel) { … }
TEST_P(TilingDataTest, NoBordersIteratorOneBorderTexel) { … }
TEST_P(TilingDataTest, BordersIteratorManyBorderTexels) { … }
TEST_P(TilingDataTest, NoBordersIteratorManyBorderTexels) { … }
TEST_P(TilingDataTest, IteratorOneTile) { … }
TEST_P(TilingDataTest, IteratorNoTiles) { … }
void TestDiff(const TilingData& data,
gfx::Rect consider,
gfx::Rect ignore,
size_t num_tiles) { … }
TEST_P(TilingDataTest, DifferenceIteratorIgnoreGeometry) { … }
TEST_P(TilingDataTest, DifferenceIteratorManyBorderTexels) { … }
TEST_P(TilingDataTest, DifferenceIteratorOneTile) { … }
TEST_P(TilingDataTest, DifferenceIteratorNoTiles) { … }
}
}