~ubuntu-branches/ubuntu/trusty/kdepimlibs/trusty

« back to all changes in this revision

Viewing changes to kpimutils/tests/testemail.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg, Rohan Garg, Philip Muškovac
  • Date: 2013-11-23 17:36:44 UTC
  • mfrom: (1.1.102)
  • Revision ID: package-import@ubuntu.com-20131123173644-p5ow94192ezsny8g
Tags: 4:4.11.80-0ubuntu1
[ Rohan Garg ]
* New upstream beta release
  - Bump akonadi requirement to 1.10.45
  - Update install files
  - Update symbols

[ Philip Muškovac ]
* kdepimlibs-dev/-dbg breaks/replaces kdepim-runtime/-dbg (<< 4:4.11.80)

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
  QTest::addColumn<EmailParseResult>( "expErrorCode" );
124
124
 
125
125
  // Too many @'s
126
 
  QTest::newRow( "" ) << "matt@@fruitsalad.org" << TooManyAts;
 
126
  QTest::newRow( "1" ) << "matt@@fruitsalad.org" << TooManyAts;
127
127
 
128
128
  // Too few @'s
129
 
  QTest::newRow( "" ) << "mattfruitsalad.org" << TooFewAts;
 
129
  QTest::newRow( "2" ) << "mattfruitsalad.org" << TooFewAts;
130
130
 
131
131
  // An empty string
132
 
  QTest::newRow( "" ) << QString() << AddressEmpty;
 
132
  QTest::newRow( "3" ) << QString() << AddressEmpty;
133
133
 
134
134
  // email address starting with a @
135
 
  QTest::newRow( "" ) << "@mattfruitsalad.org" << MissingLocalPart;
 
135
  QTest::newRow( "4" ) << "@mattfruitsalad.org" << MissingLocalPart;
136
136
 
137
137
  // make sure that starting @ and an additional @ in the same email address don't conflict
138
138
  // trap the starting @ first and break
139
 
  QTest::newRow( "" ) << "@matt@fruitsalad.org" << MissingLocalPart;
 
139
  QTest::newRow( "5" ) << "@matt@fruitsalad.org" << MissingLocalPart;
140
140
 
141
141
  // email address ending with a @
142
 
  QTest::newRow( "" ) << "mattfruitsalad.org@" << MissingDomainPart;
 
142
  QTest::newRow( "6" ) << "mattfruitsalad.org@" << MissingDomainPart;
143
143
 
144
144
  // make sure that ending with@ and an additional @ in the email address don't conflict
145
 
  QTest::newRow( "" ) << "matt@fruitsalad.org@" << MissingDomainPart;
 
145
  QTest::newRow( "7" ) << "matt@fruitsalad.org@" << MissingDomainPart;
146
146
 
147
147
  // unbalanced Parens
148
 
  QTest::newRow( "" ) << "mattjongel)@fruitsalad.org" << UnbalancedParens;
 
148
  QTest::newRow( "8" ) << "mattjongel)@fruitsalad.org" << UnbalancedParens;
149
149
 
150
150
  // unbalanced Parens the other way around
151
 
  QTest::newRow( "" ) << "mattjongel(@fruitsalad.org" << UnbalancedParens;
 
151
  QTest::newRow( "9" ) << "mattjongel(@fruitsalad.org" << UnbalancedParens;
152
152
 
153
153
  // Correct parens just to make sure it works
154
 
  QTest::newRow( "" ) << "matt(jongel)@fruitsalad.org" << AddressOk;
 
154
  QTest::newRow( "10" ) << "matt(jongel)@fruitsalad.org" << AddressOk;
155
155
 
156
156
  // Check that anglebrackets are closed
157
 
  QTest::newRow( "" ) << "matt douhan<matt@fruitsalad.org" << UnclosedAngleAddr;
 
157
  QTest::newRow( "11" ) << "matt douhan<matt@fruitsalad.org" << UnclosedAngleAddr;
158
158
 
159
159
  // Check that angle brackets are closed the other way around
160
 
  QTest::newRow( "" ) << "matt douhan>matt@fruitsalad.org" << UnopenedAngleAddr;
 
