Closed tbonfort closed 12 years ago
Author: sgillies@frii.com Date: 2003/12/08 - 04:41
Accepted, will write tests to reproduce the bug and then start to fix it.
Author: sgillies@frii.com Date: 2003/12/08 - 21:04
I can reproduce the reported bug. This is the test
class ClonedMapOutputFormatTestCase(unittest.TestCase):
"""This test case is developed to address MapServer bug 510"""
def setUp(self):
self.mapobj1 = mapObj(testMapfile)
def tearDown(self):
self.mapobj1 = None
def testClonedMapKeepsOutputFormat(self):
self.mapobj1.setImageType('image/jpeg')
assert self.mapobj1.outputformat.mimetype == 'image/jpeg'
mapobj_clone = self.mapobj1.clone()
assert mapobj_clone.thisown == 1
mime = mapobj_clone.outputformat.mimetype
assert mime == 'image/jpeg', mime
and here is the result of the test:
FAIL: testClonedMapKeepsOutputFormat (__main__.ClonedMapOutputFormatTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/testMapScript.py", line 645, in testClonedMapKeepsOutputFormat
assert mime == 'image/jpeg', mime
AssertionError: image/png
I've a good idea on how to fix msCopyMap.
Author: sgillies@frii.com Date: 2003/12/09 - 17:18
Fixed. Here are the tests. The first tests that the cloned map's
outputformat has the same mimetype as the original. The second
tests that set options have been cloned. Both pass. Note that
I had to write a getOption method for outputFormatObj in order to
properly test. Changes are committed to 4.0 and 4.1 branches.
class ClonedMapOutputFormatTestCase(unittest.TestCase):
"""This test case is developed to address MapServer bug 510"""
def setUp(self):
self.mapobj1 = mapObj(testMapfile)
def tearDown(self):
self.mapobj1 = None
def testClonedMapKeepsOutputFormat(self):
self.mapobj1.setImageType('image/jpeg')
assert self.mapobj1.outputformat.mimetype == 'image/jpeg'
mapobj_clone = self.mapobj1.clone()
assert mapobj_clone.thisown == 1
mime = mapobj_clone.outputformat.mimetype
assert mime == 'image/jpeg', mime
def testClonedMapKeepsModifiedOutputFormat(self):
self.mapobj1.setImageType('image/jpeg')
self.mapobj1.outputformat.setOption('QUALITY','90');
assert self.mapobj1.outputformat.mimetype == 'image/jpeg'
iquality = self.mapobj1.outputformat.getOption('QUALITY')
assert iquality == '90'
mapobj_clone = self.mapobj1.clone()
assert mapobj_clone.thisown == 1
quality = mapobj_clone.outputformat.getOption('QUALITY')
assert quality == iquality, quality
Reporter: sgillies@frii.com Date: 2003/12/08 - 04:40