1// Copyright (c) 2006-2008 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.
4
5#include "printing/page_number.h"
6#include "printing/print_settings.h"
7#include "testing/gtest/include/gtest/gtest.h"
8
9TEST(PageNumberTest, Count) {
10  printing::PrintSettings settings;
11  printing::PageNumber page;
12  EXPECT_EQ(printing::PageNumber::npos(), page);
13  page.Init(settings, 3);
14  EXPECT_EQ(0, page.ToInt());
15  EXPECT_NE(printing::PageNumber::npos(), page);
16  ++page;
17  EXPECT_EQ(1, page.ToInt());
18  EXPECT_NE(printing::PageNumber::npos(), page);
19
20  printing::PageNumber page_copy(page);
21  EXPECT_EQ(1, page_copy.ToInt());
22  EXPECT_EQ(1, page.ToInt());
23  ++page;
24  EXPECT_EQ(1, page_copy.ToInt());
25  EXPECT_EQ(2, page.ToInt());
26  ++page;
27  EXPECT_EQ(printing::PageNumber::npos(), page);
28  ++page;
29  EXPECT_EQ(printing::PageNumber::npos(), page);
30}
31