From 94884246d445fb3e702ac8c4d4bb432768e61b61 Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Sat, 25 Aug 2018 18:23:04 +0300 Subject: QCommandLineParser: Ensure that an option text ends with a newline Before this change we inserted newline only if an option has a description and ended up with an arbitrary long line with all options. [ChangeLog][QtCore][QCommandLineParser] Fixed a bug that caused the help output to show two options or more in the same line if the options didn't have a description. Task-number: QTBUG-70174 Change-Id: Id54b9ae13ee596869e4dc14e09301aea19eed2f8 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- .../qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp | 1 + tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp index 30c7b1bf69..b9bcecd607 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp @@ -53,6 +53,7 @@ int main(int argc, char *argv[]) parser.addOption(QCommandLineOption("load", "Load file from URL.", "url")); parser.addOption(QCommandLineOption(QStringList() << "o" << "output", "Set output file.", "file")); parser.addOption(QCommandLineOption("D", "Define macro.", "key=value")); + parser.addOption(QCommandLineOption("long-option")); // An option with a longer description, to test wrapping QCommandLineOption noImplicitIncludesOption(QStringList() << QStringLiteral("n") << QStringLiteral("no-implicit-includes")); diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index 527e07593c..4b362a9825 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -536,6 +536,7 @@ static const char expectedOptionsHelp[] = " --load Load file from URL.\n" " -o, --output Set output file.\n" " -D Define macro.\n" + " --long-option\n" " -n, --no-implicit-includes Disable magic generation of implicit\n" " #include-directives.\n" " --newline This is an option with a rather long\n" -- cgit v1.2.3