summaryrefslogtreecommitdiffstats
path: root/printing/page_number_unittest.cc
blob: ece1e0f6f0afe51dbd55fef8796ce771d03c7e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "printing/page_number.h"
#include "printing/print_settings.h"
#include "testing/gtest/include/gtest/gtest.h"

TEST(PageNumberTest, Count) {
  printing::PrintSettings settings;
  printing::PageNumber page;
  EXPECT_EQ(printing::PageNumber::npos(), page);
  page.Init(settings, 3);
  EXPECT_EQ(0, page.ToInt());
  EXPECT_NE(printing::PageNumber::npos(), page);
  ++page;
  EXPECT_EQ(1, page.ToInt());
  EXPECT_NE(printing::PageNumber::npos(), page);

  printing::PageNumber page_copy(page);
  EXPECT_EQ(1, page_copy.ToInt());
  EXPECT_EQ(1, page.ToInt());
  ++page;
  EXPECT_EQ(1, page_copy.ToInt());
  EXPECT_EQ(2, page.ToInt());
  ++page;
  EXPECT_EQ(printing::PageNumber::npos(), page);
  ++page;
  EXPECT_EQ(printing::PageNumber::npos(), page);
}