Exemplo n.º 1
0
void tst_QXmlSchema::copyConstructor() const
{
    /* Verify that we can take a const reference, and simply do a copy of a default constructed object. */
    {
        const QXmlSchema schema1;
        QXmlSchema schema2(schema1);
    }

    /* Copy twice. */
    {
        const QXmlSchema schema1;
        QXmlSchema schema2(schema1);
        QXmlSchema schema3(schema2);
    }

    /* Verify that copying default values works. */
    {
        const QXmlSchema schema1;
        const QXmlSchema schema2(schema1);
        QCOMPARE(schema2.messageHandler(), schema1.messageHandler());
        QCOMPARE(schema2.uriResolver(), schema1.uriResolver());
        QCOMPARE(schema2.networkAccessManager(), schema1.networkAccessManager());
        QCOMPARE(schema2.isValid(), schema1.isValid());
    }
}
Exemplo n.º 2
0
void tst_QXmlSchema::messageHandlerDefaultValue() const
{
    /* Test that the default value of message handler is not empty. */
    {
        QXmlSchema schema;
        QVERIFY(schema.messageHandler() != static_cast<QAbstractMessageHandler*>(0));
    }
}
Exemplo n.º 3
0
void tst_QXmlSchema::messageHandlerSignature() const
{
    /* Const object. */
    const QXmlSchema schema;

    /* The function should be const. */
    schema.messageHandler();
}
Exemplo n.º 4
0
void tst_QXmlSchema::messageHandler() const
{
    /* Test that we return the message handler that was set. */
    {
        MessageSilencer handler;

        QXmlSchema schema;
        schema.setMessageHandler(&handler);
        QCOMPARE(schema.messageHandler(), static_cast<QAbstractMessageHandler *>(&handler));
    }
}
void tst_QXmlSchemaValidator::messageHandlerDefaultValue() const
{
    /* Test that the default value of message handler is equal to the one from the schema. */
    {
        const QXmlSchema schema;
        const QXmlSchemaValidator validator(schema);
        QVERIFY(validator.messageHandler() == schema.messageHandler());
    }

    /* Test that the default value of network access manager is equal to the one from the schema. */
    {
        QXmlSchema schema;

        MessageSilencer handler;
        schema.setMessageHandler(&handler);

        const QXmlSchemaValidator validator(schema);
        QVERIFY(validator.messageHandler() == schema.messageHandler());
    }
}