[Libreoffice-commits] core.git: 2 commits - solenv/gbuild sw/inc sw/source uitest/test_main.py
Noel Grandin
noel.grandin at collabora.co.uk
Tue Jul 10 06:30:16 UTC 2018
solenv/gbuild/uitest-failed-default.sh | 5 ++++-
sw/inc/ToxTextGenerator.hxx | 2 +-
sw/source/core/tox/ToxTextGenerator.cxx | 4 ++--
uitest/test_main.py | 14 ++++++++++++--
4 files changed, 19 insertions(+), 6 deletions(-)
New commits:
commit acb7c06ab171d4201842d8183eefeeca2d28c3f5
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Jul 9 14:33:20 2018 +0200
use std::uniqueptr in HandledTextToken
fixing a memory leak
Change-Id: Ic7754bb88a11855a308d39c6c4c66b89652422a0
Reviewed-on: https://gerrit.libreoffice.org/57186
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/inc/ToxTextGenerator.hxx b/sw/inc/ToxTextGenerator.hxx
index f93db784ce58..556519701583 100644
--- a/sw/inc/ToxTextGenerator.hxx
+++ b/sw/inc/ToxTextGenerator.hxx
@@ -76,7 +76,7 @@ private:
*/
struct HandledTextToken {
OUString text;
- std::vector<SwFormatAutoFormat*> autoFormats;
+ std::vector<std::unique_ptr<SwFormatAutoFormat>> autoFormats;
std::vector<sal_Int32> startPositions;
std::vector<sal_Int32> endPositions;
};
diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx
index d60e04bd2ff4..2cd0d5306e61 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -315,10 +315,10 @@ ToxTextGenerator::HandleTextToken(const SwTOXSortTabBase& source, SwAttrPool& po
if (attributesToClone->Count() <= 0) {
continue;
}
- SwFormatAutoFormat* clone = static_cast<SwFormatAutoFormat*>(hint->GetAutoFormat().Clone());
+ std::unique_ptr<SwFormatAutoFormat> clone(static_cast<SwFormatAutoFormat*>(hint->GetAutoFormat().Clone()));
clone->SetStyleHandle(attributesToClone);
- result.autoFormats.push_back(clone);
+ result.autoFormats.push_back(std::move(clone));
ModelToViewHelper aConversionMap( *pSrc, ExpandMode::ExpandFields );
result.startPositions.push_back(
commit bff02d54960b55e16d5c1220719bb86dc1fdd205
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Jul 9 10:54:36 2018 +0200
uitests - error if UITEST_TEST_NAME not set to anything useful
so the next poor sod who doesn't understand the instructions doesn't
waste time with the wrong way of specifying the tests
Change-Id: I9759c7f792ec80d660f70f79dc6e2589d44e360f
Reviewed-on: https://gerrit.libreoffice.org/57177
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/solenv/gbuild/uitest-failed-default.sh b/solenv/gbuild/uitest-failed-default.sh
index 1aeb8c358b99..c4555d0d069d 100755
--- a/solenv/gbuild/uitest-failed-default.sh
+++ b/solenv/gbuild/uitest-failed-default.sh
@@ -15,7 +15,10 @@ To rerun just this failed test without all others, use:
make UITest_$2
Or to run just a specific test case method, use:
- make UITest_$2 UITEST_TEST_NAME="package.ClassName.methodName"
+ make UITest_$2 UITEST_TEST_NAME="Module.ClassName.methodName"
+where
+ Module - the name of the python file (without the .py extension)
+ Class - is the name in the "class Class" declaration
Or to do interactive debugging, put a long sleep in the beginning of the .py
uitest file, and attach gdb to the running soffice process.
diff --git a/uitest/test_main.py b/uitest/test_main.py
index ec4f2071f102..934b27790961 100644
--- a/uitest/test_main.py
+++ b/uitest/test_main.py
@@ -19,6 +19,8 @@ from uitest.framework import UITestCase
from libreoffice.connection import OfficeConnection
+test_name_limit_found = False
+
def parseArgs(argv):
(optlist,args) = getopt.getopt(argv[1:], "hdr",
["help", "debug", "soffice=", "userdir=", "dir=", "file=", "gdb"])
@@ -73,12 +75,15 @@ def add_tests_for_file(test_file, test_suite):
loader = importlib.machinery.SourceFileLoader(module_name, test_file)
mod = loader.load_module()
classes = get_test_case_classes_of_module(mod)
+ global test_name_limit_found
for c in classes:
test_names = test_loader.getTestCaseNames(c)
for test_name in test_names:
full_name = ".".join([module_name, c.__name__, test_name])
- if len(test_name_limit) > 0 and not test_name_limit.startswith(full_name):
- continue
+ if len(test_name_limit) > 0:
+ if not test_name_limit.startswith(full_name):
+ continue
+ test_name_limit_found = True
obj = c(test_name, opts)
test_suite.addTest(obj)
@@ -102,6 +107,11 @@ if __name__ == '__main__':
sys.exit(1)
elif "--dir" in opts:
test_suite = get_test_suite_for_dir(opts)
+ test_name_limit = os.environ.get('UITEST_TEST_NAME', '')
+ print(test_name_limit_found)
+ if len(test_name_limit) > 0 and not test_name_limit_found:
+ print("UITEST_TEST_NAME '%s' does not match any test" % test_name_limit)
+ sys.exit(1)
elif "--file" in opts:
test_suite = unittest.TestSuite()
add_tests_for_file(opts['--file'], test_suite)
More information about the Libreoffice-commits
mailing list