Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_function_unittest.cpp
Go to the documentation of this file.
1// Copyright 2020 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "core/fpdfapi/page/cpdf_function.h"
6
7#include "core/fpdfapi/parser/cpdf_array.h"
8#include "core/fpdfapi/parser/cpdf_dictionary.h"
9#include "core/fpdfapi/parser/cpdf_number.h"
10#include "core/fxcrt/retain_ptr.h"
11#include "testing/gtest/include/gtest/gtest.h"
12
14 auto pDict = pdfium::MakeRetain<CPDF_Dictionary>();
15 pDict->SetNewFor<CPDF_Number>("FunctionType", -2);
16 EXPECT_FALSE(CPDF_Function::Load(pDict));
17
18 pDict->SetNewFor<CPDF_Number>("FunctionType", 5);
19 EXPECT_FALSE(CPDF_Function::Load(pDict));
20}
21
23 auto pDict = pdfium::MakeRetain<CPDF_Dictionary>();
24 pDict->SetNewFor<CPDF_Number>("FunctionType", 0);
25 EXPECT_FALSE(CPDF_Function::Load(pDict));
26}
27
29 auto pDict = pdfium::MakeRetain<CPDF_Dictionary>();
30 pDict->SetNewFor<CPDF_Number>("FunctionType", 0);
31 pDict->SetNewFor<CPDF_Array>("Domain");
32 EXPECT_FALSE(CPDF_Function::Load(pDict));
33}
34
36 auto pDict = pdfium::MakeRetain<CPDF_Dictionary>();
37 pDict->SetNewFor<CPDF_Number>("FunctionType", 0);
38
39 auto pArray = pDict->SetNewFor<CPDF_Array>("Domain");
40 pArray->AppendNew<CPDF_Number>(0);
41 pArray->AppendNew<CPDF_Number>(10);
42 EXPECT_FALSE(CPDF_Function::Load(pDict));
43}
TEST(FXCRYPT, MD5GenerateEmtpyData)