160
  QTest::newRow( "12" ) << "matt douhan>matt@fruitsalad.org" << UnopenedAngleAddr;
161
161
 
162
162
  // Check that angle brackets are closed the other way around, and anglebrackets in domainpart
163
163
  // instead of local part
164
 
  QTest::newRow( "" ) << "matt douhan matt@<fruitsalad.org" << UnclosedAngleAddr;
 
164
  QTest::newRow( "13" ) << "matt douhan matt@<fruitsalad.org" << UnclosedAngleAddr;
165
165
 
166
166
  // check that a properly formated anglebrackets situation is OK
167
 
  QTest::newRow( "" ) << "matt douhan<matt@fruitsalad.org>" << AddressOk;
 
167
  QTest::newRow( "14" ) << "matt douhan<matt@fruitsalad.org>" << AddressOk;
168
168
 
169
169
  // a full email address with comments angle brackets and the works should be valid too
170
 
  QTest::newRow( "" ) << "Matt (jongel) Douhan <matt@fruitsalad.org>" << AddressOk;
 
170
  QTest::newRow( "15" ) << "Matt (jongel) Douhan <matt@fruitsalad.org>" << AddressOk;
171
171
 
172
172
  // Double quotes
173
 
  QTest::newRow( "" ) << "\"Matt Douhan\" <matt@fruitsalad.org>" << AddressOk;
 
173
  QTest::newRow( "16" ) << "\"Matt Douhan\" <matt@fruitsalad.org>" << AddressOk;
174
174
 
175
175
  // Double quotes inside parens
176
 
  QTest::newRow( "" ) << "Matt (\"jongel\") Douhan <matt@fruitsalad.org>" << AddressOk;
 
176
  QTest::newRow( "17" ) << "Matt (\"jongel\") Douhan <matt@fruitsalad.org>" << AddressOk;
177
177
 
178
178
  // DOuble quotes not closed
179
 
  QTest::newRow( "" ) << "Matt \"jongel Douhan <matt@fruitsalad.org>" << UnbalancedQuote;
 
179
  QTest::newRow( "18" ) << "Matt \"jongel Douhan <matt@fruitsalad.org>" << UnbalancedQuote;
180
180
 
181
181
  // Parens inside double quotes
182
 
  QTest::newRow( "" ) << "Matt \"(jongel)\" Douhan <matt@fruitsalad.org>" << AddressOk;
 
182
  QTest::newRow( "19" ) << "Matt \"(jongel)\" Douhan <matt@fruitsalad.org>" << AddressOk;
183
183
 
184
184
  // Space in email
185
 
  QTest::newRow( "" ) << "Matt Douhan < matt@fruitsalad.org >" << AddressOk;
 
185
  QTest::newRow( "20" ) << "Matt Douhan < matt@fruitsalad.org >" << AddressOk;
186
186
 
187
187
  // @ is allowed inisde doublequotes
188
 
  QTest::newRow( "" ) << "\"matt@jongel\" <matt@fruitsalad.org>" << AddressOk;
 
188
  QTest::newRow( "21" ) << "\"matt@jongel\" <matt@fruitsalad.org>" << AddressOk;
189
189
 
190
190
  // anglebrackets inside dbl quotes
191
 
  QTest::newRow( "" ) << "\"matt<blah blah>\" <matt@fruitsalad.org>" << AddressOk;
 
191
  QTest::newRow( "22" ) << "\"matt<blah blah>\" <matt@fruitsalad.org>" << AddressOk;
192
192
 
193
193
  // a , inside a double quoted string is OK, how do I know this? well Ingo says so
194
194
  // and it makes sense since it is also a separator of email addresses
195
 
  QTest::newRow( "" ) << "\"Douhan, Matt\" <matt@fruitsalad.org>" << AddressOk;
 
195
  QTest::newRow( "23" ) << "\"Douhan, Matt\" <matt@fruitsalad.org>" << AddressOk;
196
196
 
197
197
  // Domains literals also need to work
198
 
  QTest::newRow( "" ) << "Matt Douhan <matt@[123.123.123.123]>" << AddressOk;
 
