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
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
22
27
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);
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
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
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(
74 }
75}
virtual bool OnChar(CPDFSDK_Widget *pAnnot, uint32_t nChar, Mask< FWL_EVENTFLAG > nFlags)
CPWL_Wnd * GetPWLWindow(const CPDFSDK_PageView *pPageView) const
bool OnSetFocus(ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlag)
CFFL_FormField * GetFormFieldForTesting(CPDFSDK_Widget *pAnnot)
CPDFSDK_Annot * GetNextAnnot(CPDFSDK_Annot *pAnnot)
CPDFSDK_PageView * GetPageViewAtIndex(int nIndex)
CFFL_InteractiveFormFiller * GetInteractiveFormFiller()
CFFL_FormField * GetCFFLFormField() const
CPDFSDK_Widget * GetCPDFSDKAnnotUserEditable() const
void FormFillerAndWindowSetup(CPDFSDK_Widget *pAnnotCombobox)
void SetUp() override
void TearDown() override
void UnloadPage(FPDF_PAGE page)
FPDF_PAGE LoadPage(int page_number)
FPDF_FORMHANDLE form_handle() const
bool OpenDocument(const std::string &filename)
CPDFSDK_Widget * ToCPDFSDKWidget(CPDFSDK_Annot *pAnnot)