[evolution/wip/webkit2] Introduce test for Cut action and fix it
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Introduce test for Cut action and fix it
- Date: Tue, 26 Jul 2016 13:01:08 +0000 (UTC)
commit 7fbc2f50626bf7df2508eb21d06867a3af903267
Author: Tomas Popela <tpopela redhat com>
Date: Tue Jul 26 14:54:17 2016 +0200
Introduce test for Cut action and fix it
e-util/test-html-editor-units.c | 15 ++++++++++++++
modules/webkit-editor/e-webkit-editor.c | 21 +++++++++++++++++++-
.../web-extension/e-editor-dom-functions.c | 1 +
3 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/e-util/test-html-editor-units.c b/e-util/test-html-editor-units.c
index 94348e6..3c98284 100644
--- a/e-util/test-html-editor-units.c
+++ b/e-util/test-html-editor-units.c
@@ -208,6 +208,20 @@ test_undo_text_backward_delete (TestFixture *fixture)
}
static void
+test_undo_text_cut (TestFixture *fixture)
+{
+ if (!test_utils_run_simple_test (fixture,
+ "mode:plain\n"
+ "type:some text to delete\n"
+ "seq:CSllsc\n"
+ "action:cut\n"
+ "undo:undo\n",
+ NULL,
+ "some text to delete"))
+ g_test_fail ();
+}
+
+static void
test_justify_selection (TestFixture *fixture)
{
if (!test_utils_run_simple_test (fixture,
@@ -735,6 +749,7 @@ main (gint argc,
add_test ("/undo/text-typed", test_undo_text_typed);
add_test ("/undo/text/forward-delete", test_undo_text_forward_delete);
add_test ("/undo/text/backward-delete", test_undo_text_backward_delete);
+ add_test ("/undo/text/cut", test_undo_text_cut);
add_test ("/justify/selection", test_justify_selection);
add_test ("/justify/typed", test_justify_typed);
add_test ("/indent/selection", test_indent_selection);
diff --git a/modules/webkit-editor/e-webkit-editor.c b/modules/webkit-editor/e-webkit-editor.c
index 11cf6f7..fd874ec 100644
--- a/modules/webkit-editor/e-webkit-editor.c
+++ b/modules/webkit-editor/e-webkit-editor.c
@@ -588,6 +588,25 @@ current_page_id (EWebKitEditor *wk_editor)
}
static void
+webkit_editor_call_simple_extension_function_sync (EWebKitEditor *wk_editor,
+ const gchar *function)
+{
+ if (!wk_editor->priv->web_extension) {
+ g_warning ("EHTMLEditorWebExtension not ready at %s!", G_STRFUNC);
+ return;
+ }
+
+ g_dbus_proxy_call_sync (
+ wk_editor->priv->web_extension,
+ function,
+ g_variant_new ("(t)", current_page_id (wk_editor)),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL);
+}
+
+static void
webkit_editor_call_simple_extension_function (EWebKitEditor *wk_editor,
const gchar *function)
{
@@ -1868,7 +1887,7 @@ webkit_editor_cut (EContentEditor *editor)
wk_editor->priv->copy_cut_actions_triggered = TRUE;
- webkit_editor_call_simple_extension_function (
+ webkit_editor_call_simple_extension_function_sync (
wk_editor, "EEditorActionsSaveHistoryForCut");
webkit_web_view_execute_editing_command (
diff --git a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 9a73e68..a3aed74 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -542,6 +542,7 @@ e_editor_dom_save_history_for_cut (EEditorPage *editor_page)
manager = e_editor_page_get_undo_redo_manager (editor_page);
e_editor_undo_redo_manager_insert_history_event (manager, ev);
+ e_editor_page_set_dont_save_history_in_body_input (editor_page, TRUE);
}
/* ******************** View ******************** */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]