[Cronet] Delay StartNetLog and StopNetLog until native request context is initialized
[chromium-blink-merge.git] / ui / gfx / nine_image_painter_unittest.cc
blob8cf01baf6ca898c976e1a4c4158590569fcf9370
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/gfx/nine_image_painter.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/geometry/insets.h"
9 #include "ui/gfx/geometry/rect.h"
11 namespace gfx {
13 TEST(NineImagePainterTest, GetSubsetRegions) {
14 SkBitmap src;
15 src.allocN32Pixels(40, 50);
16 const ImageSkia image_skia(ImageSkiaRep(src, 1.0));
17 const Insets insets(1, 2, 3, 4);
18 std::vector<Rect> rects;
19 NineImagePainter::GetSubsetRegions(image_skia, insets, &rects);
20 ASSERT_EQ(9u, rects.size());
21 EXPECT_EQ(gfx::Rect(0, 0, 2, 1), rects[0]);
22 EXPECT_EQ(gfx::Rect(2, 0, 34, 1), rects[1]);
23 EXPECT_EQ(gfx::Rect(36, 0, 4, 1), rects[2]);
24 EXPECT_EQ(gfx::Rect(0, 1, 2, 46), rects[3]);
25 EXPECT_EQ(gfx::Rect(2, 1, 34, 46), rects[4]);
26 EXPECT_EQ(gfx::Rect(36, 1, 4, 46), rects[5]);
27 EXPECT_EQ(gfx::Rect(0, 47, 2, 3), rects[6]);
28 EXPECT_EQ(gfx::Rect(2, 47, 34, 3), rects[7]);
29 EXPECT_EQ(gfx::Rect(36, 47, 4, 3), rects[8]);
32 } // namespace gfx