198
  QTest::newRow( "24" ) << "Matt Douhan <matt@[123.123.123.123]>" << AddressOk;
199
199
 
200
200
  // Typo in domain literal address
201
 
  QTest::newRow( "" ) << "Matt Douhan <matt@[123.123.123,123]>" << UnexpectedComma;
 
201
  QTest::newRow( "25" ) << "Matt Douhan <matt@[123.123.123,123]>" << UnexpectedComma;
202
202
 
203
203
  // Some more insane tests but still valid so they must work
204
 
  QTest::newRow( "" ) << "Matt Douhan <\"m@att\"@jongel.com>" << AddressOk;
 
204
  QTest::newRow( "26" ) << "Matt Douhan <\"m@att\"@jongel.com>" << AddressOk;
205
205
 
206
206
  // BUG 99657
207
 
  QTest::newRow( "" ) << "matt@jongel.fibbel.com" << AddressOk;
 
207
  QTest::newRow( "27" ) << "matt@jongel.fibbel.com" << AddressOk;
208
208
 
209
209
  // BUG 98720
210
 
  QTest::newRow( "" ) << "mailto:@mydomain" << DisallowedChar;
 
210
  QTest::newRow( "28" ) << "mailto:@mydomain" << DisallowedChar;
211
211
 
212
212
  // correct error msg when a comma is inside <>
213
 
  QTest::newRow( "" ) << "Matt Douhan <matt@fruitsalad,org>" << UnexpectedComma;
 
213
  QTest::newRow( "29" ) << "Matt Douhan <matt@fruitsalad,org>" << UnexpectedComma;
214
214
 
215
215
  //several commentlevels
216
 
  QTest::newRow( "" ) << "Matt Douhan (hey(jongel)fibbel) <matt@fruitsalad.org>" << AddressOk;
 
216
  QTest::newRow( "30" ) << "Matt Douhan (hey(jongel)fibbel) <matt@fruitsalad.org>" << AddressOk;
217
217
 
218
218
  // several comment levels and one (the outer) being unbalanced
219
 
  QTest::newRow( "" ) << "Matt Douhan (hey(jongel)fibbel <matt@fruitsalad.org>"
 
219
  QTest::newRow( "31" ) << "Matt Douhan (hey(jongel)fibbel <matt@fruitsalad.org>"
220
220
                      << UnbalancedParens;
221
221
 
222
222
  // several comment levels and one (the inner) being unbalanced
223
 
  QTest::newRow( "" ) << "Matt Douhan (hey(jongelfibbel) <matt@fruitsalad.org>"
 
223
  QTest::newRow( "32" ) << "Matt Douhan (hey(jongelfibbel) <matt@fruitsalad.org>"
224
224
                      << UnbalancedParens;
225
225
 
226
226
  // an error inside a double quote is no error
227
 
  QTest::newRow( "" ) << "Matt Douhan \"(jongel\" <matt@fruitsalad.org>"
 
227
  QTest::newRow( "33" ) << "Matt Douhan \"(jongel\" <matt@fruitsalad.org>"
228
228
                      << AddressOk;
229
229
 
230
230
  // inside a quoted string double quotes are only allowed in pairs as per rfc2822
231
 
  QTest::newRow( "" ) << "Matt Douhan \"jongel\"fibbel\" <matt@fruitsalad.org>"
 
231
  QTest::newRow( "34" ) << "Matt Douhan \"jongel\"fibbel\" <matt@fruitsalad.org>"
232
232
                      << UnbalancedQuote;
233
233
 
234
234
  // a questionmark is valid in an atom
235
 
  QTest::newRow( "" ) << "Matt? <matt@fruitsalad.org>" << AddressOk;
 
235
  QTest::newRow( "35" ) << "Matt? <matt@fruitsalad.org>" << AddressOk;
236
236
 
237
237
  // weird but OK
238
 
  QTest::newRow( "" ) << "\"testing, \\\"testing\" <matt@fruitsalad.org>"
 
238
  QTest::newRow( "36" ) << "\"testing, \\\"testing\" <matt@fruitsalad.org>"
239
239
                      << AddressOk;
240
240
 
241
241
  // escape a quote to many to see if it makes it invalid
