Update to Qt6
- New baseline minimum platform is Ubuntu 22.04
- Qt6 requires at least 6.2
- some deprecations may be flagged on later versions (e.g. 6.8)
- CMake requires at least 3.22
- Include build-tests.yml github action to validate builds on mulitple platforms
- QtTest is no longer optional since it easily comes along for the ride with Qt
- Replaced QStringRef in model::SubstitutionField with simple ParserState class
- Removed deprecations up to Qt 6.2
This commit is contained in:
@@ -34,7 +34,7 @@ void TestSubstitutionField::parseValid()
|
||||
// Valid substitution fields (concatenated in single input string)
|
||||
//
|
||||
QString input = "${1234}${abc:=ABC}${x:%08.2f}${y:%08.2f:=12.34}${ADDR2:n}${FüññýßútLæg@lѪmê}${Also_a legal-name}";
|
||||
QStringRef s = &input;
|
||||
model::ParserState s( input );
|
||||
|
||||
model::SubstitutionField f1;
|
||||
QCOMPARE( model::SubstitutionField::parse( s, f1 ), true );
|
||||
@@ -87,49 +87,49 @@ void TestSubstitutionField::parseInvalid()
|
||||
// Ordinary text
|
||||
//
|
||||
QString input5 = "Abcdefg";
|
||||
QStringRef s5 = &input5;
|
||||
model::ParserState s5( input5 );
|
||||
model::SubstitutionField f5;
|
||||
QCOMPARE( model::SubstitutionField::parse( s5, f5 ), false );
|
||||
QCOMPARE( s5, QStringRef( &input5 ) ); // Should not advance string reference
|
||||
QCOMPARE( s5.pos(), model::ParserState( input5 ).pos() ); // Should not advance string reference
|
||||
|
||||
//
|
||||
// Invalid substitution fields (which are treated as ordinary text)
|
||||
//
|
||||
QString input6 = "$abc";
|
||||
QStringRef s6 = &input6;
|
||||
model::ParserState s6( input6 );
|
||||
model::SubstitutionField f6;
|
||||
QCOMPARE( model::SubstitutionField::parse( s6, f6 ), false );
|
||||
QCOMPARE( s6, QStringRef( &input6 ) ); // Should not advance string reference
|
||||
QCOMPARE( s6.pos(), model::ParserState( input6 ).pos() ); // Should not advance string reference
|
||||
|
||||
QString input7 = "${abc";
|
||||
QStringRef s7 = &input7;
|
||||
model::ParserState s7( input7 );
|
||||
model::SubstitutionField f7;
|
||||
QCOMPARE( model::SubstitutionField::parse( s7, f7 ), false );
|
||||
QCOMPARE( s7, QStringRef( &input7 ) ); // Should not advance string reference
|
||||
QCOMPARE( s7.pos(), model::ParserState( input7 ).pos() ); // Should not advance string reference
|
||||
|
||||
QString input8 = "${abc:}";
|
||||
QStringRef s8 = &input8;
|
||||
model::ParserState s8( input8 );
|
||||
model::SubstitutionField f8;
|
||||
QCOMPARE( model::SubstitutionField::parse( s8, f8 ), false );
|
||||
QCOMPARE( s8, QStringRef( &input8 ) ); // Should not advance string reference
|
||||
QCOMPARE( s8.pos(), model::ParserState( input8 ).pos() ); // Should not advance string reference
|
||||
|
||||
// Even though format is invalid, let it slide. Overall structure still good. Format will be ignored.
|
||||
QString input9 = "${abc:%3.2}";
|
||||
QStringRef s9 = &input9;
|
||||
model::ParserState s9( input9 );
|
||||
model::SubstitutionField f9;
|
||||
QCOMPARE( model::SubstitutionField::parse( s9, f9 ), true );
|
||||
|
||||
QString input10 = "${embedded\nnew-line}";
|
||||
QStringRef s10 = &input10;
|
||||
model::ParserState s10( input10 );
|
||||
model::SubstitutionField f10;
|
||||
QCOMPARE( model::SubstitutionField::parse( s10, f10 ), false );
|
||||
QCOMPARE( s10, QStringRef( &input10 ) ); // Should not advance string reference
|
||||
QCOMPARE( s10.pos(), model::ParserState( input10 ).pos() ); // Should not advance string reference
|
||||
|
||||
QString input11 = "${how-about-a\ttab}";
|
||||
QStringRef s11 = &input11;
|
||||
model::ParserState s11( input11 );
|
||||
model::SubstitutionField f11;
|
||||
QCOMPARE( model::SubstitutionField::parse( s11, f11 ), false );
|
||||
QCOMPARE( s11, QStringRef( &input11 ) ); // Should not advance string reference
|
||||
QCOMPARE( s11.pos(), model::ParserState( input11 ).pos() ); // Should not advance string reference
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user