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

Side by Side Diff: core/fpdfapi/page/fpdf_page_parser_old_unittest.cpp

Issue 2474303003: Clean up fpdf_page_parsers (Closed)
Patch Set: Remove PDF_ from namespace stuff Created 4 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright 2015 PDFium 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 "core/fpdfapi/page/pageint.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 TEST(fpdf_page_parser_old, ReadHexString) {
9 {
10 // Position out of bounds.
11 uint8_t data[] = "12ab>";
12 CPDF_StreamParser parser(data, 5);
13 parser.SetPos(6);
14 EXPECT_EQ("", parser.ReadHexString());
15 }
16
17 {
18 // Regular conversion.
19 uint8_t data[] = "1A2b>abcd";
20 CPDF_StreamParser parser(data, 5);
21 EXPECT_EQ("\x1a\x2b", parser.ReadHexString());
22 EXPECT_EQ(5u, parser.GetPos());
23 }
24
25 {
26 // Missing ending >
27 uint8_t data[] = "1A2b";
28 CPDF_StreamParser parser(data, 5);
29 EXPECT_EQ("\x1a\x2b", parser.ReadHexString());
30 EXPECT_EQ(5u, parser.GetPos());
31 }
32
33 {
34 // Uneven number of bytes.
35 uint8_t data[] = "1A2>asdf";
36 CPDF_StreamParser parser(data, 5);
37 EXPECT_EQ("\x1a\x20", parser.ReadHexString());
38 EXPECT_EQ(4u, parser.GetPos());
39 }
40
41 {
42 uint8_t data[] = ">";
43 CPDF_StreamParser parser(data, 5);
44 EXPECT_EQ("", parser.ReadHexString());
45 EXPECT_EQ(1u, parser.GetPos());
46 }
47 }
OLDNEW
« no previous file with comments | « core/fpdfapi/page/fpdf_page_parser_old.cpp ('k') | core/fpdfapi/page/fpdf_page_parser_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698