summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-03-28 20:00:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-28 20:00:35 +0000
commit53a8093c6ef694ec520fe0b087fbac86af97f5e8 (patch)
tree519a805d66eed415e310eb67a05212c6d217025d /core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
parent971a674ef17526ad37ce55ba90110830b94889d0 (diff)
downloadpdfium-53a8093c6ef694ec520fe0b087fbac86af97f5e8.tar.xz
Use CPDF_DefaultAppearance instead of custom parsing
This CL moves code over to using CPDF_DefaultAppearance instead of calling the CPDF_SimpleParser directly. This means the code for finding a specific tag start can move into CPDF_DefaultAppearance directly. Change-Id: I1dc64e54aedd03d059b963121d466f3eb75c17db Reviewed-on: https://pdfium-review.googlesource.com/28410 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp36
1 files changed, 0 insertions, 36 deletions
diff --git a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
index b53b6c6c7f..2fb50f1ff3 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
@@ -59,39 +59,3 @@ TEST(SimpleParserTest, GetWord) {
<< " for case " << i;
}
}
-
-TEST(SimpleParserTest, FindTagParamFromStart) {
- static const struct FindTagTestStruct {
- const unsigned char* input;
- unsigned int input_size;
- const char* token;
- int num_params;
- bool result;
- unsigned int result_pos;
- } test_data[] = {
- // Empty strings.
- STR_IN_TEST_CASE("", "Tj", 1, false, 0),
- STR_IN_TEST_CASE("", "", 1, false, 0),
- // Empty token.
- STR_IN_TEST_CASE(" T j", "", 1, false, 5),
- // No parameter.
- STR_IN_TEST_CASE("Tj", "Tj", 1, false, 2),
- STR_IN_TEST_CASE("(Tj", "Tj", 1, false, 3),
- // Partial token match.
- STR_IN_TEST_CASE("\r12\t34 56 78Tj", "Tj", 1, false, 15),
- // Regular cases with various parameters.
- STR_IN_TEST_CASE("\r\0abd Tj", "Tj", 1, true, 0),
- STR_IN_TEST_CASE("12 4 Tj 3 46 Tj", "Tj", 1, true, 2),
- STR_IN_TEST_CASE("er^ 2 (34) (5667) Tj", "Tj", 2, true, 5),
- STR_IN_TEST_CASE("<344> (232)\t343.4\n12 45 Tj", "Tj", 3, true, 11),
- STR_IN_TEST_CASE("1 2 3 4 5 6 7 8 cm", "cm", 6, true, 3),
- };
- for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
- const FindTagTestStruct& data = test_data[i];
- CPDF_SimpleParser parser(ByteStringView(data.input, data.input_size));
- EXPECT_EQ(data.result,
- parser.FindTagParamFromStart(data.token, data.num_params))
- << " for case " << i;
- EXPECT_EQ(data.result_pos, parser.GetCurPosForTest()) << " for case " << i;
- }
-}