OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/fxcrt/fx_basic.h" | 5 #include "core/fxcrt/fx_basic.h" |
6 #include "testing/fx_string_testhelpers.h" | 6 #include "testing/fx_string_testhelpers.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h" | 8 #include "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h" |
9 | 9 |
10 TEST(PDF417HighLevelEncoder, EncodeHighLevel) { | 10 TEST(PDF417HighLevelEncoder, EncodeHighLevel) { |
(...skipping 25 matching lines...) Expand all Loading... |
36 L"\u039c\u00c9\u031f\u012a\u00d2\u02d0", 6}, | 36 L"\u039c\u00c9\u031f\u012a\u00d2\u02d0", 6}, |
37 | 37 |
38 // Same result if initially in numeric compaction mode. | 38 // Same result if initially in numeric compaction mode. |
39 {"xxxxxx", 0, 6, CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION, | 39 {"xxxxxx", 0, 6, CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION, |
40 L"\u039c\u00c9\u031f\u012a\u00d2\u02d0", 6}, | 40 L"\u039c\u00c9\u031f\u012a\u00d2\u02d0", 6}, |
41 }; | 41 }; |
42 | 42 |
43 CBC_PDF417HighLevelEncoder::Initialize(); | 43 CBC_PDF417HighLevelEncoder::Initialize(); |
44 for (size_t i = 0; i < FX_ArraySize(encode_binary_cases); ++i) { | 44 for (size_t i = 0; i < FX_ArraySize(encode_binary_cases); ++i) { |
45 EncodeBinaryCase* ptr = &encode_binary_cases[i]; | 45 EncodeBinaryCase* ptr = &encode_binary_cases[i]; |
46 CFX_ByteArray input_array; | 46 CFX_ArrayTemplate<uint8_t> input_array; |
47 size_t input_length = strlen(ptr->input); | 47 size_t input_length = strlen(ptr->input); |
48 input_array.SetSize(input_length); | 48 input_array.SetSize(input_length); |
49 for (size_t j = 0; j < input_length; ++j) { | 49 for (size_t j = 0; j < input_length; ++j) { |
50 input_array.SetAt(j, ptr->input[j]); | 50 input_array.SetAt(j, ptr->input[j]); |
51 } | 51 } |
52 CFX_WideString expected(ptr->expected, ptr->expected_length); | 52 CFX_WideString expected(ptr->expected, ptr->expected_length); |
53 CFX_WideString result; | 53 CFX_WideString result; |
54 CBC_PDF417HighLevelEncoder::encodeBinary( | 54 CBC_PDF417HighLevelEncoder::encodeBinary( |
55 &input_array, ptr->offset, ptr->count, ptr->startmode, result); | 55 &input_array, ptr->offset, ptr->count, ptr->startmode, result); |
56 EXPECT_EQ(expected, result) << " for case number " << i; | 56 EXPECT_EQ(expected, result) << " for case number " << i; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 CFX_WideString input(ptr->input); | 222 CFX_WideString input(ptr->input); |
223 int actual_count = | 223 int actual_count = |
224 CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(input, | 224 CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(input, |
225 ptr->offset); | 225 ptr->offset); |
226 EXPECT_EQ(ptr->expected_count, actual_count) << " for case number " << i; | 226 EXPECT_EQ(ptr->expected_count, actual_count) << " for case number " << i; |
227 } | 227 } |
228 CBC_PDF417HighLevelEncoder::Finalize(); | 228 CBC_PDF417HighLevelEncoder::Finalize(); |
229 } | 229 } |
230 | 230 |
231 TEST(PDF417HighLevelEncoder, ConsecutiveBinaryCount) {} | 231 TEST(PDF417HighLevelEncoder, ConsecutiveBinaryCount) {} |
OLD | NEW |