1 /************************************************************************
\r
3 ** Copyright (C) 2010 Strahinja Markovic
\r
5 ** This file is part of FlightCrew.
\r
7 ** FlightCrew is free software: you can redistribute it and/or modify
\r
8 ** it under the terms of the GNU Lesser General Public License as published
\r
9 ** by the Free Software Foundation, either version 3 of the License, or
\r
10 ** (at your option) any later version.
\r
12 ** FlightCrew is distributed in the hope that it will be useful,
\r
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 ** GNU Lesser General Public License for more details.
\r
17 ** You should have received a copy of the GNU Lesser General Public License
\r
18 ** along with FlightCrew. If not, see <http://www.gnu.org/licenses/>.
\r
20 *************************************************************************/
\r
22 #include <stdafx_tests.h>
\r
23 #include "Validators/Xhtml/SatisfiesXhtmlSchema.h"
\r
26 using namespace FlightCrew;
\r
28 TEST( SatisfiesXhtmlSchemaTest, DoesntSatisfySchema )
\r
30 SatisfiesXhtmlSchema validator;
\r
31 std::vector<Result> results = validator.ValidateFile(
\r
32 "test_data/xhtml_tests/SatisfiesXhtmlSchema_DoesntSatisfySchema.xhtml" );
\r
34 ASSERT_EQ( results.size(), 1U );
\r
35 EXPECT_EQ( results[ 0 ].GetResultId(), ERROR_SCHEMA_NOT_SATISFIED );
\r
36 EXPECT_EQ( results[ 0 ].GetErrorLine(), 12 );
\r
37 EXPECT_EQ( results[ 0 ].GetErrorColumn(), 62 );
\r
40 TEST( SatisfiesXhtmlSchemaTest, DoesntSatisfySchemaNoDtd )
\r
42 SatisfiesXhtmlSchema validator;
\r
43 std::vector<Result> results = validator.ValidateFile(
\r
44 "test_data/xhtml_tests/SatisfiesXhtmlSchema_DoesntSatisfySchemaNoDtd.xhtml" );
\r
46 ASSERT_EQ( results.size(), 4U );
\r
47 EXPECT_EQ( results[ 0 ].GetResultId(), ERROR_SCHEMA_NOT_SATISFIED );
\r
48 EXPECT_EQ( results[ 0 ].GetErrorLine(), 10 );
\r
49 EXPECT_EQ( results[ 0 ].GetErrorColumn(), 32 );
\r
51 EXPECT_EQ( results[ 1 ].GetResultId(), ERROR_SCHEMA_NOT_SATISFIED );
\r
52 EXPECT_EQ( results[ 1 ].GetErrorLine(), 11 );
\r
53 EXPECT_EQ( results[ 1 ].GetErrorColumn(), 61 );
\r
55 EXPECT_EQ( results[ 2 ].GetResultId(), ERROR_SCHEMA_NOT_SATISFIED );
\r
56 EXPECT_EQ( results[ 2 ].GetErrorLine(), 12 );
\r
57 EXPECT_EQ( results[ 2 ].GetErrorColumn(), 49 );
\r
59 EXPECT_EQ( results[ 3 ].GetResultId(), ERROR_SCHEMA_NOT_SATISFIED );
\r
60 EXPECT_EQ( results[ 3 ].GetErrorLine(), 64 );
\r
61 EXPECT_EQ( results[ 3 ].GetErrorColumn(), 22 );
\r
65 TEST( SatisfiesXhtmlSchemaTest, XmlError )
\r
67 SatisfiesXhtmlSchema validator;
\r
68 std::vector<Result> results = validator.ValidateFile(
\r
69 "test_data/xhtml_tests/SatisfiesXhtmlSchema_XmlError.xhtml" );
\r
71 ASSERT_EQ( results.size(), 1U );
\r
72 EXPECT_EQ( results[ 0 ].GetResultId(), ERROR_XML_NOT_WELL_FORMED );
\r
73 EXPECT_EQ( results[ 0 ].GetErrorLine(), 4 );
\r
74 EXPECT_EQ( results[ 0 ].GetErrorColumn(), 8 );
\r
77 TEST( SatisfiesXhtmlSchemaTest, SatisfiesSchemaNoDtd )
\r
79 SatisfiesXhtmlSchema validator;
\r
80 std::vector<Result> results = validator.ValidateFile(
\r
81 "test_data/xhtml_tests/SatisfiesXhtmlSchema_SatisfiesSchemaNoDtd.xhtml" );
\r
83 ASSERT_EQ( results.size(), 0U );
\r
86 TEST( SatisfiesXhtmlSchemaTest, SatisfiesSchema )
\r
88 SatisfiesXhtmlSchema validator;
\r
89 std::vector<Result> results = validator.ValidateFile(
\r
90 "test_data/xhtml_tests/SatisfiesXhtmlSchema_SatisfiesSchema.xhtml" );
\r
92 ASSERT_EQ( results.size(), 0U );
\r