242
 
  QTest::newRow( "" ) << "\"testing, \\\"testing\\\" <matt@fruitsalad.org>"
 
242
  QTest::newRow( "37" ) << "\"testing, \\\"testing\\\" <matt@fruitsalad.org>"
243
243
                      << UnbalancedQuote;
244
244
 
245
245
  // escape a parens and thus make a comma appear
246
 
  QTest::newRow( "" ) << "Matt (jongel, fibbel\\) <matt@fruitsalad.org>"
 
246
  QTest::newRow( "38" ) << "Matt (jongel, fibbel\\) <matt@fruitsalad.org>"
247
247
                      << UnbalancedParens;
248
248
 
249
249
  // several errors inside doublequotes
250
 
  QTest::newRow( "" ) << "Matt \"(jongel,\\\" < fibbel\\)\" <matt@fruitsalad.org>"
 
250
  QTest::newRow( "39" ) << "Matt \"(jongel,\\\" < fibbel\\)\" <matt@fruitsalad.org>"
251
251
                      << AddressOk;
252
252
 
253
253
  // BUG 105705
254
 
  QTest::newRow( "" ) << "matt-@fruitsalad.org" << AddressOk;
 
254
  QTest::newRow( "40" ) << "matt-@fruitsalad.org" << AddressOk;
255
255
 
256
256
  // underscore at the end of local part
257
 
  QTest::newRow( "" ) << "matt_@fruitsalad.org" << AddressOk;
 
257
  QTest::newRow( "41" ) << "matt_@fruitsalad.org" << AddressOk;
258
258
 
259
259
  // how about ( comment ) in the domain part
260
 
  QTest::newRow( "" ) << "matt_@(this is a cool host)fruitsalad.org" << AddressOk;
 
260
  QTest::newRow( "42" ) << "matt_@(this is a cool host)fruitsalad.org" << AddressOk;
261
261
 
262
262
  // To quote rfc2822 the test below is aesthetically displeasing, but perfectly legal.
263
 
  QTest::newRow( "" ) << "Pete(A wonderful \\) chap) <pete(his account)@silly.test(his host)>"
 
263
  QTest::newRow( "43" ) << "Pete(A wonderful \\) chap) <pete(his account)@silly.test(his host)>"
264
264
                      << AddressOk;
265
265
 
266
266
  // quoted pair or not quoted pair
267
 
  QTest::newRow( "" ) << "\"jongel '\\\" fibbel\" <matt@fruitsalad.org>" << AddressOk;
268
 
  QTest::newRow( "" ) << "\"jongel '\" fibbel\" <matt@fruitsalad.org>" << UnbalancedQuote;
 
267
  QTest::newRow( "44" ) << "\"jongel '\\\" fibbel\" <matt@fruitsalad.org>" << AddressOk;
 
268
  QTest::newRow( "45" ) << "\"jongel '\" fibbel\" <matt@fruitsalad.org>" << UnbalancedQuote;
269
269
 
270
270
  // full atext support according to rfc2822
271
 
  QTest::newRow( "" ) << "!matt@fruitsalad.org" << AddressOk;
272
 
  QTest::newRow( "" ) << "#matt@fruitsalad.org" << AddressOk;
273
 
  QTest::newRow( "" ) << "$matt@fruitsalad.org" << AddressOk;
274
 
  QTest::newRow( "" ) << "%matt@fruitsalad.org" << AddressOk;
275
 
  QTest::newRow( "" ) << "&matt@fruitsalad.org" << AddressOk;
276
 
  QTest::newRow( "" ) << "'matt@fruitsalad.org" << AddressOk;
277
 
  QTest::newRow( "" ) << "*matt@fruitsalad.org" << AddressOk;
278
 
  QTest::newRow( "" ) << "+matt@fruitsalad.org" << AddressOk;
279
 
  QTest::newRow( "" ) << "/matt@fruitsalad.org" << AddressOk;
280
 
  QTest::newRow( "" ) << "=matt@fruitsalad.org" << AddressOk;
281
 
  QTest::newRow( "" ) << "?matt@fruitsalad.org" << AddressOk;
