From 67b2a358814beb7135552219cceca8c9b3f137a1 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 24 Apr 2017 09:45:54 -0400 Subject: Cleanup the XFA Bacode widget This Cl cleans up the XFA barcode widget. The custom binary search is removed. Some code shuffled from the header to the cpp file. Nits fixed. Change-Id: Icad0d2b25b07ea36afc5a5922a79f55b82616486 Reviewed-on: https://pdfium-review.googlesource.com/4394 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/app/xfa_ffbarcode_unittest.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 xfa/fxfa/app/xfa_ffbarcode_unittest.cpp (limited to 'xfa/fxfa/app/xfa_ffbarcode_unittest.cpp') diff --git a/xfa/fxfa/app/xfa_ffbarcode_unittest.cpp b/xfa/fxfa/app/xfa_ffbarcode_unittest.cpp new file mode 100644 index 0000000000..95e2377cd8 --- /dev/null +++ b/xfa/fxfa/app/xfa_ffbarcode_unittest.cpp @@ -0,0 +1,25 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "xfa/fxfa/app/xfa_ffbarcode.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/base/ptr_util.h" + +TEST(XFA_FFBarcode, GetBarcodeTypeByName) { + EXPECT_EQ(nullptr, CXFA_FFBarcode::GetBarcodeTypeByName(L"")); + EXPECT_EQ(nullptr, CXFA_FFBarcode::GetBarcodeTypeByName(L"not_found")); + + auto* data = CXFA_FFBarcode::GetBarcodeTypeByName(L"ean13"); + ASSERT_NE(nullptr, data); + EXPECT_EQ(BarcodeType::ean13, data->eName); + + data = CXFA_FFBarcode::GetBarcodeTypeByName(L"pdf417"); + ASSERT_NE(nullptr, data); + EXPECT_EQ(BarcodeType::pdf417, data->eName); + + data = CXFA_FFBarcode::GetBarcodeTypeByName(L"code3Of9"); + ASSERT_NE(nullptr, data); + EXPECT_EQ(BarcodeType::code3Of9, data->eName); +} -- cgit v1.2.3