diff options
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cfxjse_formcalc_context_embeddertest.cpp | 19 | ||||
-rw-r--r-- | fxjs/xfa/cjx_eventpseudomodel.cpp | 6 | ||||
-rw-r--r-- | fxjs/xfa/cjx_eventpseudomodel.h | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/fxjs/cfxjse_formcalc_context_embeddertest.cpp b/fxjs/cfxjse_formcalc_context_embeddertest.cpp index ba39182364..4b9d93a660 100644 --- a/fxjs/cfxjse_formcalc_context_embeddertest.cpp +++ b/fxjs/cfxjse_formcalc_context_embeddertest.cpp @@ -1554,3 +1554,22 @@ TEST_F(CFXJSE_FormCalcContextEmbedderTest, EventChangeSelection) { EXPECT_EQ(4, context->GetEventParam()->m_iSelStart); EXPECT_EQ(4, context->GetEventParam()->m_iSelEnd); } + +TEST_F(CFXJSE_FormCalcContextEmbedderTest, XFAEventCancelAction) { + ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); + + CXFA_EventParam params; + params.m_bCancelAction = false; + + CFXJSE_Engine* context = GetScriptContext(); + context->SetEventParam(params); + + EXPECT_TRUE(Execute("xfa.event.cancelAction")); + + CFXJSE_Value* value = GetValue(); + EXPECT_TRUE(value->IsBoolean()); + EXPECT_FALSE(value->ToBoolean()); + + EXPECT_TRUE(Execute("xfa.event.cancelAction = \"true\"")); + EXPECT_TRUE(context->GetEventParam()->m_bCancelAction); +} diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp index 0dea7153b7..82b76fce12 100644 --- a/fxjs/xfa/cjx_eventpseudomodel.cpp +++ b/fxjs/xfa/cjx_eventpseudomodel.cpp @@ -56,6 +56,12 @@ CJX_EventPseudoModel::CJX_EventPseudoModel(CScript_EventPseudoModel* model) CJX_EventPseudoModel::~CJX_EventPseudoModel() {} +void CJX_EventPseudoModel::cancelAction(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute) { + Property(pValue, XFA_Event::CancelAction, bSetting); +} + void CJX_EventPseudoModel::change(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute) { diff --git a/fxjs/xfa/cjx_eventpseudomodel.h b/fxjs/xfa/cjx_eventpseudomodel.h index 92d731c289..5d8bcc3060 100644 --- a/fxjs/xfa/cjx_eventpseudomodel.h +++ b/fxjs/xfa/cjx_eventpseudomodel.h @@ -41,6 +41,7 @@ class CJX_EventPseudoModel : public CJX_Object { JS_METHOD(emit, CJX_EventPseudoModel); JS_METHOD(reset, CJX_EventPseudoModel); + JS_PROP(cancelAction); JS_PROP(change); JS_PROP(commitKey); JS_PROP(fullText); |