Suppress a test failing after the last WebKit merge.
[chromium-blink-merge.git] / printing / printed_page_unittest.cc
blob91b2111a92ccf44e383f4578093e31eef51c158e
1 // Copyright (c) 2010 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 "printing/printed_page.h"
7 #include <string>
8 #include <vector>
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace printing {
14 TEST(PrintedPageTest, GetCenteredPageContentRect) {
15 scoped_refptr<PrintedPage> page;
16 gfx::Rect page_content;
18 // No centering.
19 page =new PrintedPage(1,
20 NULL,
21 gfx::Size(1200, 1200),
22 gfx::Rect(0, 0, 400, 1100),
23 true);
24 page->GetCenteredPageContentRect(gfx::Size(1000, 1000), &page_content);
25 EXPECT_EQ(0, page_content.x());
26 EXPECT_EQ(0, page_content.y());
27 EXPECT_EQ(400, page_content.width());
28 EXPECT_EQ(1100, page_content.height());
30 // X centered.
31 page = new PrintedPage(1,
32 NULL,
33 gfx::Size(500, 1200),
34 gfx::Rect(0, 0, 400, 1100),
35 true);
36 page->GetCenteredPageContentRect(gfx::Size(1000, 1000), &page_content);
37 EXPECT_EQ(250, page_content.x());
38 EXPECT_EQ(0, page_content.y());
39 EXPECT_EQ(400, page_content.width());
40 EXPECT_EQ(1100, page_content.height());
42 // Y centered.
43 page = new PrintedPage(1,
44 NULL,
45 gfx::Size(1200, 500),
46 gfx::Rect(0, 0, 400, 1100),
47 true);
48 page->GetCenteredPageContentRect(gfx::Size(1000, 1000), &page_content);
49 EXPECT_EQ(0, page_content.x());
50 EXPECT_EQ(250, page_content.y());
51 EXPECT_EQ(400, page_content.width());
52 EXPECT_EQ(1100, page_content.height());
54 // Both X and Y centered.
55 page = new PrintedPage(1,
56 NULL,
57 gfx::Size(500, 500),
58 gfx::Rect(0, 0, 400, 1100),
59 true);
60 page->GetCenteredPageContentRect(gfx::Size(1000, 1000), &page_content);
61 EXPECT_EQ(250, page_content.x());
62 EXPECT_EQ(250, page_content.y());
63 EXPECT_EQ(400, page_content.width());
64 EXPECT_EQ(1100, page_content.height());
67 } // namespace printing