Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: printing/page_range_unittest.cc

Issue 8002013: Cleanup: Remove dead code - PageRange::GetTotalPages. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/page_range.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "printing/page_range.h" 5 #include "printing/page_range.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 TEST(PageRangeTest, RangeMerge) { 8 TEST(PageRangeTest, RangeMerge) {
9 printing::PageRanges ranges; 9 printing::PageRanges ranges;
10 printing::PageRange range; 10 printing::PageRange range;
11 range.from = 1; 11 range.from = 1;
12 range.to = 3; 12 range.to = 3;
13 ranges.push_back(range); 13 ranges.push_back(range);
14 range.from = 10; 14 range.from = 10;
15 range.to = 12; 15 range.to = 12;
16 ranges.push_back(range); 16 ranges.push_back(range);
17 range.from = 2; 17 range.from = 2;
18 range.to = 5; 18 range.to = 5;
19 ranges.push_back(range); 19 ranges.push_back(range);
20 std::vector<int> pages(printing::PageRange::GetPages(ranges)); 20 std::vector<int> pages(printing::PageRange::GetPages(ranges));
21 ASSERT_EQ(8U, pages.size()); 21 ASSERT_EQ(8U, pages.size());
22 EXPECT_EQ(1, pages[0]); 22 EXPECT_EQ(1, pages[0]);
23 EXPECT_EQ(2, pages[1]); 23 EXPECT_EQ(2, pages[1]);
24 EXPECT_EQ(3, pages[2]); 24 EXPECT_EQ(3, pages[2]);
25 EXPECT_EQ(4, pages[3]); 25 EXPECT_EQ(4, pages[3]);
26 EXPECT_EQ(5, pages[4]); 26 EXPECT_EQ(5, pages[4]);
27 EXPECT_EQ(10, pages[5]); 27 EXPECT_EQ(10, pages[5]);
28 EXPECT_EQ(11, pages[6]); 28 EXPECT_EQ(11, pages[6]);
29 EXPECT_EQ(12, pages[7]); 29 EXPECT_EQ(12, pages[7]);
30 EXPECT_EQ(8, printing::PageRange::GetTotalPages(ranges));
31 } 30 }
32 31
33 TEST(PageRangeTest, Empty) { 32 TEST(PageRangeTest, Empty) {
34 printing::PageRanges ranges; 33 printing::PageRanges ranges;
35 std::vector<int> pages(printing::PageRange::GetPages(ranges)); 34 std::vector<int> pages(printing::PageRange::GetPages(ranges));
36 EXPECT_EQ(0U, pages.size()); 35 EXPECT_EQ(0U, pages.size());
37 EXPECT_EQ(0, printing::PageRange::GetTotalPages(ranges));
38 } 36 }
OLDNEW
« no previous file with comments | « printing/page_range.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698