Commit 701a6d29 authored by allan.jensen@digia.com's avatar allan.jensen@digia.com
Browse files

[Qt] DumpRenderTree needs a beginDragWithFiles implementation

https://bugs.webkit.org/show_bug.cgi?id=50902

Reviewed by Simon Hausmann.

Tools:

Implement support for beginDragWithFiles. This function similates dragging without going
though regular event handling. Which allows us to test effects of dropping files on
different elements.

* DumpRenderTree/qt/EventSenderQt.cpp:
(EventSender::EventSender):
(EventSender::mouseUp):
(EventSender::mouseMoveTo):
(EventSender::beginDragWithFiles):
* DumpRenderTree/qt/EventSenderQt.h:
(EventSender):

LayoutTests:

Move some skipped tests that now passing in DRT to only being skipped in WTR.

* platform/qt-5.0-wk2/TestExpectations:
* platform/qt/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f8403115
2012-10-10 Allan Sandfeld Jensen <allan.jensen@digia.com>
[Qt] DumpRenderTree needs a beginDragWithFiles implementation
https://bugs.webkit.org/show_bug.cgi?id=50902
Reviewed by Simon Hausmann.
Move some skipped tests that now passing in DRT to only being skipped in WTR.
* platform/qt-5.0-wk2/TestExpectations:
* platform/qt/TestExpectations:
2012-10-10 Zoltan Arvai <zarvai@inf.u-szeged.hu>
[Qt] Unreviewed gardening. Skip failing test.
......
......@@ -64,6 +64,24 @@ fast/forms/legend-access-key.html
fast/loader/policy-delegate-action-hit-test-zoomed.html
# eventSender.gestureTap
fast/events/touch/gesture/gesture-click.html
# eventSender.beginDragWithFiles
fast/dom/Window/window-postmessage-clone-frames.html
fast/dom/Window/window-postmessage-clone.html
fast/events/drag-file-crash.html
fast/events/drag-to-navigate.html
fast/events/file-input-hidden-in-ondrop.html
fast/events/input-element-display-none-in-dragleave-crash.html
fast/files/file-list-test.html
fast/files/file-reader-directory-crash.html
fast/files/read-blob-async.html
fast/files/read-file-async.html
fast/forms/file/get-file-upload.html
fast/forms/file/input-file-write-files.html
fast/forms/file/file-input-change-event.html
fast/forms/file/recover-file-input-in-unposted-form.html
fast/forms/file/selected-files-from-history-state.html
http/tests/local/blob/send-hybrid-blob.html
http/tests/local/formdata
svg/custom/use-events-crash.svg
......
......@@ -606,30 +606,12 @@ http/tests/local/drag-over-remote-content.html
http/tests/local/fileapi
http/tests/security/drag-drop-same-unique-origin.html
# [Qt] DumpRenderTree needs eventSender.beginDragWithFiles() implementation
# https://bugs.webkit.org/show_bug.cgi?id=50902
editing/pasteboard/dataTransfer-setData-getData.html
editing/pasteboard/drag-drop-url-with-style.html
editing/pasteboard/file-drag-to-editable.html
editing/pasteboard/file-input-files-access.html
fast/dom/Window/window-postmessage-clone-frames.html
fast/dom/Window/window-postmessage-clone.html
fast/events/drag-file-crash.html
fast/events/drag-to-navigate.html
fast/events/file-input-hidden-in-ondrop.html
fast/events/input-element-display-none-in-dragleave-crash.html
fast/events/prevent-drag-to-navigate.html
fast/files/file-list-test.html
fast/files/file-reader-directory-crash.html
fast/forms/file/file-input-change-event.html
fast/forms/file/file-input-reset.html
fast/forms/file/recover-file-input-in-unposted-form.html
fast/forms/file/get-file-upload.html
fast/events/prevent-drag-to-navigate.html [ Failure ]
fast/forms/file/input-file-re-render.html
fast/forms/file/input-file-write-files.html
fast/forms/file/selected-files-from-history-state.html
http/tests/local/blob/send-hybrid-blob.html
http/tests/local/formdata
http/tests/security/clipboard/clipboard-file-access.html
fast/files/apply-blob-url-to-img.html
......@@ -637,8 +619,6 @@ fast/files/apply-blob-url-to-xhr.html
fast/files/file-reader-abort.html
fast/files/file-reader-event-listener.html
fast/files/null-origin-string.html
fast/files/read-blob-async.html
fast/files/read-file-async.html
fast/files/workers/worker-apply-blob-url-to-xhr.html
fast/files/workers/worker-read-blob-async.html
fast/files/workers/worker-read-blob-sync.html
......
2012-10-10 Allan Sandfeld Jensen <allan.jensen@digia.com>
[Qt] DumpRenderTree needs a beginDragWithFiles implementation
https://bugs.webkit.org/show_bug.cgi?id=50902
Reviewed by Simon Hausmann.
Implement support for beginDragWithFiles. This function similates dragging without going
though regular event handling. Which allows us to test effects of dropping files on
different elements.
* DumpRenderTree/qt/EventSenderQt.cpp:
(EventSender::EventSender):
(EventSender::mouseUp):
(EventSender::mouseMoveTo):
(EventSender::beginDragWithFiles):
* DumpRenderTree/qt/EventSenderQt.h:
(EventSender):
2012-10-10 KwangYong Choi <ky0.choi@samsung.com>
[EFL][WTR][CMake] Add a missing TestNetscapePlugin file
......
......@@ -72,6 +72,7 @@ EventSender::EventSender(QWebPage* parent)
startOfQueue = 0;
m_eventLoop = 0;
m_currentButton = 0;
m_currentDragActionsAllowed = 0;
resetClickCount();
m_page->view()->installEventFilter(this);
// This is a hack that works because we normally scroll 60 pixels (3*20) per tick, but Apple scrolls 120.
......@@ -184,6 +185,13 @@ void EventSender::mouseUp(int button)
}
sendOrQueueEvent(event);
if (m_currentDragData.urls().isEmpty())
return;
event = new QDropEvent(m_mousePos, m_currentDragActionsAllowed, &m_currentDragData, m_mouseButtons, Qt::NoModifier);
sendEvent(m_page, event);
m_currentDragData.clear();
}
void EventSender::mouseMoveTo(int x, int y)
......@@ -201,6 +209,31 @@ void EventSender::mouseMoveTo(int x, int y)
}
sendOrQueueEvent(event);
if (m_currentDragData.urls().isEmpty())
return;
Qt::MouseButtons mouseButtons = m_mouseButtons | Qt::LeftButton;
event = new QDragMoveEvent(m_mousePos, m_currentDragActionsAllowed, &m_currentDragData, mouseButtons, Qt::NoModifier);
sendEvent(m_page, event);
}
// Simulates a mouse down event for drag without sending an actual mouse down event.
void EventSender::beginDragWithFiles(const QStringList& files)
{
m_currentDragData.clear();
QList<QUrl> fileUrls;
QUrl baseUrl = m_page->mainFrame()->baseUrl();
foreach (const QString& file, files) {
QUrl resolvedUrl = baseUrl.resolved(file);
fileUrls.append(resolvedUrl);
}
m_currentDragData.setUrls(fileUrls);
m_currentDragActionsAllowed = Qt::CopyAction;
Qt::MouseButtons mouseButtons = m_mouseButtons | Qt::LeftButton;
QDragEnterEvent* event = new QDragEnterEvent(m_mousePos, m_currentDragActionsAllowed, &m_currentDragData, mouseButtons, Qt::NoModifier);
sendEvent(m_page, event);
}
#ifndef QT_NO_WHEELEVENT
......
......@@ -37,12 +37,14 @@
#include <QEvent>
#include <QEventLoop>
#include <QGesture>
#include <QMimeData>
#include <QMouseEvent>
#include <QObject>
#include <QPoint>
#include <QString>
#include <QStringList>
#include <QTouchEvent>
#include <Qt>
#include <qwebpage.h>
#include <qwebframe.h>
......@@ -87,6 +89,7 @@ public Q_SLOTS:
#ifndef QT_NO_GESTURES
void gestureTap(int x, int y);
#endif
void beginDragWithFiles(const QStringList& files);
protected:
void timerEvent(QTimerEvent*);
......@@ -111,6 +114,8 @@ private:
int m_currentButton;
bool m_mouseButtonPressed;
bool m_drag;
QMimeData m_currentDragData;
Qt::DropActions m_currentDragActionsAllowed;
QEventLoop* m_eventLoop;
QWebFrame* frameUnderMouse() const;
QBasicTimer m_clickTimer;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment