mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Merge pull request #7380 from slarosa/fix_18485
Fixes #18485 - do not truncate project title if filename contains period
This commit is contained in:
commit
c4b9106872
@ -508,7 +508,7 @@ QString QgsProject::baseName() const
|
||||
}
|
||||
else
|
||||
{
|
||||
return QFileInfo( mFile.fileName() ).baseName();
|
||||
return QFileInfo( mFile.fileName() ).completeBaseName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1091,6 +1091,20 @@ class TestQgsProject(unittest.TestCase):
|
||||
self.assertTrue(l.setSubsetString('class=\'a\''))
|
||||
self.assertTrue(p.isDirty())
|
||||
|
||||
def testProjectTitleWithPeriod(self):
|
||||
tmpDir = QTemporaryDir()
|
||||
tmpFile = "{}/2.18.21.qgs".format(tmpDir.path())
|
||||
tmpFile2 = "{}/qgis-3.2.0.qgs".format(tmpDir.path())
|
||||
|
||||
p0 = QgsProject()
|
||||
p0.setFileName(tmpFile)
|
||||
|
||||
p1 = QgsProject()
|
||||
p1.setFileName(tmpFile2)
|
||||
|
||||
self.assertEqual(p0.baseName(), '2.18.21')
|
||||
self.assertEqual(p1.baseName(), 'qgis-3.2.0')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user