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

Side by Side Diff: core/src/fpdfdoc/doc_basic_unittest.cpp

Issue 1711893003: Remove CFX_{Byte,Wide}String::ConvertFrom(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 4 years, 10 months 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
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | core/src/fpdfdoc/doc_form.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/include/fpdfdoc/fpdf_doc.h" 5 #include "core/include/fpdfdoc/fpdf_doc.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 #else 138 #else
139 L"/docs/test.pdf", 139 L"/docs/test.pdf",
140 L"/docs/test.pdf" 140 L"/docs/test.pdf"
141 #endif 141 #endif
142 }; 142 };
143 // String object. 143 // String object.
144 ScopedObj str_obj(new CPDF_String(L"babababa")); 144 ScopedObj str_obj(new CPDF_String(L"babababa"));
145 CPDF_FileSpec file_spec1(str_obj.get()); 145 CPDF_FileSpec file_spec1(str_obj.get());
146 file_spec1.SetFileName(test_data.input); 146 file_spec1.SetFileName(test_data.input);
147 // Check internal object value. 147 // Check internal object value.
148 CFX_ByteString str; 148 CFX_ByteString str = CFX_ByteString::FromUnicode(test_data.expected);
149 str.ConvertFrom(test_data.expected);
150 EXPECT_TRUE(str == str_obj->GetString()); 149 EXPECT_TRUE(str == str_obj->GetString());
151 // Check we can get the file name back. 150 // Check we can get the file name back.
152 CFX_WideString file_name; 151 CFX_WideString file_name;
153 EXPECT_TRUE(file_spec1.GetFileName(&file_name)); 152 EXPECT_TRUE(file_spec1.GetFileName(&file_name));
154 EXPECT_TRUE(file_name.Equal(test_data.input)); 153 EXPECT_TRUE(file_name.Equal(test_data.input));
155 154
156 // Dictionary object. 155 // Dictionary object.
157 ScopedDict dict_obj(new CPDF_Dictionary); 156 ScopedDict dict_obj(new CPDF_Dictionary);
158 CPDF_FileSpec file_spec2(dict_obj.get()); 157 CPDF_FileSpec file_spec2(dict_obj.get());
159 file_spec2.SetFileName(test_data.input); 158 file_spec2.SetFileName(test_data.input);
160 // Check internal object value. 159 // Check internal object value.
161 file_name = dict_obj->GetUnicodeTextBy("F"); 160 file_name = dict_obj->GetUnicodeTextBy("F");
162 EXPECT_TRUE(file_name.Equal(test_data.expected)); 161 EXPECT_TRUE(file_name.Equal(test_data.expected));
163 file_name = dict_obj->GetUnicodeTextBy("UF"); 162 file_name = dict_obj->GetUnicodeTextBy("UF");
164 EXPECT_TRUE(file_name.Equal(test_data.expected)); 163 EXPECT_TRUE(file_name.Equal(test_data.expected));
165 // Check we can get the file name back. 164 // Check we can get the file name back.
166 EXPECT_TRUE(file_spec2.GetFileName(&file_name)); 165 EXPECT_TRUE(file_spec2.GetFileName(&file_name));
167 EXPECT_TRUE(file_name.Equal(test_data.input)); 166 EXPECT_TRUE(file_name.Equal(test_data.input));
168 } 167 }
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | core/src/fpdfdoc/doc_form.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698