diff options
author | Lei Zhang <thestig@chromium.org> | 2017-04-24 16:22:54 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-24 23:48:50 +0000 |
commit | 3684a151e76991bc67dd397cba66b0620cc38bae (patch) | |
tree | 812e4708fabf622b475233e4112bc443f768670e /fxbarcode/oned/BC_OnedCode128Writer.h | |
parent | 9ff306d958e178843b292044ce208cda86adc825 (diff) | |
download | pdfium-3684a151e76991bc67dd397cba66b0620cc38bae.tar.xz |
Add tests for BC_OnedCode128Writer encoding functions.
Make encoding functions return pattern indices instead of pattern
pointers for easier testing. Also remove some dead code.
Change-Id: Ib80d84b2e6828bbc8920b931d77bbcd82427f01a
Reviewed-on: https://pdfium-review.googlesource.com/4474
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxbarcode/oned/BC_OnedCode128Writer.h')
-rw-r--r-- | fxbarcode/oned/BC_OnedCode128Writer.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.h b/fxbarcode/oned/BC_OnedCode128Writer.h index c4c0bf0037..f1b346ddbd 100644 --- a/fxbarcode/oned/BC_OnedCode128Writer.h +++ b/fxbarcode/oned/BC_OnedCode128Writer.h @@ -15,10 +15,15 @@ class CBC_OnedCode128Writer : public CBC_OneDimWriter { public: - CBC_OnedCode128Writer(); explicit CBC_OnedCode128Writer(BC_TYPE type); ~CBC_OnedCode128Writer() override; + // Exposed for testing. + static int32_t Encode128B(const CFX_ByteString& contents, + std::vector<int32_t>* patterns); + static int32_t Encode128C(const CFX_ByteString& contents, + std::vector<int32_t>* patterns); + // CBC_OneDimWriter uint8_t* EncodeWithHint(const CFX_ByteString& contents, BCFORMAT format, @@ -32,15 +37,9 @@ class CBC_OnedCode128Writer : public CBC_OneDimWriter { bool SetTextLocation(BC_TEXT_LOC location); - BC_TYPE GetType(); + BC_TYPE GetType() const { return m_codeFormat; } private: - bool IsDigits(const CFX_ByteString& contents, int32_t start, int32_t length); - int32_t Encode128B(const CFX_ByteString& contents, - std::vector<const int8_t*>* patterns); - int32_t Encode128C(const CFX_ByteString& contents, - std::vector<const int8_t*>* patterns); - BC_TYPE m_codeFormat; }; |