cc: Stretch textures by .5 texels to prevent out of bounds sampling
[chromium-blink-merge.git] / printing / page_range_unittest.cc
blob7b0f5779fc249a33c3d93a3e990dd0d3c21f4b16
1 // Copyright (c) 2011 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/page_range.h"
6 #include "testing/gtest/include/gtest/gtest.h"
8 TEST(PageRangeTest, RangeMerge) {
9 printing::PageRanges ranges;
10 printing::PageRange range;
11 range.from = 1;
12 range.to = 3;
13 ranges.push_back(range);
14 range.from = 10;
15 range.to = 12;
16 ranges.push_back(range);
17 range.from = 2;
18 range.to = 5;
19 ranges.push_back(range);
20 std::vector<int> pages(printing::PageRange::GetPages(ranges));
21 ASSERT_EQ(8U, pages.size());
22 EXPECT_EQ(1, pages[0]);
23 EXPECT_EQ(2, pages[1]);
24 EXPECT_EQ(3, pages[2]);
25 EXPECT_EQ(4, pages[3]);
26 EXPECT_EQ(5, pages[4]);
27 EXPECT_EQ(10, pages[5]);
28 EXPECT_EQ(11, pages[6]);
29 EXPECT_EQ(12, pages[7]);
32 TEST(PageRangeTest, Empty) {
33 printing::PageRanges ranges;
34 std::vector<int> pages(printing::PageRange::GetPages(ranges));
35 EXPECT_EQ(0U, pages.size());