Removed the rejection of QAbstractFileEngine.beginEntryList.
Added an unit test. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Renato Araújo <renato.filho@openbossa.org>
This commit is contained in:
parent
f957a6f42d
commit
801efd40f3
3 changed files with 83 additions and 1 deletions
|
|
@ -231,7 +231,7 @@
|
||||||
<rejection class="QtConcurrent" enum-name="enum_1"/>
|
<rejection class="QtConcurrent" enum-name="enum_1"/>
|
||||||
<rejection class="QAbstractEventDispatcher" function-name="filterEvent"/>
|
<rejection class="QAbstractEventDispatcher" function-name="filterEvent"/>
|
||||||
<rejection class="QAbstractEventDispatcher" function-name="setEventFilter"/>
|
<rejection class="QAbstractEventDispatcher" function-name="setEventFilter"/>
|
||||||
<rejection class="QAbstractFileEngine" function-name="beginEntryList"/>
|
<!-- Internal -->
|
||||||
<rejection class="QAbstractFileEngine" function-name="endEntryList"/>
|
<rejection class="QAbstractFileEngine" function-name="endEntryList"/>
|
||||||
<rejection class="QAbstractFileEngine" function-name="extension"/>
|
<rejection class="QAbstractFileEngine" function-name="extension"/>
|
||||||
<rejection class="QCoreApplication" function-name="compressEvent"/>
|
<rejection class="QCoreApplication" function-name="compressEvent"/>
|
||||||
|
|
@ -2284,6 +2284,12 @@
|
||||||
<modify-function signature="rmdir(const QString&, bool)const" allow-thread="yes" />
|
<modify-function signature="rmdir(const QString&, bool)const" allow-thread="yes" />
|
||||||
<modify-function signature="write(const char*, qint64)" allow-thread="yes" />
|
<modify-function signature="write(const char*, qint64)" allow-thread="yes" />
|
||||||
|
|
||||||
|
<modify-function signature="beginEntryList(QFlags<QDir::Filter>,const QStringList&)">
|
||||||
|
<modify-argument index="return">
|
||||||
|
<define-ownership class="native" owner="c++"/>
|
||||||
|
</modify-argument>
|
||||||
|
</modify-function>
|
||||||
|
|
||||||
<modify-function signature="unmap(uchar*)">
|
<modify-function signature="unmap(uchar*)">
|
||||||
<modify-argument index="1">
|
<modify-argument index="1">
|
||||||
<replace-type modified-type="PyBuffer"/>
|
<replace-type modified-type="PyBuffer"/>
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ PYSIDE_TEST(missing_symbols_test.py)
|
||||||
PYSIDE_TEST(mockclass_test.py)
|
PYSIDE_TEST(mockclass_test.py)
|
||||||
PYSIDE_TEST(python_conversion.py)
|
PYSIDE_TEST(python_conversion.py)
|
||||||
PYSIDE_TEST(qabs_test.py)
|
PYSIDE_TEST(qabs_test.py)
|
||||||
|
PYSIDE_TEST(qabstractfileengine_test.py)
|
||||||
PYSIDE_TEST(qabstractitemmodel_test.py)
|
PYSIDE_TEST(qabstractitemmodel_test.py)
|
||||||
PYSIDE_TEST(qabstracttransition_test.py)
|
PYSIDE_TEST(qabstracttransition_test.py)
|
||||||
PYSIDE_TEST(qanimationgroup_test.py)
|
PYSIDE_TEST(qanimationgroup_test.py)
|
||||||
|
|
|
||||||
75
tests/QtCore/qabstractfileengine_test.py
Normal file
75
tests/QtCore/qabstractfileengine_test.py
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import os
|
||||||
|
from PySide.QtCore import QAbstractFileEngineIterator, QAbstractFileEngine, QAbstractFileEngineHandler, QDir
|
||||||
|
|
||||||
|
|
||||||
|
class TestFSIterator(QAbstractFileEngineIterator):
|
||||||
|
def __init__(self, parent, filters, filterNames):
|
||||||
|
QAbstractFileEngineIterator.__init__(self, filters, filterNames)
|
||||||
|
self.index = -1
|
||||||
|
self._list = ['.', '..']
|
||||||
|
if parent == '/bup':
|
||||||
|
self._list += ['A', 'B', 'C']
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
self.index += 1
|
||||||
|
return self.currentFileName()
|
||||||
|
|
||||||
|
def hasNext(self):
|
||||||
|
return (self.index + 1) < len(self._list)
|
||||||
|
|
||||||
|
def currentFileName(self):
|
||||||
|
if self.index < len(self._list):
|
||||||
|
return self._list[self.index]
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
class TestFS(QAbstractFileEngine):
|
||||||
|
def __init__(self, path):
|
||||||
|
QAbstractFileEngine.__init__(self)
|
||||||
|
self.path = path
|
||||||
|
|
||||||
|
def beginEntryList(self, filters, filterNames):
|
||||||
|
return TestFSIterator(self.path, filters, filterNames)
|
||||||
|
|
||||||
|
def fileFlags(self, _ = QAbstractFileEngine.FileInfoAll):
|
||||||
|
return QAbstractFileEngine.ExistsFlag\
|
||||||
|
|QAbstractFileEngine.ReadOwnerPerm\
|
||||||
|
|QAbstractFileEngine.ReadUserPerm\
|
||||||
|
|QAbstractFileEngine.ReadGroupPerm\
|
||||||
|
|QAbstractFileEngine.ReadOtherPerm\
|
||||||
|
|QAbstractFileEngine.DirectoryType
|
||||||
|
|
||||||
|
def fileName(self, path=QAbstractFileEngine.DefaultName):
|
||||||
|
if path == QAbstractFileEngine.DefaultName:
|
||||||
|
return self.path
|
||||||
|
return os.path.basename(self.path)
|
||||||
|
|
||||||
|
def setFileName(self, path):
|
||||||
|
self.path = path
|
||||||
|
|
||||||
|
class TestFSHandler(QAbstractFileEngineHandler):
|
||||||
|
def __init__(self):
|
||||||
|
QAbstractFileEngineHandler.__init__(self)
|
||||||
|
|
||||||
|
def create(self, path):
|
||||||
|
if path.startswith('/bup'):
|
||||||
|
return TestFS(path)
|
||||||
|
return None
|
||||||
|
|
||||||
|
class QAbstractFileEngineTest(unittest.TestCase):
|
||||||
|
|
||||||
|
def testBeginEntryList(self):
|
||||||
|
obj = TestFSHandler()
|
||||||
|
qdir = QDir('/bup')
|
||||||
|
for n1, n2 in zip(qdir.entryList(), ['.', '..', 'A', 'B', 'C']):
|
||||||
|
self.assertEqual(n1, n2)
|
||||||
|
self.assertEqual(len(qdir.entryList()), 5)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue