OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium 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 "core/fpdfapi/fpdf_parser/cpdf_boolean.h" | 5 #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" |
6 #include "core/fpdfapi/fpdf_parser/cpdf_null.h" | 6 #include "core/fpdfapi/fpdf_parser/cpdf_null.h" |
7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
8 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 EXPECT_STREQ(indirect_obj_results[i], m_RefObjs[i]->GetString().c_str()); | 197 EXPECT_STREQ(indirect_obj_results[i], m_RefObjs[i]->GetString().c_str()); |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 TEST_F(PDFObjectsTest, GetUnicodeText) { | 201 TEST_F(PDFObjectsTest, GetUnicodeText) { |
202 const wchar_t* direct_obj_results[] = { | 202 const wchar_t* direct_obj_results[] = { |
203 L"", L"", L"", L"", L"A simple test", | 203 L"", L"", L"", L"", L"A simple test", |
204 L"\t\n", L"space", L"", L"", L"abcdefghijklmnopqrstuvwxyz", | 204 L"\t\n", L"space", L"", L"", L"abcdefghijklmnopqrstuvwxyz", |
205 L""}; | 205 L""}; |
206 // Check for direct objects. | 206 // Check for direct objects. |
207 for (size_t i = 0; i < m_DirectObjs.size(); ++i) | 207 for (size_t i = 0; i < m_DirectObjs.size(); ++i) { |
208 EXPECT_STREQ(direct_obj_results[i], | 208 EXPECT_STREQ(direct_obj_results[i], |
209 m_DirectObjs[i]->GetUnicodeText().c_str()); | 209 m_DirectObjs[i]->GetUnicodeText().c_str()); |
| 210 } |
210 | 211 |
211 // Check indirect references. | 212 // Check indirect references. |
212 for (const auto& it : m_RefObjs) | 213 for (const auto& it : m_RefObjs) |
213 EXPECT_STREQ(L"", it->GetUnicodeText().c_str()); | 214 EXPECT_STREQ(L"", it->GetUnicodeText().c_str()); |
214 } | 215 } |
215 | 216 |
216 TEST_F(PDFObjectsTest, GetNumber) { | 217 TEST_F(PDFObjectsTest, GetNumber) { |
217 const FX_FLOAT direct_obj_results[] = {0, 0, 1245, 9.00345f, 0, 0, | 218 const FX_FLOAT direct_obj_results[] = {0, 0, 1245, 9.00345f, 0, 0, |
218 0, 0, 0, 0, 0}; | 219 0, 0, 0, 0, 0}; |
219 // Check for direct objects. | 220 // Check for direct objects. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 EXPECT_EQ(arr->GetCount(), arr1->GetCount()); | 736 EXPECT_EQ(arr->GetCount(), arr1->GetCount()); |
736 for (size_t i = 0; i < arr->GetCount(); ++i) { | 737 for (size_t i = 0; i < arr->GetCount(); ++i) { |
737 EXPECT_EQ(CPDF_Object::REFERENCE, arr->GetObjectAt(i)->GetType()); | 738 EXPECT_EQ(CPDF_Object::REFERENCE, arr->GetObjectAt(i)->GetType()); |
738 EXPECT_EQ(indirect_objs[i], arr->GetObjectAt(i)->GetDirect()); | 739 EXPECT_EQ(indirect_objs[i], arr->GetObjectAt(i)->GetDirect()); |
739 EXPECT_EQ(indirect_objs[i], arr->GetDirectObjectAt(i)); | 740 EXPECT_EQ(indirect_objs[i], arr->GetDirectObjectAt(i)); |
740 EXPECT_EQ(CPDF_Object::REFERENCE, arr1->GetObjectAt(i)->GetType()); | 741 EXPECT_EQ(CPDF_Object::REFERENCE, arr1->GetObjectAt(i)->GetType()); |
741 EXPECT_EQ(indirect_objs[i], arr1->GetObjectAt(i)->GetDirect()); | 742 EXPECT_EQ(indirect_objs[i], arr1->GetObjectAt(i)->GetDirect()); |
742 EXPECT_EQ(indirect_objs[i], arr1->GetDirectObjectAt(i)); | 743 EXPECT_EQ(indirect_objs[i], arr1->GetDirectObjectAt(i)); |
743 } | 744 } |
744 } | 745 } |
OLD | NEW |