282
 
  QTest::newRow( "" ) << "^matt@fruitsalad.org" << AddressOk;
283
 
  QTest::newRow( "" ) << "_matt@fruitsalad.org" << AddressOk;
284
 
  QTest::newRow( "" ) << "-matt@fruitsalad.org" << AddressOk;
285
 
  QTest::newRow( "" ) << "`matt@fruitsalad.org" << AddressOk;
286
 
  QTest::newRow( "" ) << "{matt@fruitsalad.org" << AddressOk;
287
 
  QTest::newRow( "" ) << "|matt@fruitsalad.org" << AddressOk;
288
 
  QTest::newRow( "" ) << "}matt@fruitsalad.org" << AddressOk;
289
 
  QTest::newRow( "" ) << "~matt@fruitsalad.org" << AddressOk;
290
 
  QTest::newRow( "" ) << "matt%matt@fruitsalad.org" << AddressOk;
 
271
  QTest::newRow( "46" ) << "!matt@fruitsalad.org" << AddressOk;
 
272
  QTest::newRow( "47" ) << "#matt@fruitsalad.org" << AddressOk;
 
273
  QTest::newRow( "48" ) << "$matt@fruitsalad.org" << AddressOk;
 
274
  QTest::newRow( "49" ) << "%matt@fruitsalad.org" << AddressOk;
 
275
  QTest::newRow( "50" ) << "&matt@fruitsalad.org" << AddressOk;
 
276
  QTest::newRow( "51" ) << "'matt@fruitsalad.org" << AddressOk;
 
277
  QTest::newRow( "52" ) << "*matt@fruitsalad.org" << AddressOk;
 
278
  QTest::newRow( "53" ) << "+matt@fruitsalad.org" << AddressOk;
 
279
  QTest::newRow( "54" ) << "/matt@fruitsalad.org" << AddressOk;
 
280
  QTest::newRow( "55" ) << "=matt@fruitsalad.org" << AddressOk;
 
281
  QTest::newRow( "56" ) << "?matt@fruitsalad.org" << AddressOk;
 
282
  QTest::newRow( "57" ) << "^matt@fruitsalad.org" << AddressOk;
 
283
  QTest::newRow( "58" ) << "_matt@fruitsalad.org" << AddressOk;
 
284
  QTest::newRow( "59" ) << "-matt@fruitsalad.org" << AddressOk;
 
285
  QTest::newRow( "60" ) << "`matt@fruitsalad.org" << AddressOk;
 
286
  QTest::newRow( "61" ) << "{matt@fruitsalad.org" << AddressOk;
 
287
  QTest::newRow( "62" ) << "|matt@fruitsalad.org" << AddressOk;
 
288
  QTest::newRow( "63" ) << "}matt@fruitsalad.org" << AddressOk;
 
289
  QTest::newRow( "64" ) << "~matt@fruitsalad.org" << AddressOk;
 
290
  QTest::newRow( "65" ) << "matt%matt@fruitsalad.org" << AddressOk;
291
291
 
292
292
  //bug 105405
293
 
  QTest::newRow( "" ) << "[foobar] <matt@fruitsalad.org>" << InvalidDisplayName;
294
 
  QTest::newRow( "" ) << "matt \"[foobar]\" Douhan <matt@fruitsalad.org>" << AddressOk;
 
293
  QTest::newRow( "66" ) << "[foobar] <matt@fruitsalad.org>" << InvalidDisplayName;
 
294
  QTest::newRow( "67" ) << "matt \"[foobar]\" Douhan <matt@fruitsalad.org>" << AddressOk;
295
295
 
296
 
  QTest::newRow( "" ) << "Matt Douhan <matt\"@@\"fruitsalad.org>" << TooFewAts;
 
296
  QTest::newRow( "68" ) << "Matt Douhan <matt\"@@\"fruitsalad.org>" << TooFewAts;
297
297
 
298
298
  QTest::newRow( "# in domain" ) << "dm3tt@db0zdf.#rpl.deu.eu" << AddressOk;
 
299
  QTest::newRow( "dot at the end" ) << "msadmin@guug.de." << AddressOk;
 
