summaryrefslogtreecommitdiffstats
path: root/canvas
diff options
context:
space:
mode:
authorscito <info@scito.ch>2021-06-13 14:32:53 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-15 09:40:04 +0200
commitf93f6c8452fd94e58f1ddec65e18f34d5a20726a (patch)
tree7d04861ec2d1bb0474ac7e0467046323635928ec /canvas
parentUse FontList::GetFirstFontMetric instead of custom iteration code (diff)
downloadcore-f93f6c8452fd94e58f1ddec65e18f34d5a20726a.tar.gz
core-f93f6c8452fd94e58f1ddec65e18f34d5a20726a.zip
ucalc_copypaste: improve readability and shorten
The tests are written in a simpler and shorter way. (The same, but 858 lines less.) I've transformed the code with several regex in VSCode. I've made a manual clean up at the end. The regex are listed below in the form *** search regex replace regex *** aString = m_pDoc->GetString\((\d+,\s*\d+,\s*\w+)\); \s*CPPUNIT_ASSERT_EQUAL\(OUString\("(.*)"\), aString\); CPPUNIT_ASSERT_EQUAL(OUString("$2"), m_pDoc->GetString($1)); *** m_pDoc->GetFormula\((\d+, \d+, \w+), \w+\); \s*CPPUNIT_ASSERT_EQUAL\(OUString\("(.*)"\), \w+\); CPPUNIT_ASSERT_EQUAL(OUString("$2"), getFormula($1)); *** m_pDoc->GetFormula\((\d+, \d+, \w+), \w+\); \s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.+)", OUString\("(.+)"\), \w+\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$2", OUString("$3"), getFormula($1)); *** ScAddress \w+\((\d+, \d+, \d+)\);(\s*//.+)? \s*ScPostIt\* \w+ = m_pDoc->GetOrCreateNote\(\w+\); \s*\w+->SetText\(\w+, "(.*)"\); setNote($1, "$3");$2 *** ScAddress (\w+)\((\d+, \d+, \d+)\);(\s*//.+)? \s*ScPostIt\* \w+ = m_pDoc->GetOrCreateNote\(\w+\); \s*\w+->SetText\(\w+, "(.*)"\); ScAddress $1 = setNote($2, "$4");$3 *** ScAddress (\w+)\((\d+, \d+, \w+)\);(\s*//.+)? \s*ScPostIt\* \w+ = m_pDoc->GetOrCreateNote\(\w+\); \s*\w+->SetText\(\w+, "(.*)"\); setNote($2, "$4");$3 *** m_pDoc->GetNote\(ScAddress\((\d+, \d+, (\d+|\w+))\)\) m_pDoc->GetNote($1) *** "There should be(\s+\w+) note on (\w+) "$2:$1 note *** HasNote\(ScAddress\((\d+, \d+, (\d+|\w+))\)\) HasNote($1) *** ASSERT_DOUBLES_EQUAL\((-?\d+), CPPUNIT_ASSERT_EQUAL($1.0, *** \w+ = m_pDoc->GetString\((\d+, \d+, (\d+|\w+))\); \s*CPPUNIT_ASSERT_EQUAL\(EMPTY_OUSTRING, \w+\); CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString()); *** \w+ = m_pDoc->GetString\((\d+, \d+, (\d+|\w+))\);(\s*//.*)? \s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.+)", EMPTY_OUSTRING, \w+\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$4", EMPTY_OUSTRING, m_pDoc->GetString($2));$3 *** fValue = m_pDoc->GetValue\((\d+, \d+, (\d+|\w+))\);(\s*//.*)? \s*ASSERT_DOUBLES_EQUAL_MESSAGE\("(.*)", (-?\d+), fValue\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$4", $5.0, m_pDoc->GetValue($1)); *** fValue = m_pDoc->GetValue\((\d+, \d+, (\d+|\w+))\);(\s*//.*)? \s*CPPUNIT_ASSERT_EQUAL\((-?\d+(\.0)?), fValue\); CPPUNIT_ASSERT_EQUAL($4, m_pDoc->GetValue($1));$3 *** m_pDoc->GetFormula\((\d+, \d+, \w+), \w+\);(\s*//.*)? \s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.+)", OUString\("(.+)"\), \w+\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$3", OUString("$4"), getFormula($1)); *** aStr = m_pDoc->GetString\((\d+, \d+, \w+)\);(\s*//.*)? \s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.*)", OUString\("(.*)"\), aStr\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$3", OUString("$4"), m_pDoc->GetString($1)); *** m_pDoc->GetNote\((\d+, \d+, (\d+|\w+))\)->GetText\(\) getNote($1) *** Change-Id: I4000b7f89a0bee1d2d52abfd6c1b055470e39d02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117174 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'canvas')
0 files changed, 0 insertions, 0 deletions