[Libreoffice-commits] online.git: test/UnitTyping.cpp

2020-02-10 Thread Michael Meeks (via logerrit)
 test/UnitTyping.cpp |   62 +++-
 1 file changed, 61 insertions(+), 1 deletion(-)

New commits:
commit 10caa82b0a2c90d8b7ee1c05ca9a928815c6873c
Author: Michael Meeks 
AuthorDate: Mon Feb 3 22:55:52 2020 +0100
Commit: Michael Meeks 
CommitDate: Mon Feb 10 23:23:04 2020 +0100

tdf#130382 - unit test for core fix for text input ordering issue.

Requires the relevant core commit.

Change-Id: I1b89c476ed6900bd0c5d981d125824c4bc2bf6da
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87930
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/test/UnitTyping.cpp b/test/UnitTyping.cpp
index e3f6263a9..63835e3b4 100644
--- a/test/UnitTyping.cpp
+++ b/test/UnitTyping.cpp
@@ -12,6 +12,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -52,7 +53,66 @@ public:
 
 TestResult testWriterTyping()
 {
-//const char* testname = "writerMultiViewEdit ";
+const char* testname = "writerCompositionTest ";
+std::string serverURL = LOOLWSD::getServerURL();
+const Poco::URI uri(serverURL);
+
+LOG_TRC("test writer typing");
+
+// Load a doc with the cursor saved at a top row.
+std::string documentPath, documentURL;
+helpers::getDocumentPathAndURL(
+"empty.odt", documentPath, documentURL, testname);
+
+std::shared_ptr socket = 
helpers::loadDocAndGetSocket(uri, documentURL, testname);
+
+static const char *commands[] = {
+"key type=up char=0 key=17",
+"textinput id=0 type=input text=%E3%84%98",
+"textinput id=0 type=end text=%E3%84%98",
+"key type=up char=0 key=519",
+
+"textinput id=0 type=input text=%E3%84%9C",
+"textinput id=0 type=end text=%E3%84%9C",
+"key type=up char=0 key=522",
+
+"textinput id=0 type=input text=%CB%8B",
+"textinput id=0 type=end text=%CB%8B",
+"key type=up char=0 key=260",
+
+// replace with the complete character
+"removetextcontext id=0 before=3 after=0",
+"textinput id=0 type=input text=%E6%B8%AC",
+"textinput id=0 type=end text=%E6%B8%AC",
+"key type=up char=0 key=259"
+};
+static const unsigned char correct[] = {
+0xe6, 0xb8, 0xac
+};
+
+// Feed the keystrokes ...
+for (const char *str : commands)
+sendTextFrame(socket, str, testname);
+
+// extract their text
+sendTextFrame(socket, "uno .uno:SelectAll", testname);
+sendTextFrame(socket, "gettextselection 
mimetype=text/plain;charset=utf-8", testname);
+
+LOG_TRC("Waiting for test selection:");
+const char response[] = "textselectioncontent:";
+const int responseLen = sizeof(response) - 1;
+std::string result = getResponseString(
+socket, response, testname, 5000 /* 5 secs */);
+
+LOG_TRC("length " << result.length() << " vs. " << (responseLen + 4));
+if (strncmp(result.c_str(), response, responseLen) ||
+result.length() < responseLen + 4 ||
+strncmp(result.c_str() + responseLen + 1, (const char *)correct, 
3))
+{
+Util::dumpHex(std::cerr, "Error: wrong textselectioncontent:", "", 
result);
+return TestResult::Failed;
+}
+
 return TestResult::Ok;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: test/UnitTyping.cpp

2019-10-08 Thread Andras Timar (via logerrit)
 test/UnitTyping.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2835fbd845487f2f0aa1af8f7eb58ad238c66c1f
Author: Andras Timar 
AuthorDate: Tue Oct 8 10:42:23 2019 +0200
Commit: Andras Timar 
CommitDate: Tue Oct 8 10:42:23 2019 +0200

typo: randonly -> randomly

Change-Id: I07b5a322ec3d8f149b2e4a45588bfedfcd28da37

diff --git a/test/UnitTyping.cpp b/test/UnitTyping.cpp
index b9adcd7de..31b3a3fa3 100644
--- a/test/UnitTyping.cpp
+++ b/test/UnitTyping.cpp
@@ -100,7 +100,7 @@ public:
 messages[i].push_back("useractive");
 }
 
-// randonly queue 'a', 'b' etc. key-press / space to each socket.
+// randomly queue 'a', 'b' etc. key-press / space to each socket.
 std::mt19937 randMt(0);
 for (int i = 0; i < count; ++i)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: test/UnitTyping.cpp

2019-05-31 Thread Libreoffice Gerrit user
 test/UnitTyping.cpp |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 7aac2285390ab4a92050c6a114ea3f12ea05b203
Author: Miklos Vajna 
AuthorDate: Fri May 31 08:34:41 2019 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 31 08:34:48 2019 +0200

test: use reserve() before calling emplace_back() in a loop

Change-Id: Ieb754e9433cad9fc47c3449c1957702e493c7533

diff --git a/test/UnitTyping.cpp b/test/UnitTyping.cpp
index cb884d95f..b9adcd7de 100644
--- a/test/UnitTyping.cpp
+++ b/test/UnitTyping.cpp
@@ -126,6 +126,7 @@ public:
 std::atomic liveTyping(0);
 
 // First some rendering load
+threads.reserve(numRender);
 for (int i = 0; i < numRender; ++i)
 threads.emplace_back([&,i] {
 std::mt19937 randDev(numRender * 257);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: test/UnitTyping.cpp

2019-02-13 Thread Libreoffice Gerrit user
 test/UnitTyping.cpp |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit ce95c52234f0bb86aaefb63c210efcf7e5a64206
Author: Jan Holesovsky 
AuthorDate: Thu Feb 14 08:37:20 2019 +0100
Commit: Jan Holesovsky 
CommitDate: Thu Feb 14 08:44:46 2019 +0100

Fix build.

Change-Id: I434a22f14482bf901d08b7c833eaff01e7c9c4f5

diff --git a/test/UnitTyping.cpp b/test/UnitTyping.cpp
index b66fdb15b..cb884d95f 100644
--- a/test/UnitTyping.cpp
+++ b/test/UnitTyping.cpp
@@ -11,6 +11,8 @@
 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits