##// END OF EJS Templates
improved tests, enum/int overload now fails as expected, this will be fixed when enum type detection works correctly...
florianlink -
r53:1a0a1289871d
parent child
Show More
@@ -246,17 +246,33 void PythonQtTestSlotCalling::testCppFactory()
246 QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObjectNoWrap\na = PQCppObjectNoWrap(PQCppObjectNoWrap())\nprint a.getH()\nif a.getH()==1: obj.setPassed();\n"));
246 QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObjectNoWrap\na = PQCppObjectNoWrap(PQCppObjectNoWrap())\nprint a.getH()\nif a.getH()==1: obj.setPassed();\n"));
247
247
248 // test decorated enums
248 // test decorated enums
249 PythonQt::self()->registerCPPClass("PQCppObject2",NULL,NULL, PythonQtCreateObject<PQCppObject2Decorator>);
249 // already registered by signals test
250 //PythonQt::self()->registerCPPClass("PQCppObject2",NULL,NULL, PythonQtCreateObject<PQCppObject2Decorator>);
250
251
252 // local enum (decorated)
253 QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObject2\na = PQCppObject2()\nprint a.testEnumFlag1\nif a.testEnumFlag1(PQCppObject2.TestEnumValue2)==PQCppObject2.TestEnumValue2: obj.setPassed();\n"));
251 // enum with namespace (decorated)
254 // enum with namespace (decorated)
252 QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObject2\na = PQCppObject2()\nif a.testEnumFlag2(PQCppObject2.TestEnumValue2)==PQCppObject2.TestEnumValue2: obj.setPassed();\n"));
255 QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObject2\na = PQCppObject2()\nif a.testEnumFlag2(PQCppObject2.TestEnumValue2)==PQCppObject2.TestEnumValue2: obj.setPassed();\n"));
253 // local enum (decorated)
254 QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObject2\na = PQCppObject2()\nif a.testEnumFlag1(PQCppObject2.TestEnumValue2)==PQCppObject2.TestEnumValue2: obj.setPassed();\n"));
255 // with int overload to check overloading
256 // with int overload to check overloading
256 QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObject2\na = PQCppObject2()\nif a.testEnumFlag3(PQCppObject2.TestEnumValue2)==PQCppObject2.TestEnumValue2: obj.setPassed();\n"));
257 QVERIFY(_helper->runScript("obj.testNoArg()\nfrom PythonQt import PQCppObject2\na = PQCppObject2()\nif a.testEnumFlag3(PQCppObject2.TestEnumValue2)==PQCppObject2.TestEnumValue2: obj.setPassed();\n"));
257
258
258 }
259 }
259
260
261 PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag1(PQCppObject2* obj, PQCppObject2Decorator::TestEnumFlag flag) {
262 return flag;
263 }
264
265 PQCppObject2::TestEnumFlag PQCppObject2Decorator::testEnumFlag2(PQCppObject2* obj, PQCppObject2::TestEnumFlag flag) {
266 return flag;
267 }
268
269 // with int overload
270 PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* obj, int flag) {
271 return (TestEnumFlag)-1;
272 }
273 PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* obj, PQCppObject2Decorator::TestEnumFlag flag) {
274 return flag;
275 }
260
276
261 void PythonQtTestSlotCalling::testMultiArgsSlotCall()
277 void PythonQtTestSlotCalling::testMultiArgsSlotCall()
262 {
278 {
@@ -273,14 +273,14 public:
273 return new PQCppObject2();
273 return new PQCppObject2();
274 }
274 }
275
275
276 TestEnumFlag testEnumFlag1(PQCppObject2* obj, TestEnumFlag flag) { return flag; }
276 TestEnumFlag testEnumFlag1(PQCppObject2* obj, TestEnumFlag flag);
277
277
278 PQCppObject2::TestEnumFlag testEnumFlag2(PQCppObject2* obj, PQCppObject2::TestEnumFlag flag) { return flag; }
278 PQCppObject2::TestEnumFlag testEnumFlag2(PQCppObject2* obj, PQCppObject2::TestEnumFlag flag);
279
279
280 // with int overload
280 // with int overload
281 TestEnumFlag testEnumFlag3(PQCppObject2* obj, int flag) { return (TestEnumFlag)-1; }
281 TestEnumFlag testEnumFlag3(PQCppObject2* obj, int flag);
282 TestEnumFlag testEnumFlag3(PQCppObject2* obj, TestEnumFlag flag) { return flag; }
282 TestEnumFlag testEnumFlag3(PQCppObject2* obj, TestEnumFlag flag);
283
283
284 };
284 };
285
285
286 class PQUnknownValueObject
286 class PQUnknownValueObject
General Comments 0
You need to be logged in to leave comments. Login now