Spreadsheet: Fixed issue #2894: Unit strings could be used as aliases.
This commit is contained in:
committed by
Yorik van Havre
parent
31b0233393
commit
2714dd82c8
@@ -149,6 +149,9 @@ bool PropertySheet::isValidAlias(const std::string &candidate)
|
||||
if (getValueFromAlias(candidate) != 0)
|
||||
return false;
|
||||
|
||||
if (ExpressionParser::isTokenAUnit(candidate))
|
||||
return false;
|
||||
|
||||
if (boost::regex_match(candidate.c_str(), cm, gen)) {
|
||||
static const boost::regex e("\\${0,1}([A-Z]{1,2})\\${0,1}([0-9]{1,5})");
|
||||
|
||||
|
||||
@@ -692,6 +692,16 @@ class SpreadsheetCases(unittest.TestCase):
|
||||
else:
|
||||
self.fail("A cell address was used as alias which shouldn't be allowed")
|
||||
|
||||
def testSetInvalidAlias2(self):
|
||||
""" Try to use a unit (reserved word) as alias name """
|
||||
sheet = self.doc.addObject("Spreadsheet::Sheet","Calc")
|
||||
try:
|
||||
sheet.setAlias("A1","mA")
|
||||
except:
|
||||
self.assertEqual(sheet.getAlias("A1"), None)
|
||||
else:
|
||||
self.fail("A unit (reserved word) was used as alias which shouldn't be allowed")
|
||||
|
||||
def testPlacementName(self):
|
||||
""" Object name is equal to property name (bug #2389) """
|
||||
if not FreeCAD.GuiUp:
|
||||
|
||||
Reference in New Issue
Block a user