Google Code-in tasks

2018-09-07 Thread Saurav Chirania
Hi!

On Fri, 7 Sep 2018 at 17:30, 
wrote:

>
>  * Google Code In for pre university students from 13 to 17 (Thorsten)
>+ https://codein.withgoogle.com/
>+ organizations can apply between Sep/06-17
>+ we need agreement from mentors
>  + official categorization: "Code, Documentation/Training,
> Outreach/Research,
>Quality Assurance, or Design"
>+ we have to prepare a list of bite-sized tasks; needed with the
> application
>

Looks like we already have a list of some tasks which was made in 2015 -

https://wiki.documentfoundation.org/Mentoring_Programs/Task_ideas_for_Google_Code-in

Other tasks which might be used for Code-in -

Build LibreOffice from source code on your machine
Remove copy-paste codes (tdf#39593)
Convert manual tests to automated UI tests (tdf#107501)
Write a blog post explaining any ten reasons why our clang plug-in might
cause a build failure when we upload our code to Jenkins (e.g. unused
variables, unnecessary parentheses, redundant cast, etc.)
Convert tests to python (tdf#97361, tdf#97362)
Include Gerrit link in bibisect log (tdf#84479)

In fact, I feel many other bugs in Bugzilla with keyword topicCleanup can
be used as tasks for GCI.

Regards,
Saurav


>  +
> https://developers.google.com/open-source/gci/resources/example-tasks
>+ mentoring mostly from UX, QA, translation ? (Thorsten)
>  + if you think it is useful & have cycles
>  + can look into the sign-up myself.
> AI:  + discuss in the staff meeting (Sophie, Heiko, Xisco)
>  + deadline is the 17th.
>
>
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Is there a way to know if a dispatch command opens a dialog?

2018-08-01 Thread Saurav Chirania
There are dispatch commands (like .uno:FontDialog) which open a dialog when
executed. There are other dispatch commands (like .uno:GoDown) which don't
open a dialog when executed. Do we have a function using which I can know
whether or not a command opens a dialog? If not, will it be possible to
implement such a function? Which parts of the code should I look into for
implementing such a function?

Regards,
Saurav
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


GSoC Weekly update for UI Test logger

2018-07-30 Thread Saurav Chirania
 Hello!

I have updated my progress here-
http://chiranias.blogspot.com/2018/07/gsoc-work-report-week-11.html

Regards,
Saurav
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


GSoC Weekly update for UI Test logger

2018-07-23 Thread Saurav Chirania
 Hello!

I have updated my progress here-
http://chiranias.blogspot.com/2018/07/gsoc-work-report-week-10.html

Regards,
Saurav
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


GSoC Weekly update for UI Test logger

2018-07-16 Thread Saurav Chirania
 Hello!

I have updated my progress here-
https://chiranias.blogspot.com/2018/07/gsoc-work-report-week-9.html

Regards,
Saurav
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: vcl/source

2018-07-11 Thread Saurav Chirania
 vcl/source/uitest/logger.cxx |   15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 7140644302d97869c7ea8d636123755fe04e640b
Author: Saurav Chirania 
Date:   Tue Jul 10 18:34:55 2018 +0530

uitest logger: log key according to DSL inside dialogs too

Change-Id: I30cfbf7ba87dda43ecb75ffd5f69253d77b6a00b
Reviewed-on: https://gerrit.libreoffice.org/57233
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 69620b0df610..54ac483ed627 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -96,7 +96,9 @@ void UITestLogger::logKeyInput(VclPtr const & 
xUIElement, const Key
 if (!mbValid)
 return;
 
-const OUString& rID = xUIElement->get_id();
+//We need to check for Parent's ID in case the UI Element is SubEdit of 
Combobox/SpinField
+const OUString& rID = xUIElement->get_id().isEmpty() ?
+xUIElement->GetParent()->get_id() : xUIElement->get_id();
 if (rID.isEmpty())
 return;
 
@@ -159,10 +161,17 @@ void UITestLogger::logKeyInput(VclPtr const 
& xUIElement, const Key
 
 std::unique_ptr pUIObject = 
xUIElement->GetUITestFactory()(xUIElement.get());
 
-OUString parent_id = xUIElement->GetParent()->get_id();
+VclPtr  pParent = xUIElement->GetParent();
+
+while (!pParent->IsTopWindow())
+{
+pParent = pParent->GetParent();
+}
+
+OUString aParentID = pParent->get_id();
 
 OUString aContent = pUIObject->get_type() + " Action:TYPE Id:" +
-rID + " Parent:"+ parent_id +" " + aKeyCode;
+rID + " Parent:"+ aParentID +" " + aKeyCode;
 maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8));
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


GSoC Weekly update for UI Test logger

2018-07-09 Thread Saurav Chirania
Hello!

I have updated my progress here-
http://chiranias.blogspot.com/2018/07/gsoc-work-report-week-8.html

Regards,
Saurav
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: include/vcl vcl/source

2018-07-06 Thread Saurav Chirania
 include/vcl/uitest/uiobject.hxx |4 
 vcl/source/uitest/uiobject.cxx  |   36 ++--
 2 files changed, 38 insertions(+), 2 deletions(-)

New commits:
commit 2cff0e2ceb53b2986be8788c7505cabbd04d0288
Author: Saurav Chirania 
Date:   Mon Jul 2 18:50:10 2018 +0530

uitest: complete wrapper for SpinField and SpinButton

Change-Id: Ibd28b656792018087478a3c6fb5f5f7ac6686131
Reviewed-on: https://gerrit.libreoffice.org/56813
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard 

diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index 5ff62735ea02..88bdf0bd6da1 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -350,6 +350,8 @@ public:
 
 static std::unique_ptr create(vcl::Window* pWindow);
 
+virtual OUString get_action(VclEventId nEvent) const override;
+
 protected:
 
 virtual OUString get_name() const override;
@@ -371,6 +373,8 @@ public:
 
 static std::unique_ptr create(vcl::Window* pWindow);
 
+virtual OUString get_action(VclEventId nEvent) const override;
+
 protected:
 
 virtual OUString get_name() const override;
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 5b72f2ab1945..1a292862ec52 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -1074,11 +1074,11 @@ void SpinUIObject::execute(const OUString& rAction,
 {
 if (rAction == "UP")
 {
-/* code */
+mxSpinButton->Up();
 }
 else if (rAction == "DOWN")
 {
-/* code */
+mxSpinButton->Down();
 }
 }
 
@@ -1093,6 +1093,22 @@ StringMap SpinUIObject::get_state()
 return aMap;
 }
 
+OUString SpinUIObject::get_action(VclEventId nEvent) const
+{
+if (nEvent == VclEventId::SpinbuttonUp)
+{
+return this->get_type() + " Action:UP Id:" + mxSpinButton->get_id() +
+" Parent:" + get_top_parent(mxSpinButton)->get_id();
+}
+else if (nEvent == VclEventId::SpinbuttonDown)
+{
+return this->get_type() + " Action:DOWN Id:" + mxSpinButton->get_id() +
+" Parent:" + get_top_parent(mxSpinButton)->get_id();
+}
+else
+return WindowUIObject::get_action(nEvent);
+}
+
 OUString SpinUIObject::get_name() const
 {
 return OUString("SpinUIObject");
@@ -1139,6 +1155,22 @@ StringMap SpinFieldUIObject::get_state()
 return aMap;
 }
 
+OUString SpinFieldUIObject::get_action(VclEventId nEvent) const
+{
+if (nEvent == VclEventId::SpinfieldUp)
+{
+return this->get_type() + " Action:UP Id:" + mxSpinField->get_id() +
+" Parent:" + get_top_parent(mxSpinField)->get_id();
+}
+else if (nEvent == VclEventId::SpinfieldDown)
+{
+return this->get_type() + " Action:DOWN Id:" + mxSpinField->get_id() +
+" Parent:" + get_top_parent(mxSpinField)->get_id();
+}
+else
+return WindowUIObject::get_action(nEvent);
+}
+
 OUString SpinFieldUIObject::get_name() const
 {
 return OUString("SpinFieldUIObject");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/vcl vcl/source

2018-07-06 Thread Saurav Chirania
 include/vcl/ctrl.hxx|2 ++
 include/vcl/uitest/uiobject.hxx |2 ++
 vcl/source/control/ctrl.cxx |   11 +--
 vcl/source/uitest/uiobject.cxx  |   17 +
 4 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 09e8815066c133b6a53fd5bc2f3d3ab8ad6e4248
Author: Saurav Chirania 
Date:   Wed Jul 4 13:55:50 2018 +0530

uitest logger: log the events calling CallEventListeners()

Some events directly call CallEventListeners() instead
of calling ImplCallEventListenersAndHandler.
This patch thus moves logAction to CallEventListeners()
Further, this patch adds logging for EditSelectionChanged
which is broadcasted using CallEventListeners().

Change-Id: Ib15367688cdbcdb542f6139d270d8d463f214fde
Reviewed-on: https://gerrit.libreoffice.org/56952
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard 

diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index 5529cf86b912..48daf0e5401e 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -76,6 +76,8 @@ protected:
 VclEventId nEvent, std::function const & 
callHandler
 );
 
+voidCallEventListeners( VclEventId nEvent, void* pData = nullptr );
+
 /** draws the given text onto the given device
 
 If no reference device is set, the draw request will simply be 
forwarded to OutputDevice::DrawText. Otherwise,
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index 37f9f883f058..5ff62735ea02 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -189,6 +189,8 @@ public:
 
 static std::unique_ptr create(vcl::Window* pWindow);
 
+virtual OUString get_action(VclEventId nEvent) const override;
+
 protected:
 
 virtual OUString get_name() const override;
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index a807409bdd2d..edf535e2968e 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -296,12 +296,19 @@ void Control::AppendLayoutData( const Control& 
rSubControl ) const
 }
 }
 
-bool Control::ImplCallEventListenersAndHandler( VclEventId nEvent, 
std::function const & callHandler )
+void Control::CallEventListeners( VclEventId nEvent, void* pData)
 {
 VclPtr xThis(this);
 UITestLogger::getInstance().logAction(xThis, nEvent);
 
-CallEventListeners( nEvent );
+vcl::Window::CallEventListeners(nEvent, pData);
+}
+
+bool Control::ImplCallEventListenersAndHandler( VclEventId nEvent, 
std::function const & callHandler )
+{
+VclPtr xThis(this);
+
+Control::CallEventListeners( nEvent );
 
 if ( !xThis->IsDisposed() )
 {
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index b098205470eb..5b72f2ab1945 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -684,6 +684,23 @@ StringMap EditUIObject::get_state()
 return aMap;
 }
 
+OUString EditUIObject::get_action(VclEventId nEvent) const
+{
+if (nEvent == VclEventId::EditSelectionChanged)
+{
+const Selection& rSelection  = mxEdit->GetSelection();
+long nMin = rSelection.Min();
+long nMax = rSelection.Max();
+return this->get_type() + " Action:SELECT Id:" +
+mxEdit->get_id() +
+" Parent:" + get_top_parent(mxEdit)->get_id() +
+" {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
+OUString::number(nMax) + "\"}";
+}
+else
+return WindowUIObject::get_action(nEvent);
+}
+
 OUString EditUIObject::get_name() const
 {
 return OUString("EditUIObject");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: uitest/loginterpreter.py

2018-07-06 Thread Saurav Chirania
 uitest/loginterpreter.py |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 8801cf6fbe3959cb1485a06fb86a41cc05b28ac6
Author: Saurav Chirania 
Date:   Tue Jul 3 11:31:13 2018 +0530

uitest interpreter: support opening existing document

In addition, I have imported the mkPropertyValues function
which seems to be necessary in almost all test files.

Change-Id: Iee44651aaa05fc2ef5da1d7e0f9281f76819d3e4
Reviewed-on: https://gerrit.libreoffice.org/56850
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard 

diff --git a/uitest/loginterpreter.py b/uitest/loginterpreter.py
index 93f391edbfa0..becd8b322937 100644
--- a/uitest/loginterpreter.py
+++ b/uitest/loginterpreter.py
@@ -41,6 +41,7 @@ def parse_args():
 parser = argparse.ArgumentParser(description = "Generate a UI test file 
from log")
 parser.add_argument("input_address", type = str, help = "The log file 
address")
 parser.add_argument("output_address", type = str, help = "The test file 
address")
+parser.add_argument("-d", "--document", metavar = "", help = "Address of 
the document to be opened")
 args = parser.parse_args()
 return args
 
@@ -65,6 +66,7 @@ def initiate_test_generation(address):
 sys.exit(1)
 initial_text = \
 "from uitest.framework import UITestCase\n" + \
+"from libreoffice.uno.propertyvalue import mkPropertyValues\n" + \
 "import importlib\n\n" + \
 "class TestClass(UITestCase):\n" + \
 "def test_function(self):\n"
@@ -165,6 +167,12 @@ def main():
 args = parse_args()
 log_lines = get_log_file(args.input_address)
 output_stream = initiate_test_generation(args.output_address)
+if args.document is not None:
+output_line = "pathmodule = 
importlib.import_module(\"uitest.path\")\n" + \
+"doc_path = pathmodule.get_srcdir_url() + \"" + args.document 
+ "\"\n" + \
+"MainDoc = self.ui_test.load_file(doc_path)\n" + \
+"MainWindow = self.xUITest.getTopFocusWindow()\n"
+output_stream.write(output_line)
 line_number = 0
 while line_number < len(log_lines):
 if line_number == len(log_lines)-1 or \
@@ -178,6 +186,7 @@ def main():
 test_line = 
get_test_line_from_two_log_lines(log_lines[line_number],log_lines[line_number + 
1])
 output_stream.write(test_line)
 line_number += 2
+output_stream.write("self.ui_test.close_doc()")
 output_stream.close()
 
 if __name__ == '__main__':
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: uitest/loginterpreter.py

2018-07-06 Thread Saurav Chirania
 uitest/loginterpreter.py |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 4914c03245983f913ecdd2a5d9682a05bca1fea7
Author: Saurav Chirania 
Date:   Tue Jul 3 21:37:01 2018 +0530

uitest interpreter: handle when parent is empty string

Change-Id: I439e2679ce46872f34e095b7f05fa19d404d2c00
Reviewed-on: https://gerrit.libreoffice.org/56887
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard 

diff --git a/uitest/loginterpreter.py b/uitest/loginterpreter.py
index ccc805056a7b..93f391edbfa0 100644
--- a/uitest/loginterpreter.py
+++ b/uitest/loginterpreter.py
@@ -118,7 +118,9 @@ def get_test_line_from_one_log_line(log_line):
 action_dict["Id"][:-4] +"\")\nMainWindow = " + \
 "self.xUITest.getTopFocusWindow()\n"
 return test_line
-elif (parent != ""):
+else:
+if (parent == ""):
+parent = "MainWindow"
 test_line += \
 action_dict["Id"] + " = " + parent + ".getChild(\"" + \
 action_dict["Id"] + "\")\n" + \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


GSoC Weekly update for UI Test logger

2018-07-01 Thread Saurav Chirania
Hello,

I have updated my progress here -
https://chiranias.blogspot.com/2018/07/gsoc-work-report-week-7.html

Regards,
Saurav
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: uitest/loginterpreter.py

2018-07-01 Thread Saurav Chirania
 uitest/loginterpreter.py |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit ad511ce89c3ceddd3a8c6d650ce81df1e35bc48f
Author: Saurav Chirania 
Date:   Mon Jul 2 08:46:06 2018 +0530

uitest interpreter: add support for starting apps

Change-Id: Iaab98515d2046aaff1e3da4f80de192ebc01a9eb
Reviewed-on: https://gerrit.libreoffice.org/56789
Tested-by: Jenkins
Reviewed-by: Saurav Chirania 

diff --git a/uitest/loginterpreter.py b/uitest/loginterpreter.py
index 9da08dd0acb9..ccc805056a7b 100644
--- a/uitest/loginterpreter.py
+++ b/uitest/loginterpreter.py
@@ -98,12 +98,27 @@ def get_coupling_type(line1, line2):
 
 return "NOT_A_COUPLE"
 
+def check_app_starting_action(action_dict):
+app_starter_button_ids = \
+set(["draw_all", "impress_all", "calc_all" , "writer_all", "database_all", 
"math_all"])
+
+if action_dict["keyword"] == "ButtonUIObject" and action_dict["Action"] == 
"CLICK" and \
+action_dict["Id"] in app_starter_button_ids:
+return True
+return False
+
 def get_test_line_from_one_log_line(log_line):
 action_dict = parse_line(log_line)
 test_line = ""
 if action_dict["keyword"].endswith("UIObject"):
 parent = action_dict["Parent"]
-if (parent != ""):
+if (check_app_starting_action(action_dict)):
+test_line +=\
+"MainDoc = self.ui_test.create_doc_in_start_center(\"" + \
+action_dict["Id"][:-4] +"\")\nMainWindow = " + \
+"self.xUITest.getTopFocusWindow()\n"
+return test_line
+elif (parent != ""):
 test_line += \
 action_dict["Id"] + " = " + parent + ".getChild(\"" + \
 action_dict["Id"] + "\")\n" + \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: uitest/loginterpreter.py

2018-07-01 Thread Saurav Chirania
 uitest/loginterpreter.py |   31 ---
 1 file changed, 12 insertions(+), 19 deletions(-)

New commits:
commit 5560a23cbc1e61cf55bb8c98202d7c93e21f60f1
Author: Saurav Chirania 
Date:   Sat Jun 30 14:37:46 2018 +0530

uitest interpreter: let's use argparse to parse arguments

Reasons to do this-
1) We will add more arguments in future,
handling them manually will be time consuming.
2) Argparse generates a useful help message automatically.

Change-Id: I7ce8cc2746f7774c4fa7cd5b173da637e10a770b
Reviewed-on: https://gerrit.libreoffice.org/56777
Tested-by: Jenkins
Reviewed-by: Saurav Chirania 

diff --git a/uitest/loginterpreter.py b/uitest/loginterpreter.py
index efdef95c6473..9da08dd0acb9 100644
--- a/uitest/loginterpreter.py
+++ b/uitest/loginterpreter.py
@@ -9,11 +9,7 @@
 
 import os
 import sys
-
-def usage():
-message = "usage: {program} inputfile outputfile"
-
-print(message.format(program = os.path.basename(sys.argv[0])))
+import argparse
 
 def parse_line(line):
 """
@@ -37,19 +33,16 @@ def parse_line(line):
 dict[key] = val
 return dict
 
-def parse_args(argv):
+def parse_args():
 """
 This function parses the command-line arguments
 to get the input and output file details
 """
-if len(argv) != 3:
-usage()
-sys.exit(1)
-else:
-input_address = argv[1]
-output_address = argv[2]
-
-return input_address, output_address
+parser = argparse.ArgumentParser(description = "Generate a UI test file 
from log")
+parser.add_argument("input_address", type = str, help = "The log file 
address")
+parser.add_argument("output_address", type = str, help = "The test file 
address")
+args = parser.parse_args()
+return args
 
 def get_log_file(input_address):
 try:
@@ -57,7 +50,7 @@ def get_log_file(input_address):
 content = f.readlines()
 except IOError as err:
 print("IO error: {0}".format(err))
-usage()
+print("Use " + os.path.basename(sys.argv[0]) + " -h to get usage 
instructions")
 sys.exit(1)
 
 content = [x.strip() for x in content]
@@ -68,7 +61,7 @@ def initiate_test_generation(address):
 f = open(address,"w")
 except IOError as err:
 print("IO error: {0}".format(err))
-usage()
+print("Use " + os.path.basename(sys.argv[0]) + " -h to get usage 
instructions")
 sys.exit(1)
 initial_text = \
 "from uitest.framework import UITestCase\n" + \
@@ -152,9 +145,9 @@ def get_test_line_from_two_log_lines(log_line1,log_line2):
 return test_line
 
 def main():
-input_address, output_address = parse_args(sys.argv)
-log_lines = get_log_file(input_address)
-output_stream = initiate_test_generation(output_address)
+args = parse_args()
+log_lines = get_log_file(args.input_address)
+output_stream = initiate_test_generation(args.output_address)
 line_number = 0
 while line_number < len(log_lines):
 if line_number == len(log_lines)-1 or \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: uitest/loginterpreter.py

2018-07-01 Thread Saurav Chirania
 uitest/loginterpreter.py |   22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

New commits:
commit a4be3ebd4daddab219c347af8583bfbb9d63a843
Author: Saurav Chirania 
Date:   Fri Jun 29 12:33:21 2018 +0530

uitest interpreter: add more features

1) Support UNO commands
2) Support closing dialog using buttons
3) Correct keyword for modless dialog
4) Introduce "Redundant Couple" for couples
from which only 1 statement can generate the log.

Change-Id: I3541fea6a0b72de2c03626476b8abb43a7324dab
Reviewed-on: https://gerrit.libreoffice.org/56776
Tested-by: Jenkins
Reviewed-by: Saurav Chirania 

diff --git a/uitest/loginterpreter.py b/uitest/loginterpreter.py
index 252fc4bd6c42..efdef95c6473 100644
--- a/uitest/loginterpreter.py
+++ b/uitest/loginterpreter.py
@@ -91,9 +91,18 @@ def get_coupling_type(line1, line2):
 return "COMMAND_MODAL_COUPLE"
 
 elif action_dict1["keyword"] == "CommandSent" and \
-action_dict2["keyword"] == "ModelessDialogExecuted":
+action_dict2["keyword"] == "ModelessDialogConstructed":
 return "COMMAND_MODELESS_COUPLE"
 
+elif action_dict1["keyword"] == "ButtonUIObject" and \
+action_dict2["keyword"] == "DialogClosed":
+return "BUTTON_DIALOGCLOSE_COUPLE"
+
+elif "parameters" in action_dict1 and \
+"KEYCODE" in action_dict1["parameters"] and \
+action_dict2["keyword"] == "CommandSent":
+return "REDUNDANT_COUPLE"
+
 return "NOT_A_COUPLE"
 
 def get_test_line_from_one_log_line(log_line):
@@ -113,6 +122,10 @@ def get_test_line_from_one_log_line(log_line):
 else:
 test_line += ",tuple())\n"
 return test_line
+elif action_dict["keyword"] == "CommandSent":
+test_line += "self.xUITest.executeCommand(\"" + \
+action_dict["Name"] + "\")\n"
+return test_line
 
 return ""
 
@@ -131,6 +144,11 @@ def get_test_line_from_two_log_lines(log_line1,log_line2):
 "self.ui_test.execute_modeless_dialog_through_command(\"" + \
 action_dict1["Name"] + "\")\n" + \
 action_dict2["Id"] + " = self.xUITest.getTopFocusWindow()\n"
+elif coupling_type == "BUTTON_DIALOGCLOSE_COUPLE":
+test_line += \
+action_dict1["Id"] + " = " + action_dict1["Parent"] + ".getChild(\"" + 
\
+action_dict1["Id"] + "\")\n
self.ui_test.close_dialog_through_button(" + \
+action_dict1["Id"] + ")\n"
 return test_line
 
 def main():
@@ -144,6 +162,8 @@ def main():
 test_line = get_test_line_from_one_log_line(log_lines[line_number])
 output_stream.write(test_line)
 line_number += 1
+elif get_coupling_type(log_lines[line_number],log_lines[line_number + 
1]) == "REDUNDANT_COUPLE":
+line_number += 1
 else:
 test_line = 
get_test_line_from_two_log_lines(log_lines[line_number],log_lines[line_number + 
1])
 output_stream.write(test_line)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/source

2018-06-24 Thread Saurav Chirania
 vcl/source/uitest/uiobject.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit cb7e2b80022928b80a27fc6d71ff0721dbe6f601
Author: Saurav Chirania 
Date:   Fri Jun 22 20:46:34 2018 +0530

uitest logger: some changes in log statements

These changes will allow the interpreter introduced in
gerrit change number 56120
to understand these log statements.

Change-Id: I68a406cd19bbe1cfe5b6563025348263d564d5af
Reviewed-on: https://gerrit.libreoffice.org/56305
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index e5ac0895dea8..b098205470eb 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -951,7 +951,8 @@ OUString ListBoxUIObject::get_action(VclEventId nEvent) 
const
 {
 sal_Int32 nPos = mxListBox->GetSelectedEntryPos();
 return this->get_type() + " Action:SELECT Id:" + mxListBox->get_id() +
-" POS:" + OUString::number(nPos) + " Parent:" + 
get_top_parent(mxListBox)->get_id();
+" Parent:" + get_top_parent(mxListBox)->get_id() +
+" {\"POS\": \"" + OUString::number(nPos) + "\"}";
 }
 else if (nEvent == VclEventId::ListboxFocus)
 {
@@ -1026,8 +1027,9 @@ OUString ComboBoxUIObject::get_action(VclEventId nEvent) 
const
 {
 sal_Int32 nPos = mxComboBox->GetSelectedEntryPos();
 return this->get_type() + " Action:SELECT Id:" +
-mxComboBox->get_id() + " POS:" + OUString::number(nPos) +
-" Parent:" + get_top_parent(mxComboBox)->get_id();
+mxComboBox->get_id() +
+" Parent:" + get_top_parent(mxComboBox)->get_id() +
+" {\"POS\": \"" + OUString::number(nPos) + "\"}";
 }
 else
 return WindowUIObject::get_action(nEvent);
@@ -1177,8 +1179,8 @@ OUString TabControlUIObject::get_action(VclEventId 
nEvent) const
 {
 sal_Int32 nPageId = mxTabControl->GetCurPageId();
 return this->get_type() + " Action:SELECT Id:" + 
mxTabControl->get_id() +
-" POS:" + OUString::number(mxTabControl->GetPagePos(nPageId)) +
-" Parent:" + get_top_parent(mxTabControl)->get_id();
+" Parent:" + get_top_parent(mxTabControl)->get_id() +
+" {\"POS\": \"" + 
OUString::number(mxTabControl->GetPagePos(nPageId)) + "\"}";
 }
 else
 return WindowUIObject::get_action(nEvent);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/source

2018-06-24 Thread Saurav Chirania
 vcl/source/uitest/logger.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 641e42859e7f9c392aaf81dc8ca69f6c4fbc1b1b
Author: Saurav Chirania 
Date:   Tue Jun 12 14:48:41 2018 +0530

uitest logger: print parent when logging keys

Change-Id: I130f266016dc51dab5e4d1395fe579ca21a1b835
Reviewed-on: https://gerrit.libreoffice.org/55675
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index e9a18df9b400..69620b0df610 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -159,8 +159,10 @@ void UITestLogger::logKeyInput(VclPtr const & 
xUIElement, const Key
 
 std::unique_ptr pUIObject = 
xUIElement->GetUITestFactory()(xUIElement.get());
 
+OUString parent_id = xUIElement->GetParent()->get_id();
+
 OUString aContent = pUIObject->get_type() + " Action:TYPE Id:" +
-rID + " Parent: UNKNOWN "+ aKeyCode;
+rID + " Parent:"+ parent_id +" " + aKeyCode;
 maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8));
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


GSoC Weekly update for UI Test logger

2018-06-24 Thread Saurav Chirania
Hello,

I have updated my progress here -
http://chiranias.blogspot.com/2018/06/gsoc-work-report-24th-june.html

Regards,
Saurav
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: uitest/loginterpreter.py

2018-06-24 Thread Saurav Chirania
 uitest/loginterpreter.py |  156 +++
 1 file changed, 156 insertions(+)

New commits:
commit 04645273d7c9dd6927035b571464148a38d3db9f
Author: Saurav Chirania 
Date:   Tue Jun 19 19:56:43 2018 +0530

uitest: interpreter for log files

this file interprets the following grammar:
  []

where keyword describes about the UIObject the user interacts with
object_description tells the ID, parent, etc. of the UIObject
and parameters are the parameters of the action user performs
in a format directly readable by mkPropertyValues

keyword examples - ModalDialogExecuted, ButtonUIObject
parameter examples - {"TEXT":"A"}, {"POS": 1}, etc.

Line-by-line, this interpreter tries to convert given
log into python code. An example can be found at-
"https://pastebin.com/raw/KQi7Y6ie";

Change-Id: Iade4388b16094a94df1893f9925605bee51b164f
Reviewed-on: https://gerrit.libreoffice.org/56120
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/uitest/loginterpreter.py b/uitest/loginterpreter.py
new file mode 100644
index ..252fc4bd6c42
--- /dev/null
+++ b/uitest/loginterpreter.py
@@ -0,0 +1,156 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+import os
+import sys
+
+def usage():
+message = "usage: {program} inputfile outputfile"
+
+print(message.format(program = os.path.basename(sys.argv[0])))
+
+def parse_line(line):
+"""
+This function parses a line from log file
+and returns the parsed values as a python dictionary
+"""
+if (line == "" or line.startswith("Action on element")):
+return
+dict = {}
+if "{" in line:
+start_index_of_parameters = line.find("{")
+end_index_of_parameters = line.find("}") + 1
+parameters = line[start_index_of_parameters:end_index_of_parameters]
+dict["parameters"] = parameters
+line = line[:start_index_of_parameters-1]
+word_list = line.split()
+dict["keyword"] = word_list[0]
+
+for index in range(1,len(word_list)):
+key, val = word_list[index].split(":",1)
+dict[key] = val
+return dict
+
+def parse_args(argv):
+"""
+This function parses the command-line arguments
+to get the input and output file details
+"""
+if len(argv) != 3:
+usage()
+sys.exit(1)
+else:
+input_address = argv[1]
+output_address = argv[2]
+
+return input_address, output_address
+
+def get_log_file(input_address):
+try:
+with open(input_address) as f:
+content = f.readlines()
+except IOError as err:
+print("IO error: {0}".format(err))
+usage()
+sys.exit(1)
+
+content = [x.strip() for x in content]
+return content
+
+def initiate_test_generation(address):
+try:
+f = open(address,"w")
+except IOError as err:
+print("IO error: {0}".format(err))
+usage()
+sys.exit(1)
+initial_text = \
+"from uitest.framework import UITestCase\n" + \
+"import importlib\n\n" + \
+"class TestClass(UITestCase):\n" + \
+"def test_function(self):\n"
+f.write(initial_text)
+return f
+
+def get_coupling_type(line1, line2):
+"""
+This function checks if two consecutive lines of log file
+refer to the same event
+"""
+action_dict1 = parse_line(line1)
+action_dict2 = parse_line(line2)
+
+if action_dict1["keyword"] == "CommandSent" and \
+action_dict2["keyword"] == "ModalDialogExecuted":
+return "COMMAND_MODAL_COUPLE"
+
+elif action_dict1["keyword"] == "CommandSent" and \
+action_dict2["keyword"] == "ModelessDialogExecuted":
+return "COMMAND_MODELESS_COUPLE"
+
+return "NOT_A_COUPLE"
+
+def get_test_line_from_one_log_line(log_line):
+action_dict = parse_line(log_line)
+test_line = ""
+if action_dict["keyword"].endswith("UIObject"):
+parent = action_dict["Parent"]
+if (parent != ""):
+test_line += \
+action_dict["Id"] + " = " + parent + ".getChild(\"" + \
+action_dict["Id"] + "\")\n&quo

[Libreoffice-commits] core.git: include/vcl vcl/source

2018-06-12 Thread Saurav Chirania
 include/vcl/uitest/uiobject.hxx |4 
 vcl/source/uitest/uiobject.cxx  |   31 +++
 2 files changed, 35 insertions(+)

New commits:
commit da0e3d7a2dace5c29b7a252b744232e9a92e4f2e
Author: Saurav Chirania 
Date:   Wed Jun 6 11:22:42 2018 +0530

WIP: uitest: complete combobox, tabcontrol wrapper

Change-Id: I3ba1b0d1b5412c30e540cf45fe21ef946839afed
Reviewed-on: https://gerrit.libreoffice.org/55372
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index ea90b640824c..37f9f883f058 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -324,6 +324,8 @@ public:
 
 static std::unique_ptr create(vcl::Window* pWindow);
 
+virtual OUString get_action(VclEventId nEvent) const override;
+
 protected:
 
 virtual OUString get_name() const override;
@@ -389,6 +391,8 @@ public:
 
 static std::unique_ptr create(vcl::Window* pWindow);
 
+virtual OUString get_action(VclEventId nEvent) const override;
+
 protected:
 
 virtual OUString get_name() const override;
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index c7c64f8c9189..adf26cbb2ac8 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -1014,6 +1014,19 @@ OUString ComboBoxUIObject::get_name() const
 return OUString("ComboBoxUIObject");
 }
 
+OUString ComboBoxUIObject::get_action(VclEventId nEvent) const
+{
+if (nEvent == VclEventId::ComboboxSelect)
+{
+sal_Int32 nPos = mxComboBox->GetSelectedEntryPos();
+return this->get_type() + " Action:SELECT Id:" +
+mxComboBox->get_id() + " POS:" + OUString::number(nPos) +
+" Parent:" + get_top_parent(mxComboBox)->get_id();
+}
+else
+return WindowUIObject::get_action(nEvent);
+}
+
 std::unique_ptr ComboBoxUIObject::create(vcl::Window* pWindow)
 {
 ComboBox* pComboBox = dynamic_cast(pWindow);
@@ -1143,10 +1156,28 @@ void TabControlUIObject::execute(const OUString& 
rAction,
 StringMap TabControlUIObject::get_state()
 {
 StringMap aMap = WindowUIObject::get_state();
+aMap["PageCount"] = OUString::number(mxTabControl->GetPageCount());
+
+sal_uInt16 nPageId = mxTabControl->GetCurPageId();
+aMap["CurrPageId"] = OUString::number(nPageId);
+aMap["CurrPagePos"] = OUString::number(mxTabControl->GetPagePos(nPageId));
 
 return aMap;
 }
 
+OUString TabControlUIObject::get_action(VclEventId nEvent) const
+{
+if (nEvent == VclEventId::TabpageActivate)
+{
+sal_Int32 nPageId = mxTabControl->GetCurPageId();
+return this->get_type() + " Action:SELECT Id:" + 
mxTabControl->get_id() +
+" POS:" + OUString::number(mxTabControl->GetPagePos(nPageId)) +
+" Parent:" + get_top_parent(mxTabControl)->get_id();
+}
+else
+return WindowUIObject::get_action(nEvent);
+}
+
 OUString TabControlUIObject::get_name() const
 {
 return OUString("TabControlUIObject");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


GSoC Weekly update for UI Test logger

2018-06-10 Thread Saurav Chirania
Hey,

I have updated my progress here -
https://chiranias.blogspot.com/2018/06/gsoc-work-report-week-4.html

Regards,
Saurav
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: 2 commits - include/vcl sfx2/source vcl/source

2018-06-03 Thread Saurav Chirania
 include/vcl/uitest/uiobject.hxx  |6 +
 sfx2/source/control/unoctitm.cxx |2 -
 vcl/source/uitest/logger.cxx |5 +++-
 vcl/source/uitest/uiobject.cxx   |   41 ++-
 vcl/source/window/dialog.cxx |4 +--
 5 files changed, 53 insertions(+), 5 deletions(-)

New commits:
commit 06f819baaaf615d4d02e3c0838513c3544389024
Author: Saurav Chirania 
Date:   Mon May 28 10:12:40 2018 +0530

uitest logger: ListboxSelect and ListboxFocus logging

Change-Id: I5a38adaeea3c2e64366563bd449d8bf06d9161a3
Reviewed-on: https://gerrit.libreoffice.org/55112
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 2f4604d9f882..c7c64f8c9189 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -944,7 +944,13 @@ OUString ListBoxUIObject::get_action(VclEventId nEvent) 
const
 if (nEvent == VclEventId::ListboxSelect)
 {
 sal_Int32 nPos = mxListBox->GetSelectedEntryPos();
-return "Action on element: " + mxListBox->get_id() + " with action : 
SELECT and content {\"POS\": \"" + OUString::number(nPos) + "\"}";
+return this->get_type() + " Action:SELECT Id:" + mxListBox->get_id() +
+" POS:" + OUString::number(nPos) + " Parent:" + 
get_top_parent(mxListBox)->get_id();
+}
+else if (nEvent == VclEventId::ListboxFocus)
+{
+return this->get_type() + " Action:FOCUS Id:" + mxListBox->get_id() +
+" Parent:" + get_top_parent(mxListBox)->get_id();
 }
 else
 return WindowUIObject::get_action(nEvent);
commit 1a91d1a5956e16080af3f64c1597387dd57b9570
Author: Saurav Chirania 
Date:   Wed May 23 19:46:56 2018 +0530

uitest logger: support for buttons, dialog, command and key logging

This patch adds logging faclity for radiobuttons, checkboxes
and button clicks. It modifies the logging for UNO commands
and dialogs execution for consistency with other log
statements. It also makes key logging more informative
by printing the details of the object on which the user is
typing.

Change-Id: I911d0dfb64dacfde64193f0aea21f7d837dbf9da
Reviewed-on: https://gerrit.libreoffice.org/54745
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index 0493cbc19c98..ea90b640824c 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -148,6 +148,8 @@ public:
 
 static std::unique_ptr create(vcl::Window* pWindow);
 
+virtual OUString get_action(VclEventId nEvent) const override;
+
 protected:
 
 virtual OUString get_name() const override;
@@ -230,6 +232,8 @@ public:
 
 static std::unique_ptr create(vcl::Window* pWindow);
 
+virtual OUString get_action(VclEventId nEvent) const override;
+
 protected:
 
 virtual OUString get_name() const override;
@@ -251,6 +255,8 @@ public:
 
 static std::unique_ptr create(vcl::Window* pWindow);
 
+virtual OUString get_action(VclEventId nEvent) const override;
+
 protected:
 
 virtual OUString get_name() const override;
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 372a7751ca2c..9c8c13e9afaa 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -600,7 +600,7 @@ void collectUIInformation(const util::URL& rURL)
 if (!pFile)
 return;
 
-UITestLogger::getInstance().logCommand(rURL.Complete);
+UITestLogger::getInstance().logCommand("CommandSent Name:" + 
rURL.Complete);
 }
 
 }
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 4f07f6994529..e9a18df9b400 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -157,7 +157,10 @@ void UITestLogger::logKeyInput(VclPtr const & 
xUIElement, const Key
 aKeyCode = "{\"TEXT\": \"" + OUStringLiteral1(nChar) + "\"}";
 }
 
-OUString aContent = "Action on element: " + rID + " with action: TYPE and 
content: " + aKeyCode;
+std::unique_ptr pUIObject = 
xUIElement->GetUITestFactory()(xUIElement.get());
+
+OUString aContent = pUIObject->get_type() + " Action:TYPE Id:" +
+rID + " Parent: UNKNOWN "+ aKeyCode;
 maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8));
 }
 
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index ff117e34c6f1..2f4604d9f882 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -563,6 +563,17 @@ OUString ButtonUIObject::get_name() const
 return OUString("ButtonUIObject");
 }
 
+OUString ButtonUIObject::get_actio

GSoC Weekly update for UI Test logger

2018-06-03 Thread Saurav Chirania
I am updating my progress on https://chiranias.blogspot.com/

This week's update for my work is at -
https://chiranias.blogspot.com/2018/06/gsoc-work-report-week-3.html

Regards,
Saurav
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


GSoC project introduction

2018-05-05 Thread Saurav Chirania
*Hello community!I am Saurav, an undergraduate from IIT Dhanbad, India.
I’ve been selected in this year’s GSoC to work with LibreOffice [1].I’ll be
working with the UI Testing framework. The first task will be to log the UI
actions in a log file according to a Domain Specific Language. Then, the
next task will be to automate the replay of the same actions using the
generated log file.I am ready with a fresh build of LibreOffice and am
currently browsing the relevant code parts to get more knowledge about the
different UI elements and how events work in LibreOffice.The timeline I
proposed in my GsoC proposal is at [2]. Suggestions regarding prioritising
of tasks, refining of the timeline or anything else to improve on are
welcome! You can contact me on the IRC channel #libreoffice-dev (nick:
chirania) or by sending me an email.Looking forward to an enjoyable
summer!Regards,Saurav Chirania[1] https://tinyurl.com/yba6cnpc
<https://tinyurl.com/yba6cnpc>[2] https://tinyurl.com/ydgax9vk
<https://tinyurl.com/ydgax9vk>*
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Student introduction for GSoC 2018

2018-03-18 Thread Saurav Chirania
Hello, community.


I have already sent a couple of emails here, but I felt the need to send a
mail explicitly for my introduction (as mentioned in the “How to work with
us” page of LibreOffice).

Name – Saurav Chirania

Email – saurav.c...@gmail.com

IRC nick – chirania

Education – Currently a second-year undergraduate student, studying
Computer Science and Engineering

College/University – Indian Institute of Technology (ISM) Dhanbad

GSoC Idea interested in – “Add a DSL to the UI testing and improve the
generated log file”



I have already submitted my proposal on the GSoC website. Please consider
giving me a feedback on it.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: vcl/source

2018-03-17 Thread Saurav Chirania
 vcl/source/uitest/logger.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7af8fede0e7d09ba2eafa3366c800769a4b1d9b4
Author: Saurav Chirania 
Date:   Thu Mar 15 17:02:37 2018 +0530

uitest logger: call correct function for key logging

isMod2() and isMod3() functions have been used
in place to isMod1() to generate correct key logs.

Change-Id: Idcb83ad8bf00d31cac08cb7ff17ecca635b44967
Reviewed-on: https://gerrit.libreoffice.org/51367
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index a133c6910eb0..4f07f6994529 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -104,8 +104,8 @@ void UITestLogger::logKeyInput(VclPtr const & 
xUIElement, const Key
 sal_uInt16 nKeyCode = rEvent.GetKeyCode().GetCode();
 bool bShift = rEvent.GetKeyCode().IsShift();
 bool bMod1 = rEvent.GetKeyCode().IsMod1();
-bool bMod2 = rEvent.GetKeyCode().IsMod1();
-bool bMod3 = rEvent.GetKeyCode().IsMod1();
+bool bMod2 = rEvent.GetKeyCode().IsMod2();
+bool bMod3 = rEvent.GetKeyCode().IsMod3();
 
 std::map aKeyMap = {
 {"ESC", KEY_ESCAPE},
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa

2018-02-26 Thread Saurav Chirania
 sw/qa/python/check_table.py |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 8e1bb35eeb332d7cb8e4aafb47b57a0ffd7de044
Author: Saurav Chirania 
Date:   Tue Feb 13 15:20:46 2018 +0100

Revert "tdf#97361 Tests in sw should be more pythonic"

This reverts unnecessary changes in
commit 4469c1d4061e8cb463469e60e5d87af5f9bf9636
as suggested in comments at-
https://gerrit.libreoffice.org/#/c/49163/

Change-Id: Iad5da22624d7c543177a2271abb58bc4f6f31ecd
Reviewed-on: https://gerrit.libreoffice.org/49660
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py
index 47389fdeef08..35da08fe8195 100644
--- a/sw/qa/python/check_table.py
+++ b/sw/qa/python/check_table.py
@@ -310,11 +310,11 @@ class CheckTable(unittest.TestCase):
 xTable.ChartColumnAsLabel = False
 xTable.ChartRowAsLabel = False
 # roundtrip
-xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(4))
+xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
 self.assertEqual(xTable.Data, ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 
11, 12)))
 # missing row
 with self.assertRaises(Exception):
-xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(3))
+xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9))
 # missing column
 with self.assertRaises(Exception):
 xTable.Data = ((1, 2), (4, 5), (7, 8), (10, 11))
@@ -342,7 +342,7 @@ class CheckTable(unittest.TestCase):
 xDoc.Text.insertTextContent(xCursor, xTable, False)
 xTable.ChartColumnAsLabel = False
 xTable.ChartRowAsLabel = False
-xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(4))
+xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
 xRows = xTable.Rows
 self.assertEqual(xRows.ImplementationName, 'SwXTableRows')
 self.assertTrue(xRows.supportsService('com.sun.star.text.TableRows'))
@@ -369,7 +369,7 @@ class CheckTable(unittest.TestCase):
 xDoc.Text.insertTextContent(xCursor, xTable, False)
 xTable.ChartColumnAsLabel = False
 xTable.ChartRowAsLabel = False
-xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(4))
+xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
 xRows = xTable.Rows
 xRows.insertByIndex(1, 2)
 nan = float('nan')
@@ -411,7 +411,7 @@ class CheckTable(unittest.TestCase):
 xDoc.Text.insertTextContent(xCursor, xTable, False)
 xTable.ChartColumnAsLabel = False
 xTable.ChartRowAsLabel = False
-xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(4))
+xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
 self.assertTrue(xTable.Name == 'Table1')
 self.assertIn('com.sun.star.text.GenericTextDocument', 
xDoc.SupportedServiceNames)
 xChartdataprovider = 
xDoc.createInstance('com.sun.star.chart2.data.DataProvider')
@@ -568,7 +568,8 @@ class CheckTable(unittest.TestCase):
 xDoc.Text.insertTextContent(xCursor, xTable, False)
 xTable.ChartColumnAsLabel = False
 xTable.ChartRowAsLabel = False
-xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(4))
+xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
+
 xChartDataProvider = 
xDoc.createInstance('com.sun.star.chart2.data.DataProvider')
 
 self.assertEqual('', xChartDataProvider.convertRangeToXML(''))
@@ -607,7 +608,7 @@ class CheckTable(unittest.TestCase):
 xText = xDoc.getText()
 xCursor = xText.createTextCursor()
 xText.insertTextContent(xCursor, xTable, False)
-xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(3))
+xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9))
 xCursor = xTable.createCursorByCellName("A1")
 xCursor.goDown(1, True)
 xCursor.mergeRange()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa

2018-02-12 Thread Saurav Chirania
 sw/qa/python/check_table.py |   55 +---
 1 file changed, 27 insertions(+), 28 deletions(-)

New commits:
commit 4469c1d4061e8cb463469e60e5d87af5f9bf9636
Author: Saurav Chirania 
Date:   Fri Feb 2 05:00:39 2018 +0530

tdf#97361 Tests in sw should be more pythonic

The modified files have been made more pythonic
by removing Java-like codes.

Change-Id: Ie015bb5fa2348d31682b843df7f9c6d86c5e9fc1
Reviewed-on: https://gerrit.libreoffice.org/49163
Tested-by: Jenkins 
Reviewed-by: Björn Michaelsen 

diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py
index 60c2d726ed58..47389fdeef08 100644
--- a/sw/qa/python/check_table.py
+++ b/sw/qa/python/check_table.py
@@ -26,13 +26,13 @@ class CheckTable(unittest.TestCase):
 
 for x in range(3):
 for y in range(3):
-xTable.getCellByPosition(x, y).String = 'Cell %d %d' % (x, y)
+xTable[y,x].String = 'Cell %d %d' % (x, y)
 
 def _check_table(self, xTable):
 
 for x in range(3):
 for y in range(3):
-self.assertEqual('Cell %d %d' % (x, y), 
xTable.getCellByPosition(x, y).String)
+self.assertEqual('Cell %d %d' % (x, y), xTable[y,x].String)
 
 @classmethod
 def setUpClass(cls):
@@ -282,14 +282,14 @@ class CheckTable(unittest.TestCase):
 self._check_table(xTable)
 xTable.RowDescriptions = ('fooRow', 'bazRow')
 xTable.ColumnDescriptions = ('fooColumn', 'bazColumn')
-self.assertEqual('fooRow', xTable.getCellByPosition(0, 1).String)
-self.assertEqual('bazRow', xTable.getCellByPosition(0, 2).String)
-self.assertEqual('fooColumn', xTable.getCellByPosition(1, 0).String)
-self.assertEqual('bazColumn', xTable.getCellByPosition(2, 0).String)
-xTable.getCellByPosition(0, 1).String = 'Cell 0 1'  # reset changes 
values ...
-xTable.getCellByPosition(0, 2).String = 'Cell 0 2'
-xTable.getCellByPosition(1, 0).String = 'Cell 1 0'
-xTable.getCellByPosition(2, 0).String = 'Cell 2 0'
+self.assertEqual('fooRow', xTable[1,0].String)
+self.assertEqual('bazRow', xTable[2,0].String)
+self.assertEqual('fooColumn', xTable[0,1].String)
+self.assertEqual('bazColumn', xTable[0,2].String)
+xTable[1,0].String = 'Cell 0 1'  # reset changes values ...
+xTable[2,0].String = 'Cell 0 2'
+xTable[0,1].String = 'Cell 1 0'
+xTable[0,2].String = 'Cell 2 0'
 self._check_table(xTable)  # ... to ensure the rest was untouched
 # check disconnected table excepts, but doesn't crash
 xTable2 = xDoc.createInstance("com.sun.star.text.TextTable")
@@ -310,11 +310,11 @@ class CheckTable(unittest.TestCase):
 xTable.ChartColumnAsLabel = False
 xTable.ChartRowAsLabel = False
 # roundtrip
-xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
+xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(4))
 self.assertEqual(xTable.Data, ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 
11, 12)))
 # missing row
 with self.assertRaises(Exception):
-xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9))
+xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(3))
 # missing column
 with self.assertRaises(Exception):
 xTable.Data = ((1, 2), (4, 5), (7, 8), (10, 11))
@@ -342,7 +342,7 @@ class CheckTable(unittest.TestCase):
 xDoc.Text.insertTextContent(xCursor, xTable, False)
 xTable.ChartColumnAsLabel = False
 xTable.ChartRowAsLabel = False
-xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
+xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(4))
 xRows = xTable.Rows
 self.assertEqual(xRows.ImplementationName, 'SwXTableRows')
 self.assertTrue(xRows.supportsService('com.sun.star.text.TableRows'))
@@ -369,7 +369,7 @@ class CheckTable(unittest.TestCase):
 xDoc.Text.insertTextContent(xCursor, xTable, False)
 xTable.ChartColumnAsLabel = False
 xTable.ChartRowAsLabel = False
-xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
+xTable.Data = ((y for y in range(3*x+1,3*x+4)) for x in range(4))
 xRows = xTable.Rows
 xRows.insertByIndex(1, 2)
 nan = float('nan')
@@ -411,7 +411,7 @@ class CheckTable(unittest.TestCase):
 xDoc.Text.insertTextContent(xCursor, xTable, False)
 xTable.ChartColumnAsLabel = False
 xTable.ChartRowAsLabel = False
-xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9

[Libreoffice-commits] core.git: uitest/manual_tests

2018-02-05 Thread Saurav Chirania
 uitest/manual_tests/more_calc.py |   52 +++
 1 file changed, 52 insertions(+)

New commits:
commit b57ad983e6ed5d976903b1d6588b472bb3051e7d
Author: Saurav Chirania 
Date:   Sat Feb 3 01:58:42 2018 +0530

tdf#107501 automatize EN-8 manual test, related tdf#84810

This test is to check that paste special combined
with some options and link is ok.

Change-Id: Ifffca8033b195d64d310d9d063ee95bbc8e8ad5d
Reviewed-on: https://gerrit.libreoffice.org/49164
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/uitest/manual_tests/more_calc.py b/uitest/manual_tests/more_calc.py
new file mode 100644
index ..08aeb654e449
--- /dev/null
+++ b/uitest/manual_tests/more_calc.py
@@ -0,0 +1,52 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+from uitest.uihelper.calc import enter_text_to_cell
+
+
+class ManualCalcTests(UITestCase):
+def test_paste_special(self):
+# EN-8:Paste special with options
+# This test is to check that paste special combined with some options 
and link is ok.
+# Refers to tdf#84810
+
+self.ui_test.create_doc_in_start_center("calc")
+
+# Write text to cell A1
+xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+enter_text_to_cell(xGridWin, "A1", "abcd")
+
+# Copy cell A1 to clipboard
+xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+self.xUITest.executeCommand(".uno:Copy")
+
+# Set cursor to cell A3
+xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
+
+# Choose Paste Special Options and paste data
+self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+xPasteSpecialDlg = self.xUITest.getTopFocusWindow()
+xAllChkBox = xPasteSpecialDlg.getChild("paste_all")
+xAllChkBox.executeAction("CLICK", tuple())
+xLinkChkBox = xPasteSpecialDlg.getChild("link")
+xLinkChkBox.executeAction("CLICK", tuple())
+xOkBtn = xPasteSpecialDlg.getChild("ok")
+self.ui_test.close_dialog_through_button(xOkBtn)
+
+# Assert successful paste
+document = self.ui_test.get_component()
+self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), 
"abcd")
+self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Help needed for GSoC 2018 preparation

2018-01-28 Thread Saurav Chirania
Hi all.

I plan to apply for GSoC this year for the project titled - “Add a DSL to
the UI testing and improve the generated log file” in the GSoC ideas page
of LibreOffice. I read a few blog posts (see footnote) and I’ll be glad if
someone can help me with other resources that will help me prepare for this
project.

To make me familiar with the codes, I started by working on tdf#107501.
However, I need help-

1) Where can I find the manual UI tests (The given link,
https://manual-test.libreoffice.org/ , requires some log in details, which
I don’t have)

2) Is there any example of manual test and the corresponding automated
test? I want to see that too.


Thank You

Saurav Chirania

Sophomore

Department of Computer Science and Engineering

Indian Institute of Technology (ISM), Dhanbad


Footnote -

I read the following blog posts-

1) https://mmohrhard.wordpress.com/2016/09/07/ui-testing-in-libreoffice/

2)
https://mmohrhard.wordpress.com/2016/09/10/writing-a-libreoffice-calc-ui-test/

3)
https://mmohrhard.wordpress.com/2016/10/03/libreoffice-ui-test-tutorial-part-1-adding-a-simple-test/
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: sw/qa

2018-01-16 Thread Saurav Chirania
 sw/qa/python/check_cross_references.py |6 ++
 sw/qa/python/check_fields.py   |3 +--
 sw/qa/python/check_flies.py|   10 +-
 3 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit ada02c556531e9e5f28a159223fc7e2b36a7a84d
Author: Saurav Chirania 
Date:   Sun Jan 14 20:51:17 2018 +0530

tdf#97361 Tests in sw should be more pythonic

The modified files have been made more pythonic
by removing Java-like codes.

Change-Id: I46c121f3bd350b0218ca700ea949616e010f917e
Reviewed-on: https://gerrit.libreoffice.org/47863
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/python/check_cross_references.py 
b/sw/qa/python/check_cross_references.py
index 9eaabf0b0105..742cc0d94ad5 100644
--- a/sw/qa/python/check_cross_references.py
+++ b/sw/qa/python/check_cross_references.py
@@ -59,8 +59,7 @@ class CheckCrossReferences(unittest.TestCase):
 if (self.xPortionEnum is None):
 break
 
-while self.xPortionEnum.hasMoreElements():
-xPortionProps = self.xPortionEnum.nextElement()
+for xPortionProps in self.xPortionEnum:
 sPortionType = 
str(xPortionProps.getPropertyValue("TextPortionType"))
 if (sPortionType == "TextField"):
 xField = xPortionProps.getPropertyValue("TextField")
@@ -185,8 +184,7 @@ class CheckCrossReferences(unittest.TestCase):
 self.xParaEnum = xParaEnumAccess.createEnumeration()
 
 # iterate on the paragraphs to find certain paragraph to insert the 
bookmark
-while self.xParaEnum.hasMoreElements():
-xParaTextRange = self.xParaEnum.nextElement()
+for xParaTextRange in self.xParaEnum:
 
 if xParaTextRange.getString() == "J":
 break
diff --git a/sw/qa/python/check_fields.py b/sw/qa/python/check_fields.py
index 2fdbdf93cc2c..60418a93001d 100644
--- a/sw/qa/python/check_fields.py
+++ b/sw/qa/python/check_fields.py
@@ -29,8 +29,7 @@ class CheckFields(unittest.TestCase):
 xDoc = self.__class__._xDoc
 xEnumerationAccess = xDoc.getTextFields()
 xFieldEnum = xEnumerationAccess.createEnumeration()
-while xFieldEnum.hasMoreElements():
-xField = xFieldEnum.nextElement()
+for xField in xFieldEnum:
 if xField.supportsService("com.sun.star.text.TextField.JumpEdit"):
 xAnchor = xField.getAnchor()
 read_content = xAnchor.getString()
diff --git a/sw/qa/python/check_flies.py b/sw/qa/python/check_flies.py
index d9407731e609..6353ccda150d 100644
--- a/sw/qa/python/check_flies.py
+++ b/sw/qa/python/check_flies.py
@@ -64,7 +64,7 @@ class CheckFlies(unittest.TestCase):
  "Unexpected number of embedded frames reported")
 
 for nCurrentFrameIdx in range(len(xEmbeddedFramesIdx)):
-xEmbeddedFramesIdx.getByIndex(nCurrentFrameIdx)
+xEmbeddedFramesIdx[nCurrentFrameIdx]
 
 def checkGraphicFrames(self, xTGOS):
 vExpectedGraphicFrames = ["graphics1"]
@@ -76,7 +76,7 @@ class CheckFlies(unittest.TestCase):
 # raises ValueError if not found
 xGraphicFrames[sFrameName]
 self.assertTrue(
-xGraphicFrames.hasByName(sFrameName),
+sFrameName in xGraphicFrames,
 "Could not find graphics frame by name.")
 self.assertTrue(
 not(vExpectedGraphicFrames),
@@ -87,7 +87,7 @@ class CheckFlies(unittest.TestCase):
  "Unexpected number of graphics frames reported")
 
 for nCurrentFrameIdx in range(len(xGraphicFramesIdx)):
-xGraphicFramesIdx.getByIndex(nCurrentFrameIdx)
+xGraphicFramesIdx[nCurrentFrameIdx]
 
 def checkTextFrames(self, xTFS):
 vExpectedTextFrames = ["Frame1", "Frame2"]
@@ -100,7 +100,7 @@ class CheckFlies(unittest.TestCase):
 # raises ValueError if not found
 xTextFrames[sFrameName]
 self.assertTrue(
-xTextFrames.hasByName(sFrameName),
+sFrameName in xTextFrames,
 "Could not find text frame by name.")
 
 self.assertTrue(
@@ -112,7 +112,7 @@ class CheckFlies(unittest.TestCase):
  "Unexpected number of text frames reported")
 
 for nCurrentFrameIdx in range(len(xTextFramesIdx)):
-xTextFramesIdx.getByIndex(nCurrentFrameIdx)
+xTextFramesIdx[nCurrentFrameIdx]
 
 
 if __name__ == "__main__":
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Saurav Chirania license statement

2018-01-14 Thread Saurav Chirania
   All of my past & future contributions to LibreOffice may be
   licensed under the MPLv2/LGPLv3+ dual license.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice