~osomon/webbrowser-app/ua-override

« back to all changes in this revision

Viewing changes to tests/unittests/commandline-parser/tst_CommandLineParserTests.cpp

  • Committer: Tarmac
  • Author(s): Olivier Tilloy
  • Date: 2013-08-06 13:27:54 UTC
  • mfrom: (268.3.1 webbrowser-app)
  • Revision ID: tarmac-20130806132754-1n9wv9q02nkcorsu
Cosmetics, for increased consistency across the code base.

Approved by Günter Schwann, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
    {
165
165
        QTest::addColumn<QStringList>("args");
166
166
        QTest::addColumn<QString>("appId");
167
 
 
168
167
        QString BINARY("webbrowser-app");
169
 
 
170
168
        QString APP_ID("webbrowser-app");
171
 
 
172
169
        QTest::newRow("no switch") << (QStringList() << BINARY) << QString();
173
170
        QTest::newRow("empty switch") << (QStringList() << BINARY << "--app-id=") << QString();
174
171
        QTest::newRow("no value switch") << (QStringList() << BINARY << "--app-id") << QString();
179
176
    {
180
177
        QFETCH(QStringList, args);
181
178
        QFETCH(QString, appId);
182
 
 
183
179
        QCOMPARE(CommandLineParser(args).appId(), appId);
184
180
    }
185
181
 
188
184
        QTest::addColumn<QStringList>("args");
189
185
        QTest::addColumn<bool>("webapp");
190
186
        QTest::addColumn<QString>("webappName");
191
 
 
192
187
        QString BINARY("webbrowser-app");
193
188
        QString WEBAPPNAME("MyWebApp");
194
189
        QString WEIRD_WEBAPPNAME("My Web App: Hi All!");
195
190
        QString ESCAPED_WEBAPPNAME(QUrl::toPercentEncoding(WEIRD_WEBAPPNAME));
196
 
 
197
191
        QTest::newRow("no switch") << (QStringList() << BINARY) << false << QString();
198
192
        QTest::newRow("switch only") << (QStringList() << BINARY << "--webapp") << true << QString();
199
193
        QTest::newRow("switch and webapp name") << (QStringList() << BINARY << "--webapp=" + WEBAPPNAME) << true << WEBAPPNAME;
200
194
        QTest::newRow("switch and escaped webapp name") << (QStringList() << BINARY << "--webapp=" + ESCAPED_WEBAPPNAME) << true << WEIRD_WEBAPPNAME;
201
195
        QTest::newRow("switch and escaped webapp name with typo") << (QStringList() << BINARY << "--webdapp=" + ESCAPED_WEBAPPNAME) << false << QString();
202
 
 
203
196
        QTest::newRow("switch uppercase") << (QStringList() << BINARY << "--WEBAPP") << false << QString();
204
197
    }
205
198
 
208
201
        QFETCH(QStringList, args);
209
202
        QFETCH(bool, webapp);
210
203
        QFETCH(QString, webappName);
211
 
 
212
204
        QCOMPARE(CommandLineParser(args).webapp(), webapp);
213
205
        QCOMPARE(CommandLineParser(args).webappName(), webappName);
214
206
    }