~ubuntu-branches/ubuntu/natty/pyside/natty-proposed

« back to all changes in this revision

Viewing changes to tests/QtGui/qimage_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-02-18 18:01:00 UTC
  • mfrom: (1.2.3 upstream) (6.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110218180100-vaczjij7g08fzfme
Tags: 1.0.0~rc1-1
* New 1.0.0~rc1 upstream release
  - Bump the B-D chain versions:
    + apiextractor to 0.10.0-2~
    + generatorrunner to 0.6.6
    + shiboken to 1.0.0~rc1
* Update patches to ~rc1.
* debian/watch: update to handle Release Candidates too.
* Bump XS-Python-Version to >= 2.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
'''Test cases for QImage'''
 
3
 
 
4
import unittest
 
5
from PySide.QtGui import *
 
6
from helper import *
 
7
 
 
8
class QImageTest(UsesQApplication):
 
9
    '''Test case for calling setPixel with float as argument'''
 
10
 
 
11
    def testQImageStringBuffer(self):
 
12
        '''Test if the QImage signatures receiving string buffers exist.'''
 
13
        img0 = QImage(adjust_filename('sample.png', __file__))
 
14
 
 
15
        print type(img0.bits())
 
16
 
 
17
        # btw let's test the bits() method
 
18
        img1 = QImage(img0.bits(), img0.width(), img0.height(), img0.format())
 
19
        self.assertEqual(img0, img1)
 
20
        img2 = QImage(img0.bits(), img0.width(), img0.height(), img0.bytesPerLine(), img0.format())
 
21
        self.assertEqual(img0, img2)
 
22
 
 
23
        ## test scanLine method
 
24
        data1 = img0.scanLine(0)
 
25
        data2 = img1.scanLine(0)
 
26
        self.assertEqual(data1, data2)
 
27
        self.assertEquals(str(data1), img0.bits()[:img0.bytesPerLine()])
 
28
        self.assertEquals(str(data2), img0.bits()[:img0.bytesPerLine()])
 
29
 
 
30
if __name__ == '__main__':
 
31
    unittest.main()
 
32