@@ -213,7 +213,7 void PythonQtTestSlotCalling::testCppFactory() | |||||
213 | { |
|
213 | { | |
214 | PythonQtTestCppFactory* f = new PythonQtTestCppFactory; |
|
214 | PythonQtTestCppFactory* f = new PythonQtTestCppFactory; | |
215 | PythonQt::self()->addInstanceDecorators(new PQCppObjectDecorator); |
|
215 | PythonQt::self()->addInstanceDecorators(new PQCppObjectDecorator); | |
216 |
PythonQt::self()->add |
|
216 | PythonQt::self()->addDecorators(new PQCppObjectNoWrapDecorator); | |
217 |
|
217 | |||
218 | PythonQt::self()->addWrapperFactory(f); |
|
218 | PythonQt::self()->addWrapperFactory(f); | |
219 | QVERIFY(_helper->runScript("if obj.createPQCppObject(12).getHeight()==12: obj.setPassed();\n")); |
|
219 | QVERIFY(_helper->runScript("if obj.createPQCppObject(12).getHeight()==12: obj.setPassed();\n")); | |
@@ -226,6 +226,14 void PythonQtTestSlotCalling::testCppFactory() | |||||
226 | )); |
|
226 | )); | |
227 |
|
227 | |||
228 | QVERIFY(_helper->runScript("if obj.createPQCppObjectNoWrap(12).getH()==12: obj.setPassed();\n")); |
|
228 | QVERIFY(_helper->runScript("if obj.createPQCppObjectNoWrap(12).getH()==12: obj.setPassed();\n")); | |
|
229 | ||||
|
230 | ||||
|
231 | // expect to get strict call to double overload | |||
|
232 | QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObjectNoWrap\na = PQCppObjectNoWrap(22.2)\nif a.getH()==2: obj.setPassed();\n")); | |||
|
233 | // expect to get un-strict call to double overload | |||
|
234 | QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObjectNoWrap\na = PQCppObjectNoWrap(22)\nif a.getH()==2: obj.setPassed();\n")); | |||
|
235 | // expect to get strict call to copy constructor overload | |||
|
236 | QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObjectNoWrap\na = PQCppObjectNoWrap(PQCppObjectNoWrap())\nprint a.getH()\nif a.getH()==1: obj.setPassed();\n")); | |||
229 | } |
|
237 | } | |
230 |
|
238 | |||
231 |
|
239 |
@@ -224,6 +224,16 private: | |||||
224 | class PQCppObjectNoWrapDecorator : public QObject { |
|
224 | class PQCppObjectNoWrapDecorator : public QObject { | |
225 | Q_OBJECT |
|
225 | Q_OBJECT | |
226 | public slots: |
|
226 | public slots: | |
|
227 | PQCppObjectNoWrap* new_PQCppObjectNoWrap() { | |||
|
228 | return new PQCppObjectNoWrap(0); | |||
|
229 | } | |||
|
230 | PQCppObjectNoWrap* new_PQCppObjectNoWrap(const PQCppObjectNoWrap& other) { | |||
|
231 | return new PQCppObjectNoWrap(1); | |||
|
232 | } | |||
|
233 | PQCppObjectNoWrap* new_PQCppObjectNoWrap(double value) { | |||
|
234 | return new PQCppObjectNoWrap(2); | |||
|
235 | } | |||
|
236 | ||||
227 | int getH(PQCppObjectNoWrap* obj) { return obj->getHeight(); } |
|
237 | int getH(PQCppObjectNoWrap* obj) { return obj->getHeight(); } | |
228 |
|
238 | |||
229 | }; |
|
239 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now