300
  QTest::newRow( "dot at the end with brackets" ) << "Martin Schulte <martin.schulte@guug.de.>" << AddressOk;
 
301
 
 
302
  //TODO this should be a valid email address, but the checking for missing dots broke it.
 
303
  // QTest::newRow( "valid email address without dots" ) << "user@localhost" << AddressOk;
299
304
}
300
305
 
301
306
void EMailTest::testIsValidAddressList()
313
318
  QTest::addColumn<EmailParseResult>( "expErrorCode" );
314
319
 
315
320
  //bug  139477
316
 
  QTest::newRow( "" ) << "martin.schulte@guug.de, msadmin@guug.de,"
317
 
                         " msnewsletter@guug.de" << AddressOk;
318
 
  QTest::newRow( "" ) << "martin.schulte@guug.de; msadmin@guug.de;"
319
 
                         " msnewsletter@guug.de" << AddressOk;
320
 
  QTest::newRow( "" ) << "martin.schulte@guug.de, msadmin@guug.de.,"
321
 
                         " msnewsletter@guug.de" << AddressOk;
322
 
  QTest::newRow( "" ) << "Martin Schulte <martin.schulte@guug.de>,"
 
321
  QTest::newRow( "1" ) << "martin.schulte@guug.de, msadmin@guug.de,"
 
322
                         " msnewsletter@guug.de" << AddressOk;
 
323
  QTest::newRow( "2" ) << "martin.schulte@guug.de; msadmin@guug.de;"
 
324
                         " msnewsletter@guug.de" << AddressOk;
 
325
  QTest::newRow( "3" ) << "martin.schulte@guug.de, msadmin@guug.de.,"
 
326
                         " msnewsletter@guug.de" << AddressOk;
 
327
  QTest::newRow( "4" ) << "Martin Schulte <martin.schulte@guug.de>,"
323
328
                         " MS Admin <msadmin@guug.de>, MS News <msnewsletter@guug.de>"
324
329
                      << AddressOk;
325
 
  QTest::newRow( "" ) << "Martin Schulte <martin.schulte@guug.de>;"
 
330
  QTest::newRow( "5" ) << "Martin Schulte <martin.schulte@guug.de>;"
326
331
                         " MS Admin <msadmin@guug.de>; MS News <msnewsletter@guug.de>"
327
332
                      << AddressOk;
328
 
  QTest::newRow( "" ) << "Martin Schulte <martin.schulte@guug.de.>,"
 
333
  QTest::newRow( "6" ) << "Martin Schulte <martin.schulte@guug.de.>,"
329
334
                         " MS Admin <msadmin@guug.de>, MS News <msnewsletter@guug.de>"
330
335
                      << AddressOk;
331
336
 
424
429
  QTest::addColumn<QString>( "input" );
425
430
  QTest::addColumn<QString>( "expResult" );
426
431
 
427
 
  QTest::newRow( "" ) << "matt@fruitsalad.org" << "matt@fruitsalad.org";
428
 
  QTest::newRow( "" ) << "Matt Douhan <matt@fruitsalad.org>" << "matt@fruitsalad.org";
429
 
  QTest::newRow( "" ) << "\"Matt Douhan <blah blah>\" <matt@fruitsalad.org>"
430
 
                      << "matt@fruitsalad.org";
431
 
  QTest::newRow( "" ) << "\"Matt <blah blah>\" <matt@fruitsalad.org>"
432
 
                      << "matt@fruitsalad.org";
433
 
  QTest::newRow( "" ) << "Matt Douhan (jongel) <matt@fruitsalad.org"
434
 
                      << QString();
435
 
  QTest::newRow( "" ) << "Matt Douhan (m@tt) <matt@fruitsalad.org>"
436
 
                      << "matt@fruitsalad.org";
437
 
  QTest::newRow( "" ) << "\"Douhan, Matt\" <matt@fruitsalad.org>"
438
 
                      << "matt@fruitsalad.org";
439
 
  QTest::newRow( "" ) << "\"Matt Douhan (m@tt)\" <matt@fruitsalad.org>"
440
 
                      << "matt@fruitsalad.org";
