##// END OF EJS Templates
added test for overload of copy constructor and double constructor decorators...
florianlink -
r42:2e28b78885ae
parent child
Show More
@@ -213,7 +213,7 void PythonQtTestSlotCalling::testCppFactory()
213 213 {
214 214 PythonQtTestCppFactory* f = new PythonQtTestCppFactory;
215 215 PythonQt::self()->addInstanceDecorators(new PQCppObjectDecorator);
216 PythonQt::self()->addInstanceDecorators(new PQCppObjectNoWrapDecorator);
216 PythonQt::self()->addDecorators(new PQCppObjectNoWrapDecorator);
217 217
218 218 PythonQt::self()->addWrapperFactory(f);
219 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 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 224 class PQCppObjectNoWrapDecorator : public QObject {
225 225 Q_OBJECT
226 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 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