@@ -213,6 +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 | qRegisterMetaType<PQCppObjectNoWrap>("PQCppObjectNoWrap"); | |||
216 | PythonQt::self()->addDecorators(new PQCppObjectNoWrapDecorator); |
|
217 | PythonQt::self()->addDecorators(new PQCppObjectNoWrapDecorator); | |
217 |
|
218 | |||
218 | PythonQt::self()->addWrapperFactory(f); |
|
219 | PythonQt::self()->addWrapperFactory(f); | |
@@ -227,6 +228,13 void PythonQtTestSlotCalling::testCppFactory() | |||||
227 |
|
228 | |||
228 | QVERIFY(_helper->runScript("if obj.createPQCppObjectNoWrap(12).getH()==12: obj.setPassed();\n")); |
|
229 | QVERIFY(_helper->runScript("if obj.createPQCppObjectNoWrap(12).getH()==12: obj.setPassed();\n")); | |
229 |
|
230 | |||
|
231 | QVERIFY(_helper->runScript("if obj.getPQCppObjectNoWrapAsValue().getH()==47: obj.setPassed();\n")); | |||
|
232 | ||||
|
233 | qRegisterMetaType<PQUnknownButRegisteredValueObject>("PQUnknownButRegisteredValueObject"); | |||
|
234 | QVERIFY(_helper->runScript("a = obj.getUnknownButRegisteredValueObjectAsPtr();print a;\nif a!=None: obj.setPassed();\n")); | |||
|
235 | QVERIFY(_helper->runScript("a = obj.getUnknownButRegisteredValueObjectAsValue();print a;\nif a!=None: obj.setPassed();\n")); | |||
|
236 | QVERIFY(_helper->runScript("a = obj.getUnknownValueObjectAsPtr();print a;\nif a!=None: obj.setPassed();\n")); | |||
|
237 | QVERIFY(_helper->runScript("a = obj.getUnknownValueObjectAsValue();print a;\nif a!=None: obj.setPassed();\n")); | |||
230 |
|
238 | |||
231 | // expect to get strict call to double overload |
|
239 | // 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")); |
|
240 | QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObjectNoWrap\na = PQCppObjectNoWrap(22.2)\nif a.getH()==2: obj.setPassed();\n")); |
@@ -212,6 +212,7 public slots: | |||||
212 | class PQCppObjectNoWrap { |
|
212 | class PQCppObjectNoWrap { | |
213 |
|
213 | |||
214 | public: |
|
214 | public: | |
|
215 | PQCppObjectNoWrap() { _height = 0; } | |||
215 | PQCppObjectNoWrap(int h) { _height = h; } |
|
216 | PQCppObjectNoWrap(int h) { _height = h; } | |
216 |
|
217 | |||
217 | int getHeight() { return _height; } |
|
218 | int getHeight() { return _height; } | |
@@ -238,6 +239,17 public slots: | |||||
238 |
|
239 | |||
239 | }; |
|
240 | }; | |
240 |
|
241 | |||
|
242 | class PQUnknownValueObject | |||
|
243 | { | |||
|
244 | public: | |||
|
245 | PQUnknownValueObject() {}; | |||
|
246 | }; | |||
|
247 | ||||
|
248 | class PQUnknownButRegisteredValueObject | |||
|
249 | { | |||
|
250 | public: | |||
|
251 | PQUnknownButRegisteredValueObject() {}; | |||
|
252 | }; | |||
241 |
|
253 | |||
242 | //! test the calling of slots |
|
254 | //! test the calling of slots | |
243 | class PythonQtTestSlotCalling : public QObject |
|
255 | class PythonQtTestSlotCalling : public QObject | |
@@ -348,6 +360,15 public slots: | |||||
348 | //! cpp wrapper factory test |
|
360 | //! cpp wrapper factory test | |
349 | PQCppObjectNoWrap* getPQCppObjectNoWrap(PQCppObjectNoWrap* p) { _called = true; return p; } |
|
361 | PQCppObjectNoWrap* getPQCppObjectNoWrap(PQCppObjectNoWrap* p) { _called = true; return p; } | |
350 |
|
362 | |||
|
363 | //! get a return by value PQCppObjectNoWrap | |||
|
364 | PQCppObjectNoWrap getPQCppObjectNoWrapAsValue() { _called = true; return PQCppObjectNoWrap(47); } | |||
|
365 | ||||
|
366 | PQUnknownButRegisteredValueObject getUnknownButRegisteredValueObjectAsValue() { _called = true; return PQUnknownButRegisteredValueObject(); } | |||
|
367 | PQUnknownValueObject getUnknownValueObjectAsValue() { _called = true; return PQUnknownValueObject(); } | |||
|
368 | ||||
|
369 | PQUnknownButRegisteredValueObject* getUnknownButRegisteredValueObjectAsPtr() { _called = true; return new PQUnknownButRegisteredValueObject(); } | |||
|
370 | PQUnknownValueObject* getUnknownValueObjectAsPtr() { _called = true; return new PQUnknownValueObject(); } | |||
|
371 | ||||
351 | ClassA* getClassAPtr(ClassA* o) { _called = true; return o; } |
|
372 | ClassA* getClassAPtr(ClassA* o) { _called = true; return o; } | |
352 | ClassB* getClassBPtr(ClassB* o) { _called = true; return o; } |
|
373 | ClassB* getClassBPtr(ClassB* o) { _called = true; return o; } | |
353 | ClassC* getClassCPtr(ClassC* o) { _called = true; return o; } |
|
374 | ClassC* getClassCPtr(ClassC* o) { _called = true; return o; } |
General Comments 0
You need to be logged in to leave comments.
Login now