Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cpwl_combo_box_embeddertest.cpp
Go to the documentation of this file.
1
// Copyright 2017 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
"fpdfsdk/pwl/cpwl_combo_box_embeddertest.h"
6
7
#
include
"fpdfsdk/cpdfsdk_annotiterator.h"
8
#
include
"fpdfsdk/cpdfsdk_formfillenvironment.h"
9
#
include
"fpdfsdk/cpdfsdk_helpers.h"
10
#
include
"fpdfsdk/cpdfsdk_widget.h"
11
#
include
"fpdfsdk/formfiller/cffl_formfield.h"
12
#
include
"fpdfsdk/formfiller/cffl_interactiveformfiller.h"
13
#
include
"fpdfsdk/pwl/cpwl_combo_box.h"
14
#
include
"fpdfsdk/pwl/cpwl_wnd.h"
15
#
include
"public/fpdf_fwlevent.h"
16
#
include
"testing/gtest/include/gtest/gtest.h"
17
18
void
CPWLComboBoxEmbedderTest
::
SetUp
() {
19
EmbedderTest
::
SetUp
();
20
CreateAndInitializeFormComboboxPDF
(
)
;
21
}
22
23
void
CPWLComboBoxEmbedderTest
::
TearDown
() {
24
UnloadPage
(
GetPage
(
)
);
25
EmbedderTest
::
TearDown
();
26
}
27
28
void
CPWLComboBoxEmbedderTest
::
CreateAndInitializeFormComboboxPDF
() {
29
ASSERT_TRUE(
OpenDocument
(
"combobox_form.pdf"
));
30
m_page =
LoadPage
(0);
31
ASSERT_TRUE(m_page);
32
33
m_pFormFillEnv = CPDFSDKFormFillEnvironmentFromFPDFFormHandle(
form_handle
());
34
m_pPageView = m_pFormFillEnv
->
GetPageViewAtIndex
(
0
)
;
35
CPDFSDK_AnnotIterator
iter(m_pPageView, {
CPDF_Annot
::
Subtype
::
WIDGET
});
36
37
// User editable combobox.
38
m_pAnnotEditable =
ToCPDFSDKWidget
(
iter
.
GetFirstAnnot
(
)
)
;
39
ASSERT_TRUE(m_pAnnotEditable);
40
41
// Normal combobox with pre-selected value.
42
m_pAnnotNormal =
ToCPDFSDKWidget
(
iter
.
GetNextAnnot
(m_pAnnotEditable)
)
;
43
ASSERT_TRUE(m_pAnnotNormal);
44
45
// Read-only combobox.
46
CPDFSDK_Annot
* pAnnotReadOnly = iter
.
GetNextAnnot
(m_pAnnotNormal);
47
CPDFSDK_Annot
* pLastAnnot = iter
.
GetLastAnnot
(
)
;
48
ASSERT_EQ(pAnnotReadOnly, pLastAnnot);
49
}
50
51
void
CPWLComboBoxEmbedderTest
::
FormFillerAndWindowSetup
(
52
CPDFSDK_Widget* pAnnotCombobox) {
53
CFFL_InteractiveFormFiller* pInteractiveFormFiller =
54
m_pFormFillEnv
->
GetInteractiveFormFiller
(
)
;
55
{
56
ObservedPtr<CPDFSDK_Widget> pObserved(pAnnotCombobox);
57
EXPECT_TRUE(pInteractiveFormFiller
->
OnSetFocus
(
pObserved
,
{}
)
);
58
}
59
60
m_pFormField = pInteractiveFormFiller
->
GetFormFieldForTesting
(
pAnnotCombobox
)
;
61
ASSERT_TRUE(m_pFormField);
62
63
CPWL_Wnd
* pWindow =
64
m_pFormField
->
GetPWLWindow
(
m_pFormFillEnv
->
GetPageViewAtIndex
(
0
)
)
;
65
ASSERT_TRUE(pWindow);
66
m_pComboBox =
static_cast
<CPWL_ComboBox*>(pWindow);
67
}
68
69
void
CPWLComboBoxEmbedderTest
::
TypeTextIntoTextField
(
int
num_chars) {
70
// Type text starting with 'A' to as many chars as specified by |num_chars|.
71
for
(
int
i = 0; i < num_chars; ++i) {
72
EXPECT_TRUE(
73
GetCFFLFormField
(
)
->
OnChar
(
GetCPDFSDKAnnotUserEditable
(
)
, i +
'A'
, {}));
74
}
75
}
CFFL_FormField::OnChar
virtual bool OnChar(CPDFSDK_Widget *pAnnot, uint32_t nChar, Mask< FWL_EVENTFLAG > nFlags)
Definition
cffl_formfield.cpp:172
CFFL_FormField::GetPWLWindow
CPWL_Wnd * GetPWLWindow(const CPDFSDK_PageView *pPageView) const
Definition
cffl_formfield.cpp:356
CFFL_InteractiveFormFiller::OnSetFocus
bool OnSetFocus(ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlag)
Definition
cffl_interactiveformfiller.cpp:353
CFFL_InteractiveFormFiller::GetFormFieldForTesting
CFFL_FormField * GetFormFieldForTesting(CPDFSDK_Widget *pAnnot)
Definition
cffl_interactiveformfiller.h:123
CPDFSDK_AnnotIterator
Definition
cpdfsdk_annotiterator.h:20
CPDFSDK_AnnotIterator::GetFirstAnnot
CPDFSDK_Annot * GetFirstAnnot()
Definition
cpdfsdk_annotiterator.cpp:48
CPDFSDK_AnnotIterator::GetLastAnnot
CPDFSDK_Annot * GetLastAnnot()
Definition
cpdfsdk_annotiterator.cpp:52
CPDFSDK_AnnotIterator::GetNextAnnot
CPDFSDK_Annot * GetNextAnnot(CPDFSDK_Annot *pAnnot)
Definition
cpdfsdk_annotiterator.cpp:56
CPDFSDK_Annot
Definition
cpdfsdk_annot.h:24
CPDFSDK_FormFillEnvironment::GetPageViewAtIndex
CPDFSDK_PageView * GetPageViewAtIndex(int nIndex)
Definition
cpdfsdk_formfillenvironment.cpp:643
CPDFSDK_FormFillEnvironment::GetInteractiveFormFiller
CFFL_InteractiveFormFiller * GetInteractiveFormFiller()
Definition
cpdfsdk_formfillenvironment.h:241
CPDF_Annot
Definition
cpdf_annot.h:32
CPDF_Annot::Subtype
Subtype
Definition
cpdf_annot.h:35
CPDF_Annot::Subtype::WIDGET
@ WIDGET
Definition
cpdf_annot.h:56
CPWLComboBoxEmbedderTest
Definition
cpwl_combo_box_embeddertest.h:18
CPWLComboBoxEmbedderTest::TypeTextIntoTextField
void TypeTextIntoTextField(int num_chars)
Definition
cpwl_combo_box_embeddertest.cpp:69
CPWLComboBoxEmbedderTest::GetCFFLFormField
CFFL_FormField * GetCFFLFormField() const
Definition
cpwl_combo_box_embeddertest.h:28
CPWLComboBoxEmbedderTest::GetCPDFSDKAnnotUserEditable
CPDFSDK_Widget * GetCPDFSDKAnnotUserEditable() const
Definition
cpwl_combo_box_embeddertest.h:30
CPWLComboBoxEmbedderTest::CreateAndInitializeFormComboboxPDF
void CreateAndInitializeFormComboboxPDF()
Definition
cpwl_combo_box_embeddertest.cpp:28
CPWLComboBoxEmbedderTest::TearDown
void TearDown() override
Definition
cpwl_combo_box_embeddertest.cpp:23
CPWLComboBoxEmbedderTest::GetPage
FPDF_PAGE GetPage() const
Definition
cpwl_combo_box_embeddertest.h:26
CPWLComboBoxEmbedderTest::SetUp
void SetUp() override
Definition
cpwl_combo_box_embeddertest.cpp:18
CPWLComboBoxEmbedderTest::FormFillerAndWindowSetup
void FormFillerAndWindowSetup(CPDFSDK_Widget *pAnnotCombobox)
Definition
cpwl_combo_box_embeddertest.cpp:51
CPWL_Wnd
Definition
cpwl_wnd.h:77
EmbedderTest
Definition
embedder_test.h:40
EmbedderTest::SetUp
void SetUp() override
Definition
embedder_test.cpp:276
EmbedderTest::TearDown
void TearDown() override
Definition
embedder_test.cpp:284
EmbedderTest::LoadPage
FPDF_PAGE LoadPage(int page_index)
Definition
embedder_test.cpp:517
EmbedderTest::UnloadPage
void UnloadPage(FPDF_PAGE page)
Definition
embedder_test.cpp:542
EmbedderTest::form_handle
FPDF_FORMHANDLE form_handle() const
Definition
embedder_test.h:128
EmbedderTest::OpenDocument
bool OpenDocument(const std::string &filename)
Definition
embedder_test.cpp:304
ToCPDFSDKWidget
CPDFSDK_Widget * ToCPDFSDKWidget(CPDFSDK_Annot *pAnnot)
Definition
cpdfsdk_widget.h:191
qtwebengine
src
3rdparty
chromium
third_party
pdfium
fpdfsdk
pwl
cpwl_combo_box_embeddertest.cpp
Generated on
for Qt by
1.18.0