Fixes QPixmap.loadFromData method and extends QPixmap test cases.
Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Bruno Araújo <bruno.araujo@openbossa.org>
This commit is contained in:
parent
ff3f3a9cf2
commit
1356f832ae
3 changed files with 29 additions and 2 deletions
|
|
@ -666,7 +666,20 @@
|
||||||
<modify-function signature="QPixmap(const char **)" remove="all"/>
|
<modify-function signature="QPixmap(const char **)" remove="all"/>
|
||||||
<modify-function signature="serialNumber()const" remove="all"/>
|
<modify-function signature="serialNumber()const" remove="all"/>
|
||||||
<!--### Obsolete in 4.3-->
|
<!--### Obsolete in 4.3-->
|
||||||
<modify-function signature="loadFromData(const uchar *,uint,const char *,QFlags<Qt::ImageConversionFlag>)" remove="all"/>
|
<modify-function signature="loadFromData(const uchar*,uint,const char*,QFlags<Qt::ImageConversionFlag>)">
|
||||||
|
<modify-argument index="1">
|
||||||
|
<replace-type modified-type="const char*"/>
|
||||||
|
<conversion-rule class="native">
|
||||||
|
const uchar* %out = reinterpret_cast<const uchar*>(PyString_AS_STRING(%PYARG_1));
|
||||||
|
</conversion-rule>
|
||||||
|
</modify-argument>
|
||||||
|
<modify-argument index="2">
|
||||||
|
<remove-argument/>
|
||||||
|
<conversion-rule class="native">
|
||||||
|
uint %out = static_cast<uint>(PyString_GET_SIZE(%PYARG_1));
|
||||||
|
</conversion-rule>
|
||||||
|
</modify-argument>
|
||||||
|
</modify-function>
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QTextCursor" >
|
<value-type name="QTextCursor" >
|
||||||
<extra-includes>
|
<extra-includes>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import os
|
||||||
from helper import UsesQApplication
|
from helper import UsesQApplication
|
||||||
from PySide.QtGui import *
|
from PySide.QtGui import *
|
||||||
from PySide.QtCore import *
|
from PySide.QtCore import *
|
||||||
|
|
@ -17,12 +18,25 @@ class QPixmapTest(UsesQApplication):
|
||||||
def testQStringConstructor(self):
|
def testQStringConstructor(self):
|
||||||
pixmap = QPixmap(QString("Testing!"))
|
pixmap = QPixmap(QString("Testing!"))
|
||||||
|
|
||||||
def testQVariantConstructor(self):
|
def testQVariantConstructor2(self):
|
||||||
v = QVariant(QPixmap())
|
v = QVariant(QPixmap())
|
||||||
pixmap2 = QPixmap(v)
|
pixmap2 = QPixmap(v)
|
||||||
v = QVariant(QImage())
|
v = QVariant(QImage())
|
||||||
pixmap2 = QPixmap(v)
|
pixmap2 = QPixmap(v)
|
||||||
|
|
||||||
|
def testQPixmapLoadFromDataWithQFile(self):
|
||||||
|
f = QFile(os.path.join(os.path.dirname(__file__), 'sample.png'))
|
||||||
|
self.assert_(f.open(QIODevice.ReadOnly))
|
||||||
|
data = f.read(f.size())
|
||||||
|
f.close()
|
||||||
|
pixmap = QPixmap()
|
||||||
|
self.assert_(pixmap.loadFromData(data))
|
||||||
|
|
||||||
|
def testQPixmapLoadFromDataWithPython(self):
|
||||||
|
data = open(os.path.join(os.path.dirname(__file__),'sample.png'),'rb').read()
|
||||||
|
pixmap = QPixmap()
|
||||||
|
self.assert_(pixmap.loadFromData(data))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
||||||
BIN
tests/qtgui/sample.png
Normal file
BIN
tests/qtgui/sample.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Loading…
Add table
Add a link
Reference in a new issue