blob: 1c38770edbd42c337458fdb2edea533986120aa4 [file] [log] [blame]
Tom Sepeza310e002015-02-27 13:03:07 -08001// Copyright 2015 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5
Tom Sepez1ed8a212015-05-11 15:25:39 -07006#include "../../public/fpdf_formfill.h"
Tom Sepeza310e002015-02-27 13:03:07 -08007#include "../../testing/embedder_test.h"
8#include "../../testing/embedder_test_mock_delegate.h"
Tom Sepez6efc0ad2015-06-02 17:11:18 -07009#include "../../testing/embedder_test_timer_handling_delegate.h"
Tom Sepeza310e002015-02-27 13:03:07 -080010#include "testing/gmock/include/gmock/gmock.h"
11#include "testing/gtest/include/gtest/gtest.h"
12
13using testing::_;
14using testing::Return;
15
16class FPDFFormFillEmbeddertest : public EmbedderTest {
17};
18
19TEST_F(FPDFFormFillEmbeddertest, FirstTest) {
20 EmbedderTestMockDelegate mock;
21 EXPECT_CALL(mock, Alert(_, _, _, _)).Times(0);
22 EXPECT_CALL(mock, UnsupportedHandler(_)).Times(0);
Tom Sepez6efc0ad2015-06-02 17:11:18 -070023 EXPECT_CALL(mock, SetTimer(_, _)).Times(0);
24 EXPECT_CALL(mock, KillTimer(_)).Times(0);
Tom Sepeza310e002015-02-27 13:03:07 -080025 SetDelegate(&mock);
26
27 EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf"));
28 FPDF_PAGE page = LoadPage(0);
29 EXPECT_NE(nullptr, page);
Lei Zhangd27acae2015-05-15 15:36:02 -070030 UnloadPage(page);
Tom Sepeza310e002015-02-27 13:03:07 -080031}
Tom Sepez6efc0ad2015-06-02 17:11:18 -070032
33TEST_F(FPDFFormFillEmbeddertest, BUG_487928) {
34 EmbedderTestTimerHandlingDelegate delegate;
35 SetDelegate(&delegate);
36
37 EXPECT_TRUE(OpenDocument("testing/resources/bug_487928.pdf"));
38 FPDF_PAGE page = LoadPage(0);
39 EXPECT_NE(nullptr, page);
40 DoOpenActions();
41 delegate.AdvanceTime(5000);
42 UnloadPage(page);
43}
Tom Sepez0b133982015-07-28 11:23:22 -070044
45TEST_F(FPDFFormFillEmbeddertest, BUG_514690) {
46 EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf"));
47 FPDF_PAGE page = LoadPage(0);
48 EXPECT_NE(nullptr, page);
49
50 // Test that FORM_OnMouseMove() etc. permit null HANDLES and PAGES.
51 FORM_OnMouseMove(nullptr, page, 0, 10.0, 10.0);
52 FORM_OnMouseMove(form_handle(), nullptr, 0, 10.0, 10.0);
53
54 UnloadPage(page);
55}