Skip to content
Permalink
Browse files
Merge pull request #7381 from slarosa/backport_fix_18485
[BACKPORT] Fixes #18485 - do not truncate project title if filename contains period
  • Loading branch information
slarosa committed Jul 9, 2018
2 parents 4f4c928 + d064086 commit 9e63678b2966d9d85b403faea9f7bcf56c01802e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
@@ -508,7 +508,7 @@ QString QgsProject::baseName() const
}
else
{
return QFileInfo( mFile.fileName() ).baseName();
return QFileInfo( mFile.fileName() ).completeBaseName();
}
}

@@ -1091,6 +1091,20 @@ def testLayerChangeDirtiesProject(self):
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()

0 comments on commit 9e63678

Please sign in to comment.