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
;
13 ranges
.push_back(range
);
16 ranges
.push_back(range
);
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());