tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   147         schema.setMessageHandler(&handler);
   147         schema.setMessageHandler(&handler);
   148         schema.setUriResolver(&resolver);
   148         schema.setUriResolver(&resolver);
   149         schema.setNetworkAccessManager(&manager);
   149         schema.setNetworkAccessManager(&manager);
   150 
   150 
   151         QXmlSchemaValidator validator(schema);
   151         QXmlSchemaValidator validator(schema);
   152         QCOMPARE(validator.messageHandler(), &handler);
   152         QCOMPARE(validator.messageHandler(), static_cast<QAbstractMessageHandler *>(&handler));
   153         QCOMPARE(validator.uriResolver(), &resolver);
   153         QCOMPARE(validator.uriResolver(), static_cast<const QAbstractUriResolver *>(&resolver));
   154         QCOMPARE(validator.networkAccessManager(), &manager);
   154         QCOMPARE(validator.networkAccessManager(), &manager);
   155     }
   155     }
   156 }
   156 }
   157 
   157 
   158 void tst_QXmlSchemaValidator::constructorQXmlNamePool() const
   158 void tst_QXmlSchemaValidator::constructorQXmlNamePool() const
   382 
   382 
   383         const QXmlSchema schema;
   383         const QXmlSchema schema;
   384         QXmlSchemaValidator validator(schema);
   384         QXmlSchemaValidator validator(schema);
   385 
   385 
   386         validator.setMessageHandler(&handler);
   386         validator.setMessageHandler(&handler);
   387         QCOMPARE(validator.messageHandler(), &handler);
   387         QCOMPARE(validator.messageHandler(), static_cast<QAbstractMessageHandler *>(&handler));
   388     }
   388     }
   389 
   389 
   390     /* Test that we return the message handler that was set, even if the schema changed in between. */
   390     /* Test that we return the message handler that was set, even if the schema changed in between. */
   391     {
   391     {
   392         MessageSilencer handler;
   392         MessageSilencer handler;
   397         validator.setMessageHandler(&handler);
   397         validator.setMessageHandler(&handler);
   398 
   398 
   399         const QXmlSchema schema2;
   399         const QXmlSchema schema2;
   400         validator.setSchema(schema2);
   400         validator.setSchema(schema2);
   401 
   401 
   402         QCOMPARE(validator.messageHandler(), &handler);
   402         QCOMPARE(validator.messageHandler(), static_cast<QAbstractMessageHandler *>(&handler));
   403     }
   403     }
   404 }
   404 }
   405 
   405 
   406 void tst_QXmlSchemaValidator::uriResolverSignature() const
   406 void tst_QXmlSchemaValidator::uriResolverSignature() const
   407 {
   407 {
   450 
   450 
   451         const QXmlSchema schema;
   451         const QXmlSchema schema;
   452         QXmlSchemaValidator validator(schema);
   452         QXmlSchemaValidator validator(schema);
   453 
   453 
   454         validator.setUriResolver(&resolver);
   454         validator.setUriResolver(&resolver);
   455         QCOMPARE(validator.uriResolver(), &resolver);
   455         QCOMPARE(validator.uriResolver(), static_cast<const QAbstractUriResolver *>(&resolver));
   456     }
   456     }
   457 
   457 
   458     /* Test that we return the uri resolver that was set, even if the schema changed in between. */
   458     /* Test that we return the uri resolver that was set, even if the schema changed in between. */
   459     {
   459     {
   460         TestURIResolver resolver;
   460         TestURIResolver resolver;
   465         validator.setUriResolver(&resolver);
   465         validator.setUriResolver(&resolver);
   466 
   466 
   467         const QXmlSchema schema2;
   467         const QXmlSchema schema2;
   468         validator.setSchema(schema2);
   468         validator.setSchema(schema2);
   469 
   469 
   470         QCOMPARE(validator.uriResolver(), &resolver);
   470         QCOMPARE(validator.uriResolver(), static_cast<const QAbstractUriResolver *>(&resolver));
   471     }
   471     }
   472 }
   472 }
   473 
   473 
   474 QTEST_MAIN(tst_QXmlSchemaValidator)
   474 QTEST_MAIN(tst_QXmlSchemaValidator)
   475 
   475