441
 
  QTest::newRow( "" ) << "\"Matt Douhan\" (matt <matt@fruitsalad.org>"
442
 
                      << QString();
443
 
  QTest::newRow( "" ) << "Matt Douhan <matt@[123.123.123.123]>"
 
432
  QTest::newRow( "1" ) << "matt@fruitsalad.org" << "matt@fruitsalad.org";
 
433
  QTest::newRow( "2" ) << "Matt Douhan <matt@fruitsalad.org>" << "matt@fruitsalad.org";
 
434
  QTest::newRow( "3" ) << "\"Matt Douhan <blah blah>\" <matt@fruitsalad.org>"
 
435
                      << "matt@fruitsalad.org";
 
436
  QTest::newRow( "4" ) << "\"Matt <blah blah>\" <matt@fruitsalad.org>"
 
437
                      << "matt@fruitsalad.org";
 
438
  QTest::newRow( "5" ) << "Matt Douhan (jongel) <matt@fruitsalad.org"
 
439
                      << QString();
 
440
  QTest::newRow( "6" ) << "Matt Douhan (m@tt) <matt@fruitsalad.org>"
 
441
                      << "matt@fruitsalad.org";
 
442
  QTest::newRow( "7" ) << "\"Douhan, Matt\" <matt@fruitsalad.org>"
 
443
                      << "matt@fruitsalad.org";
 
444
  QTest::newRow( "8" ) << "\"Matt Douhan (m@tt)\" <matt@fruitsalad.org>"
 
445
                      << "matt@fruitsalad.org";
 
446
  QTest::newRow( "9" ) << "\"Matt Douhan\" (matt <matt@fruitsalad.org>"
 
447
                      << QString();
 
448
  QTest::newRow( "10" ) << "Matt Douhan <matt@[123.123.123.123]>"
444
449
                      << "matt@[123.123.123.123]";
445
 
  QTest::newRow( "" ) << "dm3tt@db0zdf.#rpl.deu.eu" << "dm3tt@db0zdf.#rpl.deu.eu";
 
450
  QTest::newRow( "11" ) << "dm3tt@db0zdf.#rpl.deu.eu" << "dm3tt@db0zdf.#rpl.deu.eu";
446
451
 
447
452
 
448
453
}
461
466
  QTest::addColumn<QStringList>( "expResult" );
462
467
 
463
468
  QTest::newRow( "" ) << "kloecker@kde.org (Kloecker, Ingo)"
464
 
                      << ( QStringList() << "kloecker@kde.org (Kloecker, Ingo)" );
 
469
                      << ( QStringList() << QLatin1String("kloecker@kde.org (Kloecker, Ingo)") );
465
470
  QTest::newRow( "" ) << "Matt Douhan <matt@fruitsalad.org>, Foo Bar <foo@bar.com>"
466
471
                      << ( QStringList()
467
 
                           << "Matt Douhan <matt@fruitsalad.org>"
468
 
                           << "Foo Bar <foo@bar.com>" );
 
472
                           << QLatin1String("Matt Douhan <matt@fruitsalad.org>")
 
473
                           << QLatin1String("Foo Bar <foo@bar.com>") );
469
474
  QTest::newRow( "" ) << "\"Matt, Douhan\" <matt@fruitsalad.org>, Foo Bar <foo@bar.com>"
470
475
                      << ( QStringList()
471
 
                           << "\"Matt, Douhan\" <matt@fruitsalad.org>"
472
 
                           << "Foo Bar <foo@bar.com>" );
 
476
                           << QLatin1String("\"Matt, Douhan\" <matt@fruitsalad.org>")
 
477
                           << QLatin1String("Foo Bar <foo@bar.com>") );
473
478
  QTest::newRow( "" ) << "\"Lastname\\, Firstname\" <firstname.lastname@example.com>"
474
479
                      << ( QStringList()
475
 
                           << "\"Lastname\\, Firstname\" <firstname.lastname@example.com>" );
 
480
                           << QLatin1String("\"Lastname\\, Firstname\" <firstname.lastname@example.com>") );
476
481
}
477
482
 
478
483
void EMailTest::testNormalizeAddressesAndEncodeIDNs()