2059 void unsignedlonglongSignal(quint64); |
2080 void unsignedlonglongSignal(quint64); |
2060 void unsignedlongintSignal(unsigned long int); |
2081 void unsignedlongintSignal(unsigned long int); |
2061 void unsignedshortSignal(unsigned short); |
2082 void unsignedshortSignal(unsigned short); |
2062 void unsignedcharSignal(unsigned char); |
2083 void unsignedcharSignal(unsigned char); |
2063 |
2084 |
|
2085 void typeRefSignal(Template<Class &> &ref); |
|
2086 void constTypeRefSignal(const Template<Class const &> &ref); |
|
2087 void typeConstRefSignal(Template<Class const &> const &ref); |
|
2088 |
|
2089 void typePointerConstRefSignal(Class * const &); |
|
2090 |
|
2091 void constTemplateSignal1( Template<int > ); |
|
2092 void constTemplateSignal2( Template< const int >); |
|
2093 |
2064 public slots: |
2094 public slots: |
2065 void uintPointerSlot(uint *) { } |
2095 void uintPointerSlot(uint *) { } |
2066 void ulongPointerSlot(ulong *) { } |
2096 void ulongPointerSlot(ulong *) { } |
2067 void constUintPointerSlot(const uint *) { } |
2097 void constUintPointerSlot(const uint *) { } |
2068 void constUlongPointerSlot(const ulong *) { } |
2098 void constUlongPointerSlot(const ulong *) { } |
2069 |
2099 |
2070 void structSlot(Struct s) { } |
2100 void structSlot(Struct s) { Q_UNUSED(s); } |
2071 void classSlot(Class c) { } |
2101 void classSlot(Class c) { Q_UNUSED(c); } |
2072 void enumSlot(Enum e) { } |
2102 void enumSlot(Enum e) { Q_UNUSED(e); } |
2073 |
2103 |
2074 void structPointerSlot(Struct *s) { } |
2104 void structPointerSlot(Struct *s) { Q_UNUSED(s); } |
2075 void classPointerSlot(Class *c) { } |
2105 void classPointerSlot(Class *c) { Q_UNUSED(c); } |
2076 void enumPointerSlot(Enum *e) { } |
2106 void enumPointerSlot(Enum *e) { Q_UNUSED(e); } |
2077 |
2107 |
2078 void constStructPointerSlot(const Struct *s) { } |
2108 void constStructPointerSlot(const Struct *s) { Q_UNUSED(s); } |
2079 void constClassPointerSlot(const Class *c) { } |
2109 void constClassPointerSlot(const Class *c) { Q_UNUSED(c); } |
2080 void constEnumPointerSlot(const Enum *e) { } |
2110 void constEnumPointerSlot(const Enum *e) { Q_UNUSED(e); } |
2081 |
2111 |
2082 void constStructPointerConstPointerSlot(const Struct * const *s) { } |
2112 void constStructPointerConstPointerSlot(const Struct * const *s) { Q_UNUSED(s); } |
2083 void constClassPointerConstPointerSlot(const Class * const *c) { } |
2113 void constClassPointerConstPointerSlot(const Class * const *c) { Q_UNUSED(c); } |
2084 void constEnumPointerConstPointerSlot(const Enum * const *e) { } |
2114 void constEnumPointerConstPointerSlot(const Enum * const *e) { Q_UNUSED(e); } |
2085 |
2115 |
2086 void uintSlot(uint) {}; |
2116 void uintSlot(uint) {}; |
2087 void unsignedintSlot(unsigned int) {}; |
2117 void unsignedintSlot(unsigned int) {}; |
2088 void unsignedSlot(unsigned) {}; |
2118 void unsignedSlot(unsigned) {}; |
2089 void unsignedlongSlot(unsigned long) {}; |
2119 void unsignedlongSlot(unsigned long) {}; |
2090 void unsignedlonglongSlot(quint64) {}; |
2120 void unsignedlonglongSlot(quint64) {}; |
2091 void unsignedlongintSlot(unsigned long int) {}; |
2121 void unsignedlongintSlot(unsigned long int) {}; |
2092 void unsignedshortSlot(unsigned short) {}; |
2122 void unsignedshortSlot(unsigned short) {}; |
2093 void unsignedcharSlot(unsigned char) {}; |
2123 void unsignedcharSlot(unsigned char) {}; |
2094 |
2124 |
|
2125 void typeRefSlot(Template<Class &> &) {} |
|
2126 void constTypeRefSlot(const Template<const Class &> &) {} |
|
2127 void typeConstRefSlot(Template<Class const &> const &) {} |
|
2128 |
|
2129 void typePointerConstRefSlot(Class * const &) {} |
|
2130 |
|
2131 void constTemplateSlot1(Template<int > const) {} |
|
2132 void constTemplateSlot2(const Template<int > ) {} |
|
2133 void constTemplateSlot3(const Template< const int >) {} |
2095 }; |
2134 }; |
|
2135 |
|
2136 #include "oldnormalizeobject.h" |
2096 |
2137 |
2097 void tst_QObject::normalize() |
2138 void tst_QObject::normalize() |
2098 { |
2139 { |
2099 NormalizeObject object; |
2140 NormalizeObject object; |
2100 |
2141 |
2331 SLOT(unsignedshortSlot(unsigned short)))); |
2372 SLOT(unsignedshortSlot(unsigned short)))); |
2332 QVERIFY(object.connect(&object, |
2373 QVERIFY(object.connect(&object, |
2333 SIGNAL(unsignedcharSignal(unsigned char)), |
2374 SIGNAL(unsignedcharSignal(unsigned char)), |
2334 SLOT(unsignedcharSlot(unsigned char)))); |
2375 SLOT(unsignedcharSlot(unsigned char)))); |
2335 |
2376 |
2336 |
2377 // connect when original template signature and mixed usage of 'T<C const &> const &', |
|
2378 // 'const T<const C &> &', and 'T<const C &>' |
|
2379 |
|
2380 QVERIFY(object.connect(&object, |
|
2381 SIGNAL(typeRefSignal(Template<Class &> &)), |
|
2382 SLOT(typeRefSlot(Template<Class &> &)))); |
|
2383 |
|
2384 QVERIFY(object.connect(&object, |
|
2385 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2386 SLOT(constTypeRefSlot(const Template<const Class &> &)))); |
|
2387 QVERIFY(object.connect(&object, |
|
2388 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2389 SLOT(constTypeRefSlot(const Template<Class const &> &)))); |
|
2390 QVERIFY(object.connect(&object, |
|
2391 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2392 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2393 QVERIFY(object.connect(&object, |
|
2394 SIGNAL(constTypeRefSignal(Template<const Class &> const &)), |
|
2395 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2396 QVERIFY(object.connect(&object, |
|
2397 SIGNAL(constTypeRefSignal(Template<Class const &> const &)), |
|
2398 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2399 |
|
2400 QVERIFY(object.connect(&object, |
|
2401 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2402 SLOT(typeConstRefSlot(const Template<const Class &> &)))); |
|
2403 QVERIFY(object.connect(&object, |
|
2404 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2405 SLOT(typeConstRefSlot(const Template<Class const &> &)))); |
|
2406 QVERIFY(object.connect(&object, |
|
2407 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2408 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2409 QVERIFY(object.connect(&object, |
|
2410 SIGNAL(constTypeRefSignal(Template<const Class &> const &)), |
|
2411 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2412 QVERIFY(object.connect(&object, |
|
2413 SIGNAL(constTypeRefSignal(Template<Class const &> const &)), |
|
2414 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2415 |
|
2416 QVERIFY(object.connect(&object, |
|
2417 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2418 SLOT(constTypeRefSlot(const Template<const Class &> &)))); |
|
2419 QVERIFY(object.connect(&object, |
|
2420 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2421 SLOT(constTypeRefSlot(const Template<Class const &> &)))); |
|
2422 QVERIFY(object.connect(&object, |
|
2423 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2424 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2425 QVERIFY(object.connect(&object, |
|
2426 SIGNAL(typeConstRefSignal(Template<const Class &> const &)), |
|
2427 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2428 QVERIFY(object.connect(&object, |
|
2429 SIGNAL(typeConstRefSignal(Template<Class const &> const &)), |
|
2430 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2431 |
|
2432 QVERIFY(object.connect(&object, |
|
2433 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2434 SLOT(typeConstRefSlot(const Template<const Class &> &)))); |
|
2435 QVERIFY(object.connect(&object, |
|
2436 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2437 SLOT(typeConstRefSlot(const Template<Class const &> &)))); |
|
2438 QVERIFY(object.connect(&object, |
|
2439 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2440 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2441 QVERIFY(object.connect(&object, |
|
2442 SIGNAL(typeConstRefSignal(Template<const Class &> const &)), |
|
2443 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2444 QVERIFY(object.connect(&object, |
|
2445 SIGNAL(typeConstRefSignal(Template<Class const &> const &)), |
|
2446 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2447 |
|
2448 // same test again, this time with an object compiled with old moc output... we know that |
|
2449 // it is not possible to connect everything, whic is the purpose for this test |
|
2450 OldNormalizeObject oldobject; |
|
2451 |
|
2452 QVERIFY(oldobject.connect(&oldobject, |
|
2453 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2454 SLOT(constTypeRefSlot(const Template<const Class &> &)))); |
|
2455 QVERIFY(oldobject.connect(&oldobject, |
|
2456 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2457 SLOT(constTypeRefSlot(const Template<Class const &> &)))); |
|
2458 // this fails in older versions, but passes now due to proper normalizing |
|
2459 QVERIFY(oldobject.connect(&oldobject, |
|
2460 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2461 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2462 // this fails in older versions, but passes now due to proper normalizing |
|
2463 QVERIFY(oldobject.connect(&oldobject, |
|
2464 SIGNAL(constTypeRefSignal(Template<const Class &> const &)), |
|
2465 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2466 // this fails in older versions, but passes now due to proper normalizing |
|
2467 QVERIFY(oldobject.connect(&oldobject, |
|
2468 SIGNAL(constTypeRefSignal(Template<Class const &> const &)), |
|
2469 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2470 |
|
2471 // these fail in older Qt versions, but pass now due to proper normalizing |
|
2472 QVERIFY(oldobject.connect(&oldobject, |
|
2473 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2474 SLOT(typeConstRefSlot(const Template<const Class &> &)))); |
|
2475 QVERIFY(oldobject.connect(&oldobject, |
|
2476 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2477 SLOT(typeConstRefSlot(const Template<Class const &> &)))); |
|
2478 QVERIFY(oldobject.connect(&oldobject, |
|
2479 SIGNAL(constTypeRefSignal(const Template<const Class &> &)), |
|
2480 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2481 QVERIFY(oldobject.connect(&oldobject, |
|
2482 SIGNAL(constTypeRefSignal(Template<const Class &> const &)), |
|
2483 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2484 QVERIFY(oldobject.connect(&oldobject, |
|
2485 SIGNAL(constTypeRefSignal(Template<Class const &> const &)), |
|
2486 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2487 |
|
2488 // these also fail in older Qt versions, but pass now due to proper normalizing |
|
2489 QVERIFY(oldobject.connect(&oldobject, |
|
2490 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2491 SLOT(constTypeRefSlot(const Template<const Class &> &)))); |
|
2492 QVERIFY(oldobject.connect(&oldobject, |
|
2493 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2494 SLOT(constTypeRefSlot(const Template<Class const &> &)))); |
|
2495 QVERIFY(oldobject.connect(&oldobject, |
|
2496 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2497 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2498 QVERIFY(oldobject.connect(&oldobject, |
|
2499 SIGNAL(typeConstRefSignal(Template<const Class &> const &)), |
|
2500 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2501 QVERIFY(oldobject.connect(&oldobject, |
|
2502 SIGNAL(typeConstRefSignal(Template<Class const &> const &)), |
|
2503 SLOT(constTypeRefSlot(Template<Class const &> const &)))); |
|
2504 |
|
2505 // this fails in older versions, but passes now due to proper normalizing |
|
2506 QVERIFY(oldobject.connect(&oldobject, |
|
2507 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2508 SLOT(typeConstRefSlot(const Template<const Class &> &)))); |
|
2509 // this fails in older versions, but passes now due to proper normalizing |
|
2510 QVERIFY(oldobject.connect(&oldobject, |
|
2511 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2512 SLOT(typeConstRefSlot(const Template<Class const &> &)))); |
|
2513 // this fails in older versions, but passes now due to proper normalizing |
|
2514 QVERIFY(oldobject.connect(&oldobject, |
|
2515 SIGNAL(typeConstRefSignal(const Template<const Class &> &)), |
|
2516 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2517 QVERIFY(oldobject.connect(&oldobject, |
|
2518 SIGNAL(typeConstRefSignal(Template<const Class &> const &)), |
|
2519 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2520 QVERIFY(oldobject.connect(&oldobject, |
|
2521 SIGNAL(typeConstRefSignal(Template<Class const &> const &)), |
|
2522 SLOT(typeConstRefSlot(Template<Class const &> const &)))); |
|
2523 |
|
2524 QVERIFY(object.connect(&object, |
|
2525 SIGNAL(typePointerConstRefSignal(Class*const&)), |
|
2526 SLOT(typePointerConstRefSlot(Class*const&)))); |
|
2527 QVERIFY(object.connect(&object, |
|
2528 SIGNAL(typePointerConstRefSignal(Class*const&)), |
|
2529 SLOT(typePointerConstRefSlot(Class*)))); |
|
2530 QVERIFY(object.connect(&object, |
|
2531 SIGNAL(typePointerConstRefSignal(Class*)), |
|
2532 SLOT(typePointerConstRefSlot(Class*const&)))); |
|
2533 QVERIFY(object.connect(&object, |
|
2534 SIGNAL(typePointerConstRefSignal(Class*)), |
|
2535 SLOT(typePointerConstRefSlot(Class*)))); |
|
2536 |
|
2537 QVERIFY( connect(&object, SIGNAL(constTemplateSignal1(Template <int>)), |
|
2538 &object , SLOT(constTemplateSlot1 (Template<int > ) ) )); |
|
2539 QVERIFY( connect(&object, SIGNAL(constTemplateSignal1(Template <int>)), |
|
2540 &object , SLOT(constTemplateSlot2 (Template<int > ) ) )); |
|
2541 QVERIFY( connect(&object, SIGNAL(constTemplateSignal2(Template <const int>)), |
|
2542 &object , SLOT(constTemplateSlot3(Template<int const > ) ) )); |
|
2543 |
|
2544 //type does not match |
|
2545 QTest::ignoreMessage(QtWarningMsg, "QObject::connect: Incompatible sender/receiver arguments\n" |
|
2546 " NormalizeObject::constTemplateSignal1(Template<int>) --> NormalizeObject::constTemplateSlot3(Template<const int>)"); |
|
2547 QVERIFY(!connect(&object, SIGNAL(constTemplateSignal1(Template <int>)), |
|
2548 &object , SLOT(constTemplateSlot3(Template<int const> ) ) )); |
2337 } |
2549 } |
2338 |
2550 |
2339 class SiblingDeleter : public QObject |
2551 class SiblingDeleter : public QObject |
2340 { |
2552 { |
2341 public: |
2553 public: |