Merge "Merge remote branch 'gerrit/master' into refactor" into refactor
This commit is contained in:
commit
577b26b317
2
.gitignore
vendored
2
.gitignore
vendored
@ -112,8 +112,6 @@ tests/auto/qprocess/fileWriterProcess.txt
|
|||||||
.com.apple.timemachine.supported
|
.com.apple.timemachine.supported
|
||||||
tests/auto/qlibrary/libmylib.so*
|
tests/auto/qlibrary/libmylib.so*
|
||||||
tests/auto/qresourceengine/runtime_resource.rcc
|
tests/auto/qresourceengine/runtime_resource.rcc
|
||||||
tools/qtestlib/chart/chart*
|
|
||||||
tools/qtestlib/updater/updater*
|
|
||||||
tools/activeqt/testcon/testcon.tlb
|
tools/activeqt/testcon/testcon.tlb
|
||||||
translations/*.qm
|
translations/*.qm
|
||||||
translations/*_untranslated.ts
|
translations/*_untranslated.ts
|
||||||
|
@ -267,7 +267,7 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) {
|
|||||||
while ((my $testName, my $testParameters) = each %configtests) {
|
while ((my $testName, my $testParameters) = each %configtests) {
|
||||||
printf " % *s: ", $maxNameLength, $testName; # right aligned, yes/no lines up
|
printf " % *s: ", $maxNameLength, $testName; # right aligned, yes/no lines up
|
||||||
|
|
||||||
my $fatalTest = $testParameters->{"fatal"} // 0;
|
my $fatalTest = $testParameters->{"fatal"};
|
||||||
my $message = $testParameters->{"message"};
|
my $message = $testParameters->{"message"};
|
||||||
|
|
||||||
my $testResult = executeTest($testName);
|
my $testResult = executeTest($testName);
|
||||||
|
@ -1252,8 +1252,6 @@ private:
|
|||||||
|
|
||||||
friend class Box;
|
friend class Box;
|
||||||
|
|
||||||
void setupCategoriesRangeMap();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is the lexical analyzer for regular expressions.
|
This is the lexical analyzer for regular expressions.
|
||||||
*/
|
*/
|
||||||
@ -1293,7 +1291,6 @@ private:
|
|||||||
|
|
||||||
int yyTok; // the last token read
|
int yyTok; // the last token read
|
||||||
bool yyMayCapture; // set this to false to disable capturing
|
bool yyMayCapture; // set this to false to disable capturing
|
||||||
QHash<QByteArray, QPair<int, int> > categoriesRangeMap; // fast lookup hash for xml schema extensions
|
|
||||||
|
|
||||||
friend struct QRegExpMatchState;
|
friend struct QRegExpMatchState;
|
||||||
};
|
};
|
||||||
@ -2735,151 +2732,162 @@ void QRegExpEngine::Box::addAnchorsToEngine(const Box &to) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRegExpEngine::setupCategoriesRangeMap()
|
#ifndef QT_NO_REGEXP_CCLASS
|
||||||
{
|
// fast lookup hash for xml schema extensions
|
||||||
categoriesRangeMap.insert("IsBasicLatin", qMakePair(0x0000, 0x007F));
|
// sorted by name for b-search
|
||||||
categoriesRangeMap.insert("IsLatin-1Supplement", qMakePair(0x0080, 0x00FF));
|
static const struct CategoriesRangeMapEntry {
|
||||||
categoriesRangeMap.insert("IsLatinExtended-A", qMakePair(0x0100, 0x017F));
|
const char name[40];
|
||||||
categoriesRangeMap.insert("IsLatinExtended-B", qMakePair(0x0180, 0x024F));
|
uint first, second;
|
||||||
categoriesRangeMap.insert("IsIPAExtensions", qMakePair(0x0250, 0x02AF));
|
} categoriesRangeMap[] = {
|
||||||
categoriesRangeMap.insert("IsSpacingModifierLetters", qMakePair(0x02B0, 0x02FF));
|
{ "AegeanNumbers", 0x10100, 0x1013F },
|
||||||
categoriesRangeMap.insert("IsCombiningDiacriticalMarks", qMakePair(0x0300, 0x036F));
|
{ "AlphabeticPresentationForms", 0xFB00, 0xFB4F },
|
||||||
categoriesRangeMap.insert("IsGreek", qMakePair(0x0370, 0x03FF));
|
{ "AncientGreekMusicalNotation", 0x1D200, 0x1D24F },
|
||||||
categoriesRangeMap.insert("IsCyrillic", qMakePair(0x0400, 0x04FF));
|
{ "AncientGreekNumbers", 0x10140, 0x1018F },
|
||||||
categoriesRangeMap.insert("IsCyrillicSupplement", qMakePair(0x0500, 0x052F));
|
{ "Arabic", 0x0600, 0x06FF },
|
||||||
categoriesRangeMap.insert("IsArmenian", qMakePair(0x0530, 0x058F));
|
{ "ArabicPresentationForms-A", 0xFB50, 0xFDFF },
|
||||||
categoriesRangeMap.insert("IsHebrew", qMakePair(0x0590, 0x05FF));
|
{ "ArabicPresentationForms-B", 0xFE70, 0xFEFF },
|
||||||
categoriesRangeMap.insert("IsArabic", qMakePair(0x0600, 0x06FF));
|
{ "ArabicSupplement", 0x0750, 0x077F },
|
||||||
categoriesRangeMap.insert("IsSyriac", qMakePair(0x0700, 0x074F));
|
{ "Armenian", 0x0530, 0x058F },
|
||||||
categoriesRangeMap.insert("IsArabicSupplement", qMakePair(0x0750, 0x077F));
|
{ "Arrows", 0x2190, 0x21FF },
|
||||||
categoriesRangeMap.insert("IsThaana", qMakePair(0x0780, 0x07BF));
|
{ "BasicLatin", 0x0000, 0x007F },
|
||||||
categoriesRangeMap.insert("IsDevanagari", qMakePair(0x0900, 0x097F));
|
{ "Bengali", 0x0980, 0x09FF },
|
||||||
categoriesRangeMap.insert("IsBengali", qMakePair(0x0980, 0x09FF));
|
{ "BlockElements", 0x2580, 0x259F },
|
||||||
categoriesRangeMap.insert("IsGurmukhi", qMakePair(0x0A00, 0x0A7F));
|
{ "Bopomofo", 0x3100, 0x312F },
|
||||||
categoriesRangeMap.insert("IsGujarati", qMakePair(0x0A80, 0x0AFF));
|
{ "BopomofoExtended", 0x31A0, 0x31BF },
|
||||||
categoriesRangeMap.insert("IsOriya", qMakePair(0x0B00, 0x0B7F));
|
{ "BoxDrawing", 0x2500, 0x257F },
|
||||||
categoriesRangeMap.insert("IsTamil", qMakePair(0x0B80, 0x0BFF));
|
{ "BraillePatterns", 0x2800, 0x28FF },
|
||||||
categoriesRangeMap.insert("IsTelugu", qMakePair(0x0C00, 0x0C7F));
|
{ "Buginese", 0x1A00, 0x1A1F },
|
||||||
categoriesRangeMap.insert("IsKannada", qMakePair(0x0C80, 0x0CFF));
|
{ "Buhid", 0x1740, 0x175F },
|
||||||
categoriesRangeMap.insert("IsMalayalam", qMakePair(0x0D00, 0x0D7F));
|
{ "ByzantineMusicalSymbols", 0x1D000, 0x1D0FF },
|
||||||
categoriesRangeMap.insert("IsSinhala", qMakePair(0x0D80, 0x0DFF));
|
{ "CJKCompatibility", 0x3300, 0x33FF },
|
||||||
categoriesRangeMap.insert("IsThai", qMakePair(0x0E00, 0x0E7F));
|
{ "CJKCompatibilityForms", 0xFE30, 0xFE4F },
|
||||||
categoriesRangeMap.insert("IsLao", qMakePair(0x0E80, 0x0EFF));
|
{ "CJKCompatibilityIdeographs", 0xF900, 0xFAFF },
|
||||||
categoriesRangeMap.insert("IsTibetan", qMakePair(0x0F00, 0x0FFF));
|
{ "CJKCompatibilityIdeographsSupplement", 0x2F800, 0x2FA1F },
|
||||||
categoriesRangeMap.insert("IsMyanmar", qMakePair(0x1000, 0x109F));
|
{ "CJKRadicalsSupplement", 0x2E80, 0x2EFF },
|
||||||
categoriesRangeMap.insert("IsGeorgian", qMakePair(0x10A0, 0x10FF));
|
{ "CJKStrokes", 0x31C0, 0x31EF },
|
||||||
categoriesRangeMap.insert("IsHangulJamo", qMakePair(0x1100, 0x11FF));
|
{ "CJKSymbolsandPunctuation", 0x3000, 0x303F },
|
||||||
categoriesRangeMap.insert("IsEthiopic", qMakePair(0x1200, 0x137F));
|
{ "CJKUnifiedIdeographs", 0x4E00, 0x9FFF },
|
||||||
categoriesRangeMap.insert("IsEthiopicSupplement", qMakePair(0x1380, 0x139F));
|
{ "CJKUnifiedIdeographsExtensionA", 0x3400, 0x4DB5 },
|
||||||
categoriesRangeMap.insert("IsCherokee", qMakePair(0x13A0, 0x13FF));
|
{ "CJKUnifiedIdeographsExtensionB", 0x20000, 0x2A6DF },
|
||||||
categoriesRangeMap.insert("IsUnifiedCanadianAboriginalSyllabics", qMakePair(0x1400, 0x167F));
|
{ "Cherokee", 0x13A0, 0x13FF },
|
||||||
categoriesRangeMap.insert("IsOgham", qMakePair(0x1680, 0x169F));
|
{ "CombiningDiacriticalMarks", 0x0300, 0x036F },
|
||||||
categoriesRangeMap.insert("IsRunic", qMakePair(0x16A0, 0x16FF));
|
{ "CombiningDiacriticalMarksSupplement", 0x1DC0, 0x1DFF },
|
||||||
categoriesRangeMap.insert("IsTagalog", qMakePair(0x1700, 0x171F));
|
{ "CombiningHalfMarks", 0xFE20, 0xFE2F },
|
||||||
categoriesRangeMap.insert("IsHanunoo", qMakePair(0x1720, 0x173F));
|
{ "CombiningMarksforSymbols", 0x20D0, 0x20FF },
|
||||||
categoriesRangeMap.insert("IsBuhid", qMakePair(0x1740, 0x175F));
|
{ "ControlPictures", 0x2400, 0x243F },
|
||||||
categoriesRangeMap.insert("IsTagbanwa", qMakePair(0x1760, 0x177F));
|
{ "Coptic", 0x2C80, 0x2CFF },
|
||||||
categoriesRangeMap.insert("IsKhmer", qMakePair(0x1780, 0x17FF));
|
{ "CurrencySymbols", 0x20A0, 0x20CF },
|
||||||
categoriesRangeMap.insert("IsMongolian", qMakePair(0x1800, 0x18AF));
|
{ "CypriotSyllabary", 0x10800, 0x1083F },
|
||||||
categoriesRangeMap.insert("IsLimbu", qMakePair(0x1900, 0x194F));
|
{ "Cyrillic", 0x0400, 0x04FF },
|
||||||
categoriesRangeMap.insert("IsTaiLe", qMakePair(0x1950, 0x197F));
|
{ "CyrillicSupplement", 0x0500, 0x052F },
|
||||||
categoriesRangeMap.insert("IsNewTaiLue", qMakePair(0x1980, 0x19DF));
|
{ "Deseret", 0x10400, 0x1044F },
|
||||||
categoriesRangeMap.insert("IsKhmerSymbols", qMakePair(0x19E0, 0x19FF));
|
{ "Devanagari", 0x0900, 0x097F },
|
||||||
categoriesRangeMap.insert("IsBuginese", qMakePair(0x1A00, 0x1A1F));
|
{ "Dingbats", 0x2700, 0x27BF },
|
||||||
categoriesRangeMap.insert("IsPhoneticExtensions", qMakePair(0x1D00, 0x1D7F));
|
{ "EnclosedAlphanumerics", 0x2460, 0x24FF },
|
||||||
categoriesRangeMap.insert("IsPhoneticExtensionsSupplement", qMakePair(0x1D80, 0x1DBF));
|
{ "EnclosedCJKLettersandMonths", 0x3200, 0x32FF },
|
||||||
categoriesRangeMap.insert("IsCombiningDiacriticalMarksSupplement", qMakePair(0x1DC0, 0x1DFF));
|
{ "Ethiopic", 0x1200, 0x137F },
|
||||||
categoriesRangeMap.insert("IsLatinExtendedAdditional", qMakePair(0x1E00, 0x1EFF));
|
{ "EthiopicExtended", 0x2D80, 0x2DDF },
|
||||||
categoriesRangeMap.insert("IsGreekExtended", qMakePair(0x1F00, 0x1FFF));
|
{ "EthiopicSupplement", 0x1380, 0x139F },
|
||||||
categoriesRangeMap.insert("IsGeneralPunctuation", qMakePair(0x2000, 0x206F));
|
{ "GeneralPunctuation", 0x2000, 0x206F },
|
||||||
categoriesRangeMap.insert("IsSuperscriptsandSubscripts", qMakePair(0x2070, 0x209F));
|
{ "GeometricShapes", 0x25A0, 0x25FF },
|
||||||
categoriesRangeMap.insert("IsCurrencySymbols", qMakePair(0x20A0, 0x20CF));
|
{ "Georgian", 0x10A0, 0x10FF },
|
||||||
categoriesRangeMap.insert("IsCombiningMarksforSymbols", qMakePair(0x20D0, 0x20FF));
|
{ "GeorgianSupplement", 0x2D00, 0x2D2F },
|
||||||
categoriesRangeMap.insert("IsLetterlikeSymbols", qMakePair(0x2100, 0x214F));
|
{ "Glagolitic", 0x2C00, 0x2C5F },
|
||||||
categoriesRangeMap.insert("IsNumberForms", qMakePair(0x2150, 0x218F));
|
{ "Gothic", 0x10330, 0x1034F },
|
||||||
categoriesRangeMap.insert("IsArrows", qMakePair(0x2190, 0x21FF));
|
{ "Greek", 0x0370, 0x03FF },
|
||||||
categoriesRangeMap.insert("IsMathematicalOperators", qMakePair(0x2200, 0x22FF));
|
{ "GreekExtended", 0x1F00, 0x1FFF },
|
||||||
categoriesRangeMap.insert("IsMiscellaneousTechnical", qMakePair(0x2300, 0x23FF));
|
{ "Gujarati", 0x0A80, 0x0AFF },
|
||||||
categoriesRangeMap.insert("IsControlPictures", qMakePair(0x2400, 0x243F));
|
{ "Gurmukhi", 0x0A00, 0x0A7F },
|
||||||
categoriesRangeMap.insert("IsOpticalCharacterRecognition", qMakePair(0x2440, 0x245F));
|
{ "HalfwidthandFullwidthForms", 0xFF00, 0xFFEF },
|
||||||
categoriesRangeMap.insert("IsEnclosedAlphanumerics", qMakePair(0x2460, 0x24FF));
|
{ "HangulCompatibilityJamo", 0x3130, 0x318F },
|
||||||
categoriesRangeMap.insert("IsBoxDrawing", qMakePair(0x2500, 0x257F));
|
{ "HangulJamo", 0x1100, 0x11FF },
|
||||||
categoriesRangeMap.insert("IsBlockElements", qMakePair(0x2580, 0x259F));
|
{ "HangulSyllables", 0xAC00, 0xD7A3 },
|
||||||
categoriesRangeMap.insert("IsGeometricShapes", qMakePair(0x25A0, 0x25FF));
|
{ "Hanunoo", 0x1720, 0x173F },
|
||||||
categoriesRangeMap.insert("IsMiscellaneousSymbols", qMakePair(0x2600, 0x26FF));
|
{ "Hebrew", 0x0590, 0x05FF },
|
||||||
categoriesRangeMap.insert("IsDingbats", qMakePair(0x2700, 0x27BF));
|
{ "Hiragana", 0x3040, 0x309F },
|
||||||
categoriesRangeMap.insert("IsMiscellaneousMathematicalSymbols-A", qMakePair(0x27C0, 0x27EF));
|
{ "IPAExtensions", 0x0250, 0x02AF },
|
||||||
categoriesRangeMap.insert("IsSupplementalArrows-A", qMakePair(0x27F0, 0x27FF));
|
{ "IdeographicDescriptionCharacters", 0x2FF0, 0x2FFF },
|
||||||
categoriesRangeMap.insert("IsBraillePatterns", qMakePair(0x2800, 0x28FF));
|
{ "Kanbun", 0x3190, 0x319F },
|
||||||
categoriesRangeMap.insert("IsSupplementalArrows-B", qMakePair(0x2900, 0x297F));
|
{ "KangxiRadicals", 0x2F00, 0x2FDF },
|
||||||
categoriesRangeMap.insert("IsMiscellaneousMathematicalSymbols-B", qMakePair(0x2980, 0x29FF));
|
{ "Kannada", 0x0C80, 0x0CFF },
|
||||||
categoriesRangeMap.insert("IsSupplementalMathematicalOperators", qMakePair(0x2A00, 0x2AFF));
|
{ "Katakana", 0x30A0, 0x30FF },
|
||||||
categoriesRangeMap.insert("IsMiscellaneousSymbolsandArrows", qMakePair(0x2B00, 0x2BFF));
|
{ "KatakanaPhoneticExtensions", 0x31F0, 0x31FF },
|
||||||
categoriesRangeMap.insert("IsGlagolitic", qMakePair(0x2C00, 0x2C5F));
|
{ "Kharoshthi", 0x10A00, 0x10A5F },
|
||||||
categoriesRangeMap.insert("IsCoptic", qMakePair(0x2C80, 0x2CFF));
|
{ "Khmer", 0x1780, 0x17FF },
|
||||||
categoriesRangeMap.insert("IsGeorgianSupplement", qMakePair(0x2D00, 0x2D2F));
|
{ "KhmerSymbols", 0x19E0, 0x19FF },
|
||||||
categoriesRangeMap.insert("IsTifinagh", qMakePair(0x2D30, 0x2D7F));
|
{ "Lao", 0x0E80, 0x0EFF },
|
||||||
categoriesRangeMap.insert("IsEthiopicExtended", qMakePair(0x2D80, 0x2DDF));
|
{ "Latin-1Supplement", 0x0080, 0x00FF },
|
||||||
categoriesRangeMap.insert("IsSupplementalPunctuation", qMakePair(0x2E00, 0x2E7F));
|
{ "LatinExtended-A", 0x0100, 0x017F },
|
||||||
categoriesRangeMap.insert("IsCJKRadicalsSupplement", qMakePair(0x2E80, 0x2EFF));
|
{ "LatinExtended-B", 0x0180, 0x024F },
|
||||||
categoriesRangeMap.insert("IsKangxiRadicals", qMakePair(0x2F00, 0x2FDF));
|
{ "LatinExtendedAdditional", 0x1E00, 0x1EFF },
|
||||||
categoriesRangeMap.insert("IsIdeographicDescriptionCharacters", qMakePair(0x2FF0, 0x2FFF));
|
{ "LetterlikeSymbols", 0x2100, 0x214F },
|
||||||
categoriesRangeMap.insert("IsCJKSymbolsandPunctuation", qMakePair(0x3000, 0x303F));
|
{ "Limbu", 0x1900, 0x194F },
|
||||||
categoriesRangeMap.insert("IsHiragana", qMakePair(0x3040, 0x309F));
|
{ "LinearBIdeograms", 0x10080, 0x100FF },
|
||||||
categoriesRangeMap.insert("IsKatakana", qMakePair(0x30A0, 0x30FF));
|
{ "LinearBSyllabary", 0x10000, 0x1007F },
|
||||||
categoriesRangeMap.insert("IsBopomofo", qMakePair(0x3100, 0x312F));
|
{ "Malayalam", 0x0D00, 0x0D7F },
|
||||||
categoriesRangeMap.insert("IsHangulCompatibilityJamo", qMakePair(0x3130, 0x318F));
|
{ "MathematicalAlphanumericSymbols", 0x1D400, 0x1D7FF },
|
||||||
categoriesRangeMap.insert("IsKanbun", qMakePair(0x3190, 0x319F));
|
{ "MathematicalOperators", 0x2200, 0x22FF },
|
||||||
categoriesRangeMap.insert("IsBopomofoExtended", qMakePair(0x31A0, 0x31BF));
|
{ "MiscellaneousMathematicalSymbols-A", 0x27C0, 0x27EF },
|
||||||
categoriesRangeMap.insert("IsCJKStrokes", qMakePair(0x31C0, 0x31EF));
|
{ "MiscellaneousMathematicalSymbols-B", 0x2980, 0x29FF },
|
||||||
categoriesRangeMap.insert("IsKatakanaPhoneticExtensions", qMakePair(0x31F0, 0x31FF));
|
{ "MiscellaneousSymbols", 0x2600, 0x26FF },
|
||||||
categoriesRangeMap.insert("IsEnclosedCJKLettersandMonths", qMakePair(0x3200, 0x32FF));
|
{ "MiscellaneousSymbolsandArrows", 0x2B00, 0x2BFF },
|
||||||
categoriesRangeMap.insert("IsCJKCompatibility", qMakePair(0x3300, 0x33FF));
|
{ "MiscellaneousTechnical", 0x2300, 0x23FF },
|
||||||
categoriesRangeMap.insert("IsCJKUnifiedIdeographsExtensionA", qMakePair(0x3400, 0x4DB5));
|
{ "ModifierToneLetters", 0xA700, 0xA71F },
|
||||||
categoriesRangeMap.insert("IsYijingHexagramSymbols", qMakePair(0x4DC0, 0x4DFF));
|
{ "Mongolian", 0x1800, 0x18AF },
|
||||||
categoriesRangeMap.insert("IsCJKUnifiedIdeographs", qMakePair(0x4E00, 0x9FFF));
|
{ "MusicalSymbols", 0x1D100, 0x1D1FF },
|
||||||
categoriesRangeMap.insert("IsYiSyllables", qMakePair(0xA000, 0xA48F));
|
{ "Myanmar", 0x1000, 0x109F },
|
||||||
categoriesRangeMap.insert("IsYiRadicals", qMakePair(0xA490, 0xA4CF));
|
{ "NewTaiLue", 0x1980, 0x19DF },
|
||||||
categoriesRangeMap.insert("IsModifierToneLetters", qMakePair(0xA700, 0xA71F));
|
{ "NumberForms", 0x2150, 0x218F },
|
||||||
categoriesRangeMap.insert("IsSylotiNagri", qMakePair(0xA800, 0xA82F));
|
{ "Ogham", 0x1680, 0x169F },
|
||||||
categoriesRangeMap.insert("IsHangulSyllables", qMakePair(0xAC00, 0xD7A3));
|
{ "OldItalic", 0x10300, 0x1032F },
|
||||||
categoriesRangeMap.insert("IsPrivateUse", qMakePair(0xE000, 0xF8FF));
|
{ "OldPersian", 0x103A0, 0x103DF },
|
||||||
categoriesRangeMap.insert("IsCJKCompatibilityIdeographs", qMakePair(0xF900, 0xFAFF));
|
{ "OpticalCharacterRecognition", 0x2440, 0x245F },
|
||||||
categoriesRangeMap.insert("IsAlphabeticPresentationForms", qMakePair(0xFB00, 0xFB4F));
|
{ "Oriya", 0x0B00, 0x0B7F },
|
||||||
categoriesRangeMap.insert("IsArabicPresentationForms-A", qMakePair(0xFB50, 0xFDFF));
|
{ "Osmanya", 0x10480, 0x104AF },
|
||||||
categoriesRangeMap.insert("IsVariationSelectors", qMakePair(0xFE00, 0xFE0F));
|
{ "PhoneticExtensions", 0x1D00, 0x1D7F },
|
||||||
categoriesRangeMap.insert("IsVerticalForms", qMakePair(0xFE10, 0xFE1F));
|
{ "PhoneticExtensionsSupplement", 0x1D80, 0x1DBF },
|
||||||
categoriesRangeMap.insert("IsCombiningHalfMarks", qMakePair(0xFE20, 0xFE2F));
|
{ "PrivateUse", 0xE000, 0xF8FF },
|
||||||
categoriesRangeMap.insert("IsCJKCompatibilityForms", qMakePair(0xFE30, 0xFE4F));
|
{ "Runic", 0x16A0, 0x16FF },
|
||||||
categoriesRangeMap.insert("IsSmallFormVariants", qMakePair(0xFE50, 0xFE6F));
|
{ "Shavian", 0x10450, 0x1047F },
|
||||||
categoriesRangeMap.insert("IsArabicPresentationForms-B", qMakePair(0xFE70, 0xFEFF));
|
{ "Sinhala", 0x0D80, 0x0DFF },
|
||||||
categoriesRangeMap.insert("IsHalfwidthandFullwidthForms", qMakePair(0xFF00, 0xFFEF));
|
{ "SmallFormVariants", 0xFE50, 0xFE6F },
|
||||||
categoriesRangeMap.insert("IsSpecials", qMakePair(0xFFF0, 0xFFFF));
|
{ "SpacingModifierLetters", 0x02B0, 0x02FF },
|
||||||
categoriesRangeMap.insert("IsLinearBSyllabary", qMakePair(0x10000, 0x1007F));
|
{ "Specials", 0xFFF0, 0xFFFF },
|
||||||
categoriesRangeMap.insert("IsLinearBIdeograms", qMakePair(0x10080, 0x100FF));
|
{ "SuperscriptsandSubscripts", 0x2070, 0x209F },
|
||||||
categoriesRangeMap.insert("IsAegeanNumbers", qMakePair(0x10100, 0x1013F));
|
{ "SupplementalArrows-A", 0x27F0, 0x27FF },
|
||||||
categoriesRangeMap.insert("IsAncientGreekNumbers", qMakePair(0x10140, 0x1018F));
|
{ "SupplementalArrows-B", 0x2900, 0x297F },
|
||||||
categoriesRangeMap.insert("IsOldItalic", qMakePair(0x10300, 0x1032F));
|
{ "SupplementalMathematicalOperators", 0x2A00, 0x2AFF },
|
||||||
categoriesRangeMap.insert("IsGothic", qMakePair(0x10330, 0x1034F));
|
{ "SupplementalPunctuation", 0x2E00, 0x2E7F },
|
||||||
categoriesRangeMap.insert("IsUgaritic", qMakePair(0x10380, 0x1039F));
|
{ "SupplementaryPrivateUseArea-A", 0xF0000, 0xFFFFF },
|
||||||
categoriesRangeMap.insert("IsOldPersian", qMakePair(0x103A0, 0x103DF));
|
{ "SupplementaryPrivateUseArea-B", 0x100000, 0x10FFFF },
|
||||||
categoriesRangeMap.insert("IsDeseret", qMakePair(0x10400, 0x1044F));
|
{ "SylotiNagri", 0xA800, 0xA82F },
|
||||||
categoriesRangeMap.insert("IsShavian", qMakePair(0x10450, 0x1047F));
|
{ "Syriac", 0x0700, 0x074F },
|
||||||
categoriesRangeMap.insert("IsOsmanya", qMakePair(0x10480, 0x104AF));
|
{ "Tagalog", 0x1700, 0x171F },
|
||||||
categoriesRangeMap.insert("IsCypriotSyllabary", qMakePair(0x10800, 0x1083F));
|
{ "Tagbanwa", 0x1760, 0x177F },
|
||||||
categoriesRangeMap.insert("IsKharoshthi", qMakePair(0x10A00, 0x10A5F));
|
{ "Tags", 0xE0000, 0xE007F },
|
||||||
categoriesRangeMap.insert("IsByzantineMusicalSymbols", qMakePair(0x1D000, 0x1D0FF));
|
{ "TaiLe", 0x1950, 0x197F },
|
||||||
categoriesRangeMap.insert("IsMusicalSymbols", qMakePair(0x1D100, 0x1D1FF));
|
{ "TaiXuanJingSymbols", 0x1D300, 0x1D35F },
|
||||||
categoriesRangeMap.insert("IsAncientGreekMusicalNotation", qMakePair(0x1D200, 0x1D24F));
|
{ "Tamil", 0x0B80, 0x0BFF },
|
||||||
categoriesRangeMap.insert("IsTaiXuanJingSymbols", qMakePair(0x1D300, 0x1D35F));
|
{ "Telugu", 0x0C00, 0x0C7F },
|
||||||
categoriesRangeMap.insert("IsMathematicalAlphanumericSymbols", qMakePair(0x1D400, 0x1D7FF));
|
{ "Thaana", 0x0780, 0x07BF },
|
||||||
categoriesRangeMap.insert("IsCJKUnifiedIdeographsExtensionB", qMakePair(0x20000, 0x2A6DF));
|
{ "Thai", 0x0E00, 0x0E7F },
|
||||||
categoriesRangeMap.insert("IsCJKCompatibilityIdeographsSupplement", qMakePair(0x2F800, 0x2FA1F));
|
{ "Tibetan", 0x0F00, 0x0FFF },
|
||||||
categoriesRangeMap.insert("IsTags", qMakePair(0xE0000, 0xE007F));
|
{ "Tifinagh", 0x2D30, 0x2D7F },
|
||||||
categoriesRangeMap.insert("IsVariationSelectorsSupplement", qMakePair(0xE0100, 0xE01EF));
|
{ "Ugaritic", 0x10380, 0x1039F },
|
||||||
categoriesRangeMap.insert("IsSupplementaryPrivateUseArea-A", qMakePair(0xF0000, 0xFFFFF));
|
{ "UnifiedCanadianAboriginalSyllabics", 0x1400, 0x167F },
|
||||||
categoriesRangeMap.insert("IsSupplementaryPrivateUseArea-B", qMakePair(0x100000, 0x10FFFF));
|
{ "VariationSelectors", 0xFE00, 0xFE0F },
|
||||||
}
|
{ "VariationSelectorsSupplement", 0xE0100, 0xE01EF },
|
||||||
|
{ "VerticalForms", 0xFE10, 0xFE1F },
|
||||||
|
{ "YiRadicals", 0xA490, 0xA4CF },
|
||||||
|
{ "YiSyllables", 0xA000, 0xA48F },
|
||||||
|
{ "YijingHexagramSymbols", 0x4DC0, 0x4DFF }
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool operator<(const char *name, const CategoriesRangeMapEntry &entry)
|
||||||
|
{ return qstrcmp(name, entry.name) < 0; }
|
||||||
|
inline bool operator<(const CategoriesRangeMapEntry &entry, const char *name)
|
||||||
|
{ return qstrcmp(entry.name, name) < 0; }
|
||||||
|
#endif // QT_NO_REGEXP_CCLASS
|
||||||
|
|
||||||
int QRegExpEngine::getChar()
|
int QRegExpEngine::getChar()
|
||||||
{
|
{
|
||||||
@ -3101,113 +3109,136 @@ int QRegExpEngine::getEscape()
|
|||||||
}
|
}
|
||||||
yyCh = getChar(); // skip closing '}'
|
yyCh = getChar(); // skip closing '}'
|
||||||
|
|
||||||
if (category == "M") {
|
int catlen = category.length();
|
||||||
yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing) |
|
if (catlen == 1 || catlen == 2) {
|
||||||
FLAG(QChar::Mark_SpacingCombining) |
|
switch (category.at(0)) {
|
||||||
FLAG(QChar::Mark_Enclosing));
|
case 'M':
|
||||||
} else if (category == "Mn") {
|
if (catlen == 1) {
|
||||||
yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing));
|
yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing) |
|
||||||
} else if (category == "Mc") {
|
FLAG(QChar::Mark_SpacingCombining) |
|
||||||
yyCharClass->addCategories(FLAG(QChar::Mark_SpacingCombining));
|
FLAG(QChar::Mark_Enclosing));
|
||||||
} else if (category == "Me") {
|
} else {
|
||||||
yyCharClass->addCategories(FLAG(QChar::Mark_Enclosing));
|
switch (category.at(1)) {
|
||||||
} else if (category == "N") {
|
case 'n': yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing)); break; // Mn
|
||||||
yyCharClass->addCategories(FLAG(QChar::Number_DecimalDigit) |
|
case 'c': yyCharClass->addCategories(FLAG(QChar::Mark_SpacingCombining)); break; // Mc
|
||||||
FLAG(QChar::Number_Letter) |
|
case 'e': yyCharClass->addCategories(FLAG(QChar::Mark_Enclosing)); break; // Me
|
||||||
FLAG(QChar::Number_Other));
|
default: error(RXERR_CATEGORY); break;
|
||||||
} else if (category == "Nd") {
|
}
|
||||||
yyCharClass->addCategories(FLAG(QChar::Number_DecimalDigit));
|
}
|
||||||
} else if (category == "Nl") {
|
break;
|
||||||
yyCharClass->addCategories(FLAG(QChar::Number_Letter));
|
case 'N':
|
||||||
} else if (category == "No") {
|
if (catlen == 1) {
|
||||||
yyCharClass->addCategories(FLAG(QChar::Number_Other));
|
yyCharClass->addCategories(FLAG(QChar::Number_DecimalDigit) |
|
||||||
} else if (category == "Z") {
|
FLAG(QChar::Number_Letter) |
|
||||||
yyCharClass->addCategories(FLAG(QChar::Separator_Space) |
|
FLAG(QChar::Number_Other));
|
||||||
FLAG(QChar::Separator_Line) |
|
} else {
|
||||||
FLAG(QChar::Separator_Paragraph));
|
switch (category.at(1)) {
|
||||||
} else if (category == "Zs") {
|
case 'd': yyCharClass->addCategories(FLAG(QChar::Number_DecimalDigit)); break; // Nd
|
||||||
yyCharClass->addCategories(FLAG(QChar::Separator_Space));
|
case 'l': yyCharClass->addCategories(FLAG(QChar::Number_Letter)); break; // Hl
|
||||||
} else if (category == "Zl") {
|
case 'o': yyCharClass->addCategories(FLAG(QChar::Number_Other)); break; // No
|
||||||
yyCharClass->addCategories(FLAG(QChar::Separator_Line));
|
default: error(RXERR_CATEGORY); break;
|
||||||
} else if (category == "Zp") {
|
}
|
||||||
yyCharClass->addCategories(FLAG(QChar::Separator_Paragraph));
|
}
|
||||||
} else if (category == "C") {
|
break;
|
||||||
yyCharClass->addCategories(FLAG(QChar::Other_Control) |
|
case 'Z':
|
||||||
FLAG(QChar::Other_Format) |
|
if (catlen == 1) {
|
||||||
FLAG(QChar::Other_Surrogate) |
|
yyCharClass->addCategories(FLAG(QChar::Separator_Space) |
|
||||||
FLAG(QChar::Other_PrivateUse) |
|
FLAG(QChar::Separator_Line) |
|
||||||
FLAG(QChar::Other_NotAssigned));
|
FLAG(QChar::Separator_Paragraph));
|
||||||
} else if (category == "Cc") {
|
} else {
|
||||||
yyCharClass->addCategories(FLAG(QChar::Other_Control));
|
switch (category.at(1)) {
|
||||||
} else if (category == "Cf") {
|
case 's': yyCharClass->addCategories(FLAG(QChar::Separator_Space)); break; // Zs
|
||||||
yyCharClass->addCategories(FLAG(QChar::Other_Format));
|
case 'l': yyCharClass->addCategories(FLAG(QChar::Separator_Line)); break; // Zl
|
||||||
} else if (category == "Cs") {
|
case 'p': yyCharClass->addCategories(FLAG(QChar::Separator_Paragraph)); break; // Zp
|
||||||
yyCharClass->addCategories(FLAG(QChar::Other_Surrogate));
|
default: error(RXERR_CATEGORY); break;
|
||||||
} else if (category == "Co") {
|
}
|
||||||
yyCharClass->addCategories(FLAG(QChar::Other_PrivateUse));
|
}
|
||||||
} else if (category == "Cn") {
|
break;
|
||||||
yyCharClass->addCategories(FLAG(QChar::Other_NotAssigned));
|
case 'C':
|
||||||
} else if (category == "L") {
|
if (catlen == 1) {
|
||||||
yyCharClass->addCategories(FLAG(QChar::Letter_Uppercase) |
|
yyCharClass->addCategories(FLAG(QChar::Other_Control) |
|
||||||
FLAG(QChar::Letter_Lowercase) |
|
FLAG(QChar::Other_Format) |
|
||||||
FLAG(QChar::Letter_Titlecase) |
|
FLAG(QChar::Other_Surrogate) |
|
||||||
FLAG(QChar::Letter_Modifier) |
|
FLAG(QChar::Other_PrivateUse) |
|
||||||
FLAG(QChar::Letter_Other));
|
FLAG(QChar::Other_NotAssigned));
|
||||||
} else if (category == "Lu") {
|
} else {
|
||||||
yyCharClass->addCategories(FLAG(QChar::Letter_Uppercase));
|
switch (category.at(1)) {
|
||||||
} else if (category == "Ll") {
|
case 'c': yyCharClass->addCategories(FLAG(QChar::Other_Control)); break; // Cc
|
||||||
yyCharClass->addCategories(FLAG(QChar::Letter_Lowercase));
|
case 'f': yyCharClass->addCategories(FLAG(QChar::Other_Format)); break; // Cf
|
||||||
} else if (category == "Lt") {
|
case 's': yyCharClass->addCategories(FLAG(QChar::Other_Surrogate)); break; // Cs
|
||||||
yyCharClass->addCategories(FLAG(QChar::Letter_Titlecase));
|
case 'o': yyCharClass->addCategories(FLAG(QChar::Other_PrivateUse)); break; // Co
|
||||||
} else if (category == "Lm") {
|
case 'n': yyCharClass->addCategories(FLAG(QChar::Other_NotAssigned)); break; // Cn
|
||||||
yyCharClass->addCategories(FLAG(QChar::Letter_Modifier));
|
default: error(RXERR_CATEGORY); break;
|
||||||
} else if (category == "Lo") {
|
}
|
||||||
yyCharClass->addCategories(FLAG(QChar::Letter_Other));
|
}
|
||||||
} else if (category == "P") {
|
break;
|
||||||
yyCharClass->addCategories(FLAG(QChar::Punctuation_Connector) |
|
case 'L':
|
||||||
FLAG(QChar::Punctuation_Dash) |
|
if (catlen == 1) {
|
||||||
FLAG(QChar::Punctuation_Open) |
|
yyCharClass->addCategories(FLAG(QChar::Letter_Uppercase) |
|
||||||
FLAG(QChar::Punctuation_Close) |
|
FLAG(QChar::Letter_Lowercase) |
|
||||||
FLAG(QChar::Punctuation_InitialQuote) |
|
FLAG(QChar::Letter_Titlecase) |
|
||||||
FLAG(QChar::Punctuation_FinalQuote) |
|
FLAG(QChar::Letter_Modifier) |
|
||||||
FLAG(QChar::Punctuation_Other));
|
FLAG(QChar::Letter_Other));
|
||||||
} else if (category == "Pc") {
|
} else {
|
||||||
yyCharClass->addCategories(FLAG(QChar::Punctuation_Connector));
|
switch (category.at(1)) {
|
||||||
} else if (category == "Pd") {
|
case 'u': yyCharClass->addCategories(FLAG(QChar::Letter_Uppercase)); break; // Lu
|
||||||
yyCharClass->addCategories(FLAG(QChar::Punctuation_Dash));
|
case 'l': yyCharClass->addCategories(FLAG(QChar::Letter_Lowercase)); break; // Ll
|
||||||
} else if (category == "Ps") {
|
case 't': yyCharClass->addCategories(FLAG(QChar::Letter_Titlecase)); break; // Lt
|
||||||
yyCharClass->addCategories(FLAG(QChar::Punctuation_Open));
|
case 'm': yyCharClass->addCategories(FLAG(QChar::Letter_Modifier)); break; // Lm
|
||||||
} else if (category == "Pe") {
|
case 'o': yyCharClass->addCategories(FLAG(QChar::Letter_Other)); break; // Lo
|
||||||
yyCharClass->addCategories(FLAG(QChar::Punctuation_Close));
|
default: error(RXERR_CATEGORY); break;
|
||||||
} else if (category == "Pi") {
|
}
|
||||||
yyCharClass->addCategories(FLAG(QChar::Punctuation_InitialQuote));
|
}
|
||||||
} else if (category == "Pf") {
|
break;
|
||||||
yyCharClass->addCategories(FLAG(QChar::Punctuation_FinalQuote));
|
case 'P':
|
||||||
} else if (category == "Po") {
|
if (catlen == 1) {
|
||||||
yyCharClass->addCategories(FLAG(QChar::Punctuation_Other));
|
yyCharClass->addCategories(FLAG(QChar::Punctuation_Connector) |
|
||||||
} else if (category == "S") {
|
FLAG(QChar::Punctuation_Dash) |
|
||||||
yyCharClass->addCategories(FLAG(QChar::Symbol_Math) |
|
FLAG(QChar::Punctuation_Open) |
|
||||||
FLAG(QChar::Symbol_Currency) |
|
FLAG(QChar::Punctuation_Close) |
|
||||||
FLAG(QChar::Symbol_Modifier) |
|
FLAG(QChar::Punctuation_InitialQuote) |
|
||||||
FLAG(QChar::Symbol_Other));
|
FLAG(QChar::Punctuation_FinalQuote) |
|
||||||
} else if (category == "Sm") {
|
FLAG(QChar::Punctuation_Other));
|
||||||
yyCharClass->addCategories(FLAG(QChar::Symbol_Math));
|
} else {
|
||||||
} else if (category == "Sc") {
|
switch (category.at(1)) {
|
||||||
yyCharClass->addCategories(FLAG(QChar::Symbol_Currency));
|
case 'c': yyCharClass->addCategories(FLAG(QChar::Punctuation_Connector)); break; // Pc
|
||||||
} else if (category == "Sk") {
|
case 'd': yyCharClass->addCategories(FLAG(QChar::Punctuation_Dash)); break; // Pd
|
||||||
yyCharClass->addCategories(FLAG(QChar::Symbol_Modifier));
|
case 's': yyCharClass->addCategories(FLAG(QChar::Punctuation_Open)); break; // Ps
|
||||||
} else if (category == "So") {
|
case 'e': yyCharClass->addCategories(FLAG(QChar::Punctuation_Close)); break; // Pe
|
||||||
yyCharClass->addCategories(FLAG(QChar::Symbol_Other));
|
case 'i': yyCharClass->addCategories(FLAG(QChar::Punctuation_InitialQuote)); break; // Pi
|
||||||
} else if (category.startsWith("Is")) {
|
case 'f': yyCharClass->addCategories(FLAG(QChar::Punctuation_FinalQuote)); break; // Pf
|
||||||
if (categoriesRangeMap.isEmpty())
|
case 'o': yyCharClass->addCategories(FLAG(QChar::Punctuation_Other)); break; // Po
|
||||||
setupCategoriesRangeMap();
|
default: error(RXERR_CATEGORY); break;
|
||||||
|
}
|
||||||
if (categoriesRangeMap.contains(category)) {
|
}
|
||||||
const QPair<int, int> range = categoriesRangeMap.value(category);
|
break;
|
||||||
yyCharClass->addRange(range.first, range.second);
|
case 'S':
|
||||||
} else {
|
if (catlen == 1) {
|
||||||
|
yyCharClass->addCategories(FLAG(QChar::Symbol_Math) |
|
||||||
|
FLAG(QChar::Symbol_Currency) |
|
||||||
|
FLAG(QChar::Symbol_Modifier) |
|
||||||
|
FLAG(QChar::Symbol_Other));
|
||||||
|
} else {
|
||||||
|
switch (category.at(1)) {
|
||||||
|
case 'm': yyCharClass->addCategories(FLAG(QChar::Symbol_Math)); break; // Sm
|
||||||
|
case 'c': yyCharClass->addCategories(FLAG(QChar::Symbol_Currency)); break; // Sc
|
||||||
|
case 'k': yyCharClass->addCategories(FLAG(QChar::Symbol_Modifier)); break; // Sk
|
||||||
|
case 'o': yyCharClass->addCategories(FLAG(QChar::Symbol_Other)); break; // So
|
||||||
|
default: error(RXERR_CATEGORY); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
error(RXERR_CATEGORY);
|
error(RXERR_CATEGORY);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (catlen > 2 && category.at(0) == 'I' && category.at(1) == 's') {
|
||||||
|
static const int N = sizeof(categoriesRangeMap) / sizeof(categoriesRangeMap[0]);
|
||||||
|
const CategoriesRangeMapEntry *r = qBinaryFind(categoriesRangeMap, categoriesRangeMap + N, category.constData() + 2);
|
||||||
|
if (r != categoriesRangeMap + N)
|
||||||
|
yyCharClass->addRange(r->first, r->second);
|
||||||
|
else
|
||||||
|
error(RXERR_CATEGORY);
|
||||||
} else {
|
} else {
|
||||||
error(RXERR_CATEGORY);
|
error(RXERR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(const QString &serv
|
|||||||
: connection(con), service(serv), path(p), interface(iface),
|
: connection(con), service(serv), path(p), interface(iface),
|
||||||
lastError(checkIfValid(serv, p, iface, isDynamic, (connectionPrivate() &&
|
lastError(checkIfValid(serv, p, iface, isDynamic, (connectionPrivate() &&
|
||||||
connectionPrivate()->mode == QDBusConnectionPrivate::PeerMode))),
|
connectionPrivate()->mode == QDBusConnectionPrivate::PeerMode))),
|
||||||
|
timeout(-1),
|
||||||
isValid(!lastError.isValid())
|
isValid(!lastError.isValid())
|
||||||
{
|
{
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
@ -144,7 +145,7 @@ void QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, QVariant &
|
|||||||
QLatin1String("Get"));
|
QLatin1String("Get"));
|
||||||
QDBusMessagePrivate::setParametersValidated(msg, true);
|
QDBusMessagePrivate::setParametersValidated(msg, true);
|
||||||
msg << interface << QString::fromUtf8(mp.name());
|
msg << interface << QString::fromUtf8(mp.name());
|
||||||
QDBusMessage reply = connection.call(msg, QDBus::Block);
|
QDBusMessage reply = connection.call(msg, QDBus::Block, timeout);
|
||||||
|
|
||||||
if (reply.type() != QDBusMessage::ReplyMessage) {
|
if (reply.type() != QDBusMessage::ReplyMessage) {
|
||||||
lastError = reply;
|
lastError = reply;
|
||||||
@ -210,7 +211,7 @@ bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const Q
|
|||||||
QLatin1String("Set"));
|
QLatin1String("Set"));
|
||||||
QDBusMessagePrivate::setParametersValidated(msg, true);
|
QDBusMessagePrivate::setParametersValidated(msg, true);
|
||||||
msg << interface << QString::fromUtf8(mp.name()) << QVariant::fromValue(QDBusVariant(value));
|
msg << interface << QString::fromUtf8(mp.name()) << QVariant::fromValue(QDBusVariant(value));
|
||||||
QDBusMessage reply = connection.call(msg, QDBus::Block);
|
QDBusMessage reply = connection.call(msg, QDBus::Block, timeout);
|
||||||
|
|
||||||
if (reply.type() != QDBusMessage::ReplyMessage) {
|
if (reply.type() != QDBusMessage::ReplyMessage) {
|
||||||
lastError = reply;
|
lastError = reply;
|
||||||
@ -383,6 +384,28 @@ QDBusError QDBusAbstractInterface::lastError() const
|
|||||||
return d_func()->lastError;
|
return d_func()->lastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets the timeout in seconds for all future DBus calls to \a timeout.
|
||||||
|
-1 means the default DBus timeout (usually 25 seconds).
|
||||||
|
|
||||||
|
\since 4.8
|
||||||
|
*/
|
||||||
|
void QDBusAbstractInterface::setTimeout(int timeout)
|
||||||
|
{
|
||||||
|
d_func()->timeout = timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the current value of the timeout in seconds.
|
||||||
|
-1 means the default DBus timeout (usually 25 seconds).
|
||||||
|
|
||||||
|
\since 4.8
|
||||||
|
*/
|
||||||
|
int QDBusAbstractInterface::timeout() const
|
||||||
|
{
|
||||||
|
return d_func()->timeout;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Places a call to the remote method specified by \a method on this interface, using \a args as
|
Places a call to the remote method specified by \a method on this interface, using \a args as
|
||||||
arguments. This function returns the message that was received as a reply, which can be a normal
|
arguments. This function returns the message that was received as a reply, which can be a normal
|
||||||
@ -442,7 +465,7 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode,
|
|||||||
QDBusMessagePrivate::setParametersValidated(msg, true);
|
QDBusMessagePrivate::setParametersValidated(msg, true);
|
||||||
msg.setArguments(args);
|
msg.setArguments(args);
|
||||||
|
|
||||||
QDBusMessage reply = d->connection.call(msg, mode);
|
QDBusMessage reply = d->connection.call(msg, mode, d->timeout);
|
||||||
if (thread() == QThread::currentThread())
|
if (thread() == QThread::currentThread())
|
||||||
d->lastError = reply; // will clear if reply isn't an error
|
d->lastError = reply; // will clear if reply isn't an error
|
||||||
|
|
||||||
@ -475,7 +498,7 @@ QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString
|
|||||||
QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method);
|
QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method);
|
||||||
QDBusMessagePrivate::setParametersValidated(msg, true);
|
QDBusMessagePrivate::setParametersValidated(msg, true);
|
||||||
msg.setArguments(args);
|
msg.setArguments(args);
|
||||||
return d->connection.asyncCall(msg);
|
return d->connection.asyncCall(msg, d->timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -95,6 +95,9 @@ public:
|
|||||||
|
|
||||||
QDBusError lastError() const;
|
QDBusError lastError() const;
|
||||||
|
|
||||||
|
void setTimeout(int timeout);
|
||||||
|
int timeout() const;
|
||||||
|
|
||||||
QDBusMessage call(const QString &method,
|
QDBusMessage call(const QString &method,
|
||||||
const QVariant &arg1 = QVariant(),
|
const QVariant &arg1 = QVariant(),
|
||||||
const QVariant &arg2 = QVariant(),
|
const QVariant &arg2 = QVariant(),
|
||||||
|
@ -77,6 +77,7 @@ public:
|
|||||||
QString path;
|
QString path;
|
||||||
QString interface;
|
QString interface;
|
||||||
mutable QDBusError lastError;
|
mutable QDBusError lastError;
|
||||||
|
int timeout;
|
||||||
|
|
||||||
// this is set during creation and never changed
|
// this is set during creation and never changed
|
||||||
// it can't be const because QDBusInterfacePrivate has one more check
|
// it can't be const because QDBusInterfacePrivate has one more check
|
||||||
|
@ -438,6 +438,11 @@ public:
|
|||||||
QFontEngine *engine(int at) const
|
QFontEngine *engine(int at) const
|
||||||
{Q_ASSERT(at < engines.size()); return engines.at(at); }
|
{Q_ASSERT(at < engines.size()); return engines.at(at); }
|
||||||
|
|
||||||
|
inline void ensureEngineAt(int at)
|
||||||
|
{
|
||||||
|
if (at >= engines.size() || engines.at(at) == 0)
|
||||||
|
loadEngine(at);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class QPSPrintEnginePrivate;
|
friend class QPSPrintEnginePrivate;
|
||||||
|
@ -2093,7 +2093,8 @@ void QTextEngine::justify(const QScriptLine &line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFixed need = line.width - line.textWidth;
|
QFixed leading = leadingSpaceWidth(line);
|
||||||
|
QFixed need = line.width - line.textWidth - leading;
|
||||||
if (need < 0) {
|
if (need < 0) {
|
||||||
// line overflows already!
|
// line overflows already!
|
||||||
const_cast<QScriptLine &>(line).justified = true;
|
const_cast<QScriptLine &>(line).justified = true;
|
||||||
|
@ -2303,6 +2303,7 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
|
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
|
||||||
|
multiFontEngine->ensureEngineAt(which);
|
||||||
glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
|
glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
|
||||||
subLayout, pos, flags, x, width));
|
subLayout, pos, flags, x, width));
|
||||||
for (int i = 0; i < subLayout.numGlyphs; i++) {
|
for (int i = 0; i < subLayout.numGlyphs; i++) {
|
||||||
@ -2315,6 +2316,7 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
|
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
|
||||||
|
multiFontEngine->ensureEngineAt(which);
|
||||||
QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which),
|
QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which),
|
||||||
subLayout, pos, flags, x, width);
|
subLayout, pos, flags, x, width);
|
||||||
if (!glyphRun.isEmpty())
|
if (!glyphRun.isEmpty())
|
||||||
|
@ -212,7 +212,7 @@ QVariant QAccessibleAbstractSpinBox::currentValue()
|
|||||||
|
|
||||||
void QAccessibleAbstractSpinBox::setCurrentValue(const QVariant &value)
|
void QAccessibleAbstractSpinBox::setCurrentValue(const QVariant &value)
|
||||||
{
|
{
|
||||||
abstractSpinBox()->setProperty("setValue", value);
|
abstractSpinBox()->setProperty("value", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QAccessibleAbstractSpinBox::maximumValue()
|
QVariant QAccessibleAbstractSpinBox::maximumValue()
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "QtTest/private/qabstracttestlogger_p.h"
|
#include "QtTest/private/qabstracttestlogger_p.h"
|
||||||
#include "QtTest/private/qtestlog_p.h"
|
|
||||||
#include "QtTest/qtestassert.h"
|
#include "QtTest/qtestassert.h"
|
||||||
|
|
||||||
#include "QtCore/qbytearray.h"
|
#include "QtCore/qbytearray.h"
|
||||||
@ -55,57 +54,38 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace QTest
|
|
||||||
{
|
|
||||||
static FILE *stream = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QAbstractTestLogger::outputString(const char *msg)
|
void QAbstractTestLogger::outputString(const char *msg)
|
||||||
{
|
{
|
||||||
QTEST_ASSERT(QTest::stream);
|
QTEST_ASSERT(stream);
|
||||||
|
|
||||||
::fputs(msg, QTest::stream);
|
::fputs(msg, stream);
|
||||||
::fflush(QTest::stream);
|
::fflush(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QAbstractTestLogger::isTtyOutput()
|
void QAbstractTestLogger::startLogging(const char *filename)
|
||||||
{
|
{
|
||||||
QTEST_ASSERT(QTest::stream);
|
QTEST_ASSERT(!stream);
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_INTEGRITY)
|
if (!filename) {
|
||||||
return true;
|
stream = stdout;
|
||||||
#else
|
|
||||||
static bool ttyoutput = isatty(fileno(QTest::stream));
|
|
||||||
return ttyoutput;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QAbstractTestLogger::startLogging()
|
|
||||||
{
|
|
||||||
QTEST_ASSERT(!QTest::stream);
|
|
||||||
|
|
||||||
const char *out = QTestLog::outputFileName();
|
|
||||||
if (!out) {
|
|
||||||
QTest::stream = stdout;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
|
#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
|
||||||
if (::fopen_s(&QTest::stream, out, "wt")) {
|
if (::fopen_s(&stream, filename, "wt")) {
|
||||||
#else
|
#else
|
||||||
QTest::stream = ::fopen(out, "wt");
|
stream = ::fopen(filename, "wt");
|
||||||
if (!QTest::stream) {
|
if (!stream) {
|
||||||
#endif
|
#endif
|
||||||
printf("Unable to open file for logging: %s", out);
|
fprintf(stderr, "Unable to open file for logging: %s", filename);
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAbstractTestLogger::stopLogging()
|
void QAbstractTestLogger::stopLogging()
|
||||||
{
|
{
|
||||||
QTEST_ASSERT(QTest::stream);
|
QTEST_ASSERT(stream);
|
||||||
if (QTest::stream != stdout) {
|
if (stream != stdout) {
|
||||||
fclose(QTest::stream);
|
fclose(stream);
|
||||||
} else {
|
} else {
|
||||||
#ifdef Q_OS_SYMBIAN
|
#ifdef Q_OS_SYMBIAN
|
||||||
// Convenience sleep for Symbian and TRK. Without this sleep depending on the timing the
|
// Convenience sleep for Symbian and TRK. Without this sleep depending on the timing the
|
||||||
@ -114,7 +94,7 @@ void QAbstractTestLogger::stopLogging()
|
|||||||
User::AfterHighRes(2*1000*1000);
|
User::AfterHighRes(2*1000*1000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
QTest::stream = 0;
|
stream = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace QTest
|
namespace QTest
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <qglobal.h>
|
#include <qglobal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -79,10 +80,10 @@ public:
|
|||||||
Info
|
Info
|
||||||
};
|
};
|
||||||
|
|
||||||
QAbstractTestLogger() {}
|
QAbstractTestLogger() : stream(0) {}
|
||||||
virtual ~QAbstractTestLogger() {}
|
virtual ~QAbstractTestLogger() {}
|
||||||
|
|
||||||
virtual void startLogging();
|
virtual void startLogging(const char *filename);
|
||||||
virtual void stopLogging();
|
virtual void stopLogging();
|
||||||
|
|
||||||
virtual void enterTestFunction(const char *function) = 0;
|
virtual void enterTestFunction(const char *function) = 0;
|
||||||
@ -97,8 +98,10 @@ public:
|
|||||||
|
|
||||||
virtual void registerRandomSeed(unsigned int seed) = 0;
|
virtual void registerRandomSeed(unsigned int seed) = 0;
|
||||||
|
|
||||||
static void outputString(const char *msg);
|
void outputString(const char *msg);
|
||||||
static bool isTtyOutput();
|
|
||||||
|
private:
|
||||||
|
FILE *stream;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QTestCharBuffer
|
struct QTestCharBuffer
|
||||||
|
@ -71,164 +71,50 @@ QT_BEGIN_NAMESPACE
|
|||||||
namespace QTest {
|
namespace QTest {
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||||
|
|
||||||
static CRITICAL_SECTION outputCriticalSection;
|
static CRITICAL_SECTION outputCriticalSection;
|
||||||
static HANDLE hConsole = INVALID_HANDLE_VALUE;
|
|
||||||
static WORD consoleAttributes = 0;
|
|
||||||
|
|
||||||
static const char *qWinColoredMsg(int prefix, int color, const char *msg)
|
|
||||||
{
|
|
||||||
if (!hConsole)
|
|
||||||
return msg;
|
|
||||||
|
|
||||||
WORD attr = consoleAttributes & ~(FOREGROUND_GREEN | FOREGROUND_BLUE
|
|
||||||
| FOREGROUND_RED | FOREGROUND_INTENSITY);
|
|
||||||
if (prefix)
|
|
||||||
attr |= FOREGROUND_INTENSITY;
|
|
||||||
if (color == 32)
|
|
||||||
attr |= FOREGROUND_GREEN;
|
|
||||||
if (color == 36)
|
|
||||||
attr |= FOREGROUND_BLUE | FOREGROUND_GREEN;
|
|
||||||
if (color == 31)
|
|
||||||
attr |= FOREGROUND_RED | FOREGROUND_INTENSITY;
|
|
||||||
if (color == 37)
|
|
||||||
attr |= FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
|
||||||
if (color == 33)
|
|
||||||
attr |= FOREGROUND_RED | FOREGROUND_GREEN;
|
|
||||||
SetConsoleTextAttribute(hConsole, attr);
|
|
||||||
printf(msg);
|
|
||||||
SetConsoleTextAttribute(hConsole, consoleAttributes);
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
# define COLORED_MSG(prefix, color, msg) colored ? qWinColoredMsg(prefix, color, msg) : msg
|
|
||||||
#else
|
|
||||||
# define COLORED_MSG(prefix, color, msg) colored && QAbstractTestLogger::isTtyOutput() ? "\033["#prefix";"#color"m" msg "\033[0m" : msg
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char *incidentType2String(QAbstractTestLogger::IncidentTypes type)
|
static const char *incidentType2String(QAbstractTestLogger::IncidentTypes type)
|
||||||
{
|
{
|
||||||
static bool colored = (!qgetenv("QTEST_COLORED").isEmpty());
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QAbstractTestLogger::Pass:
|
case QAbstractTestLogger::Pass:
|
||||||
return COLORED_MSG(0, 32, "PASS "); //green
|
return "PASS ";
|
||||||
case QAbstractTestLogger::XFail:
|
case QAbstractTestLogger::XFail:
|
||||||
return COLORED_MSG(1, 32, "XFAIL "); //light green
|
return "XFAIL ";
|
||||||
case QAbstractTestLogger::Fail:
|
case QAbstractTestLogger::Fail:
|
||||||
return COLORED_MSG(0, 31, "FAIL! "); //red
|
return "FAIL! ";
|
||||||
case QAbstractTestLogger::XPass:
|
case QAbstractTestLogger::XPass:
|
||||||
return COLORED_MSG(0, 31, "XPASS "); //red, too
|
return "XPASS ";
|
||||||
}
|
}
|
||||||
return "??????";
|
return "??????";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *benchmarkResult2String()
|
static const char *benchmarkResult2String()
|
||||||
{
|
{
|
||||||
static bool colored = (!qgetenv("QTEST_COLORED").isEmpty());
|
return "RESULT ";
|
||||||
return COLORED_MSG(0, 36, "RESULT "); // cyan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *messageType2String(QAbstractTestLogger::MessageTypes type)
|
static const char *messageType2String(QAbstractTestLogger::MessageTypes type)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
static bool colored = (!qgetenv("QTEST_COLORED").isEmpty());
|
|
||||||
#else
|
|
||||||
static bool colored = ::getenv("QTEST_COLORED");
|
|
||||||
#endif
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QAbstractTestLogger::Skip:
|
case QAbstractTestLogger::Skip:
|
||||||
return COLORED_MSG(0, 37, "SKIP "); //white
|
return "SKIP ";
|
||||||
case QAbstractTestLogger::Warn:
|
case QAbstractTestLogger::Warn:
|
||||||
return COLORED_MSG(0, 33, "WARNING"); // yellow
|
return "WARNING";
|
||||||
case QAbstractTestLogger::QWarning:
|
case QAbstractTestLogger::QWarning:
|
||||||
return COLORED_MSG(1, 33, "QWARN ");
|
return "QWARN ";
|
||||||
case QAbstractTestLogger::QDebug:
|
case QAbstractTestLogger::QDebug:
|
||||||
return COLORED_MSG(1, 33, "QDEBUG ");
|
return "QDEBUG ";
|
||||||
case QAbstractTestLogger::QSystem:
|
case QAbstractTestLogger::QSystem:
|
||||||
return COLORED_MSG(1, 33, "QSYSTEM");
|
return "QSYSTEM";
|
||||||
case QAbstractTestLogger::QFatal:
|
case QAbstractTestLogger::QFatal:
|
||||||
return COLORED_MSG(0, 31, "QFATAL "); // red
|
return "QFATAL ";
|
||||||
case QAbstractTestLogger::Info:
|
case QAbstractTestLogger::Info:
|
||||||
return "INFO "; // no coloring
|
return "INFO ";
|
||||||
}
|
}
|
||||||
return "??????";
|
return "??????";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void outputMessage(const char *str)
|
|
||||||
{
|
|
||||||
#if defined(Q_OS_WINCE)
|
|
||||||
QString strUtf16 = QString::fromLatin1(str);
|
|
||||||
const int maxOutputLength = 255;
|
|
||||||
do {
|
|
||||||
QString tmp = strUtf16.left(maxOutputLength);
|
|
||||||
OutputDebugString((wchar_t*)tmp.utf16());
|
|
||||||
strUtf16.remove(0, maxOutputLength);
|
|
||||||
} while (!strUtf16.isEmpty());
|
|
||||||
if (QTestLog::outputFileName())
|
|
||||||
#elif defined(Q_OS_WIN)
|
|
||||||
EnterCriticalSection(&outputCriticalSection);
|
|
||||||
// OutputDebugString is not threadsafe
|
|
||||||
OutputDebugStringA(str);
|
|
||||||
LeaveCriticalSection(&outputCriticalSection);
|
|
||||||
#elif defined(Q_OS_SYMBIAN)
|
|
||||||
// RDebug::Print has a cap of 256 characters so break it up
|
|
||||||
TPtrC8 ptr(reinterpret_cast<const TUint8*>(str));
|
|
||||||
_LIT(format, "[QTestLib] %S");
|
|
||||||
const int maxBlockSize = 256 - ((const TDesC &)format).Length();
|
|
||||||
HBufC* hbuffer = HBufC::New(maxBlockSize);
|
|
||||||
if(hbuffer) {
|
|
||||||
for (int i = 0; i < ptr.Length(); i += maxBlockSize) {
|
|
||||||
int size = Min(maxBlockSize, ptr.Length() - i);
|
|
||||||
hbuffer->Des().Copy(ptr.Mid(i, size));
|
|
||||||
RDebug::Print(format, hbuffer);
|
|
||||||
}
|
|
||||||
delete hbuffer;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// fast, no allocations, but truncates silently
|
|
||||||
RDebug::RawPrint(format);
|
|
||||||
TPtrC8 ptr(reinterpret_cast<const TUint8*>(str));
|
|
||||||
RDebug::RawPrint(ptr);
|
|
||||||
RDebug::RawPrint(_L8("\n"));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
QAbstractTestLogger::outputString(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void printMessage(const char *type, const char *msg, const char *file = 0, int line = 0)
|
|
||||||
{
|
|
||||||
QTEST_ASSERT(type);
|
|
||||||
QTEST_ASSERT(msg);
|
|
||||||
|
|
||||||
QTestCharBuffer buf;
|
|
||||||
|
|
||||||
const char *fn = QTestResult::currentTestFunction() ? QTestResult::currentTestFunction()
|
|
||||||
: "UnknownTestFunc";
|
|
||||||
const char *tag = QTestResult::currentDataTag() ? QTestResult::currentDataTag() : "";
|
|
||||||
const char *gtag = QTestResult::currentGlobalDataTag()
|
|
||||||
? QTestResult::currentGlobalDataTag()
|
|
||||||
: "";
|
|
||||||
const char *filler = (tag[0] && gtag[0]) ? ":" : "";
|
|
||||||
if (file) {
|
|
||||||
QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n"
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
"%s(%d) : failure location\n"
|
|
||||||
#else
|
|
||||||
" Loc: [%s(%d)]\n"
|
|
||||||
#endif
|
|
||||||
, type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
|
|
||||||
msg[0] ? " " : "", msg, file, line);
|
|
||||||
} else {
|
|
||||||
QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n",
|
|
||||||
type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
|
|
||||||
msg[0] ? " " : "", msg);
|
|
||||||
}
|
|
||||||
// In colored mode, printf above stripped our nonprintable control characters.
|
|
||||||
// Put them back.
|
|
||||||
memcpy(buf.data(), type, strlen(type));
|
|
||||||
outputMessage(buf.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static int countSignificantDigits(T num)
|
static int countSignificantDigits(T num)
|
||||||
{
|
{
|
||||||
@ -313,74 +199,149 @@ namespace QTest {
|
|||||||
int size = result.count();
|
int size = result.count();
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// static void printBenchmarkResult(const char *bmtag, int value, int iterations)
|
void QPlainTestLogger::outputMessage(const char *str)
|
||||||
static void printBenchmarkResult(const QBenchmarkResult &result)
|
{
|
||||||
{
|
#if defined(Q_OS_WINCE)
|
||||||
const char *bmtag = QTest::benchmarkResult2String();
|
QString strUtf16 = QString::fromLatin1(str);
|
||||||
|
const int maxOutputLength = 255;
|
||||||
char buf1[1024];
|
do {
|
||||||
QTest::qt_snprintf(
|
QString tmp = strUtf16.left(maxOutputLength);
|
||||||
buf1, sizeof(buf1), "%s: %s::%s",
|
OutputDebugString((wchar_t*)tmp.utf16());
|
||||||
bmtag,
|
strUtf16.remove(0, maxOutputLength);
|
||||||
QTestResult::currentTestObjectName(),
|
} while (!strUtf16.isEmpty());
|
||||||
result.context.slotName.toAscii().data());
|
if (QTestLog::outputFileName())
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
char bufTag[1024];
|
EnterCriticalSection(&QTest::outputCriticalSection);
|
||||||
bufTag[0] = 0;
|
// OutputDebugString is not threadsafe
|
||||||
QByteArray tag = result.context.tag.toAscii();
|
OutputDebugStringA(str);
|
||||||
if (tag.isEmpty() == false) {
|
LeaveCriticalSection(&QTest::outputCriticalSection);
|
||||||
QTest::qt_snprintf(bufTag, sizeof(bufTag), ":\"%s\"", tag.data());
|
#elif defined(Q_OS_SYMBIAN)
|
||||||
|
// RDebug::Print has a cap of 256 characters so break it up
|
||||||
|
TPtrC8 ptr(reinterpret_cast<const TUint8*>(str));
|
||||||
|
_LIT(format, "[QTestLib] %S");
|
||||||
|
const int maxBlockSize = 256 - ((const TDesC &)format).Length();
|
||||||
|
HBufC* hbuffer = HBufC::New(maxBlockSize);
|
||||||
|
if (hbuffer) {
|
||||||
|
for (int i = 0; i < ptr.Length(); i += maxBlockSize) {
|
||||||
|
int size = Min(maxBlockSize, ptr.Length() - i);
|
||||||
|
hbuffer->Des().Copy(ptr.Mid(i, size));
|
||||||
|
RDebug::Print(format, hbuffer);
|
||||||
}
|
}
|
||||||
|
delete hbuffer;
|
||||||
|
|
||||||
char fillFormat[8];
|
|
||||||
int fillLength = 5;
|
|
||||||
QTest::qt_snprintf(
|
|
||||||
fillFormat, sizeof(fillFormat), ":\n%%%ds", fillLength);
|
|
||||||
char fill[1024];
|
|
||||||
QTest::qt_snprintf(fill, sizeof(fill), fillFormat, "");
|
|
||||||
|
|
||||||
const char * unitText = QTest::benchmarkMetricUnit(result.metric);
|
|
||||||
|
|
||||||
qreal valuePerIteration = qreal(result.value) / qreal(result.iterations);
|
|
||||||
char resultBuffer[100] = "";
|
|
||||||
formatResult(resultBuffer, 100, valuePerIteration, countSignificantDigits(result.value));
|
|
||||||
|
|
||||||
char buf2[1024];
|
|
||||||
QTest::qt_snprintf(
|
|
||||||
buf2, sizeof(buf2), "%s %s",
|
|
||||||
resultBuffer,
|
|
||||||
unitText);
|
|
||||||
|
|
||||||
char buf2_[1024];
|
|
||||||
QByteArray iterationText = " per iteration";
|
|
||||||
Q_ASSERT(result.iterations > 0);
|
|
||||||
QTest::qt_snprintf(
|
|
||||||
buf2_,
|
|
||||||
sizeof(buf2_), "%s",
|
|
||||||
iterationText.data());
|
|
||||||
|
|
||||||
char buf3[1024];
|
|
||||||
Q_ASSERT(result.iterations > 0);
|
|
||||||
formatResult(resultBuffer, 100, result.value, countSignificantDigits(result.value));
|
|
||||||
QTest::qt_snprintf(
|
|
||||||
buf3, sizeof(buf3), " (total: %s, iterations: %d)",
|
|
||||||
resultBuffer,
|
|
||||||
result.iterations);
|
|
||||||
|
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
if (result.setByMacro) {
|
|
||||||
QTest::qt_snprintf(
|
|
||||||
buf, sizeof(buf), "%s%s%s%s%s%s\n", buf1, bufTag, fill, buf2, buf2_, buf3);
|
|
||||||
} else {
|
|
||||||
QTest::qt_snprintf(buf, sizeof(buf), "%s%s%s%s\n", buf1, bufTag, fill, buf2);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(buf, bmtag, strlen(bmtag));
|
|
||||||
outputMessage(buf);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// fast, no allocations, but truncates silently
|
||||||
|
RDebug::RawPrint(format);
|
||||||
|
TPtrC8 ptr(reinterpret_cast<const TUint8*>(str));
|
||||||
|
RDebug::RawPrint(ptr);
|
||||||
|
RDebug::RawPrint(_L8("\n"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
outputString(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPlainTestLogger::printMessage(const char *type, const char *msg, const char *file, int line)
|
||||||
|
{
|
||||||
|
QTEST_ASSERT(type);
|
||||||
|
QTEST_ASSERT(msg);
|
||||||
|
|
||||||
|
QTestCharBuffer buf;
|
||||||
|
|
||||||
|
const char *fn = QTestResult::currentTestFunction() ? QTestResult::currentTestFunction()
|
||||||
|
: "UnknownTestFunc";
|
||||||
|
const char *tag = QTestResult::currentDataTag() ? QTestResult::currentDataTag() : "";
|
||||||
|
const char *gtag = QTestResult::currentGlobalDataTag()
|
||||||
|
? QTestResult::currentGlobalDataTag()
|
||||||
|
: "";
|
||||||
|
const char *filler = (tag[0] && gtag[0]) ? ":" : "";
|
||||||
|
if (file) {
|
||||||
|
QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n"
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
"%s(%d) : failure location\n"
|
||||||
|
#else
|
||||||
|
" Loc: [%s(%d)]\n"
|
||||||
|
#endif
|
||||||
|
, type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
|
||||||
|
msg[0] ? " " : "", msg, file, line);
|
||||||
|
} else {
|
||||||
|
QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n",
|
||||||
|
type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
|
||||||
|
msg[0] ? " " : "", msg);
|
||||||
|
}
|
||||||
|
// In colored mode, printf above stripped our nonprintable control characters.
|
||||||
|
// Put them back.
|
||||||
|
memcpy(buf.data(), type, strlen(type));
|
||||||
|
outputMessage(buf.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
//void QPlainTestLogger::printBenchmarkResult(const char *bmtag, int value, int iterations)
|
||||||
|
void QPlainTestLogger::printBenchmarkResult(const QBenchmarkResult &result)
|
||||||
|
{
|
||||||
|
const char *bmtag = QTest::benchmarkResult2String();
|
||||||
|
|
||||||
|
char buf1[1024];
|
||||||
|
QTest::qt_snprintf(
|
||||||
|
buf1, sizeof(buf1), "%s: %s::%s",
|
||||||
|
bmtag,
|
||||||
|
QTestResult::currentTestObjectName(),
|
||||||
|
result.context.slotName.toAscii().data());
|
||||||
|
|
||||||
|
char bufTag[1024];
|
||||||
|
bufTag[0] = 0;
|
||||||
|
QByteArray tag = result.context.tag.toAscii();
|
||||||
|
if (tag.isEmpty() == false) {
|
||||||
|
QTest::qt_snprintf(bufTag, sizeof(bufTag), ":\"%s\"", tag.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char fillFormat[8];
|
||||||
|
int fillLength = 5;
|
||||||
|
QTest::qt_snprintf(
|
||||||
|
fillFormat, sizeof(fillFormat), ":\n%%%ds", fillLength);
|
||||||
|
char fill[1024];
|
||||||
|
QTest::qt_snprintf(fill, sizeof(fill), fillFormat, "");
|
||||||
|
|
||||||
|
const char * unitText = QTest::benchmarkMetricUnit(result.metric);
|
||||||
|
|
||||||
|
qreal valuePerIteration = qreal(result.value) / qreal(result.iterations);
|
||||||
|
char resultBuffer[100] = "";
|
||||||
|
QTest::formatResult(resultBuffer, 100, valuePerIteration, QTest::countSignificantDigits(result.value));
|
||||||
|
|
||||||
|
char buf2[1024];
|
||||||
|
QTest::qt_snprintf(
|
||||||
|
buf2, sizeof(buf2), "%s %s",
|
||||||
|
resultBuffer,
|
||||||
|
unitText);
|
||||||
|
|
||||||
|
char buf2_[1024];
|
||||||
|
QByteArray iterationText = " per iteration";
|
||||||
|
Q_ASSERT(result.iterations > 0);
|
||||||
|
QTest::qt_snprintf(
|
||||||
|
buf2_,
|
||||||
|
sizeof(buf2_), "%s",
|
||||||
|
iterationText.data());
|
||||||
|
|
||||||
|
char buf3[1024];
|
||||||
|
Q_ASSERT(result.iterations > 0);
|
||||||
|
QTest::formatResult(resultBuffer, 100, result.value, QTest::countSignificantDigits(result.value));
|
||||||
|
QTest::qt_snprintf(
|
||||||
|
buf3, sizeof(buf3), " (total: %s, iterations: %d)",
|
||||||
|
resultBuffer,
|
||||||
|
result.iterations);
|
||||||
|
|
||||||
|
char buf[1024];
|
||||||
|
|
||||||
|
if (result.setByMacro) {
|
||||||
|
QTest::qt_snprintf(
|
||||||
|
buf, sizeof(buf), "%s%s%s%s%s%s\n", buf1, bufTag, fill, buf2, buf2_, buf3);
|
||||||
|
} else {
|
||||||
|
QTest::qt_snprintf(buf, sizeof(buf), "%s%s%s%s\n", buf1, bufTag, fill, buf2);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(buf, bmtag, strlen(bmtag));
|
||||||
|
outputMessage(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlainTestLogger::QPlainTestLogger()
|
QPlainTestLogger::QPlainTestLogger()
|
||||||
@ -388,15 +349,6 @@ QPlainTestLogger::QPlainTestLogger()
|
|||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||||
InitializeCriticalSection(&QTest::outputCriticalSection);
|
InitializeCriticalSection(&QTest::outputCriticalSection);
|
||||||
QTest::hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
||||||
if (QTest::hConsole != INVALID_HANDLE_VALUE) {
|
|
||||||
CONSOLE_SCREEN_BUFFER_INFO info;
|
|
||||||
if (GetConsoleScreenBufferInfo(QTest::hConsole, &info)) {
|
|
||||||
QTest::consoleAttributes = info.wAttributes;
|
|
||||||
} else {
|
|
||||||
QTest::hConsole = INVALID_HANDLE_VALUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,9 +359,9 @@ QPlainTestLogger::~QPlainTestLogger()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPlainTestLogger::startLogging()
|
void QPlainTestLogger::startLogging(const char *filename)
|
||||||
{
|
{
|
||||||
QAbstractTestLogger::startLogging();
|
QAbstractTestLogger::startLogging(filename);
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
if (QTestLog::verboseLevel() < 0) {
|
if (QTestLog::verboseLevel() < 0) {
|
||||||
@ -428,7 +380,7 @@ void QPlainTestLogger::startLogging()
|
|||||||
", Qt %s\n", QTestResult::currentTestObjectName(), qVersion());
|
", Qt %s\n", QTestResult::currentTestObjectName(), qVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QTest::outputMessage(buf);
|
outputMessage(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPlainTestLogger::stopLogging()
|
void QPlainTestLogger::stopLogging()
|
||||||
@ -445,7 +397,7 @@ void QPlainTestLogger::stopLogging()
|
|||||||
QTestResult::passCount(), QTestResult::failCount(),
|
QTestResult::passCount(), QTestResult::failCount(),
|
||||||
QTestResult::skipCount(), QTestResult::currentTestObjectName());
|
QTestResult::skipCount(), QTestResult::currentTestObjectName());
|
||||||
}
|
}
|
||||||
QTest::outputMessage(buf);
|
outputMessage(buf);
|
||||||
|
|
||||||
QAbstractTestLogger::stopLogging();
|
QAbstractTestLogger::stopLogging();
|
||||||
}
|
}
|
||||||
@ -454,7 +406,7 @@ void QPlainTestLogger::stopLogging()
|
|||||||
void QPlainTestLogger::enterTestFunction(const char * /*function*/)
|
void QPlainTestLogger::enterTestFunction(const char * /*function*/)
|
||||||
{
|
{
|
||||||
if (QTestLog::verboseLevel() >= 1)
|
if (QTestLog::verboseLevel() >= 1)
|
||||||
QTest::printMessage(QTest::messageType2String(Info), "entering");
|
printMessage(QTest::messageType2String(Info), "entering");
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPlainTestLogger::leaveTestFunction()
|
void QPlainTestLogger::leaveTestFunction()
|
||||||
@ -468,13 +420,13 @@ void QPlainTestLogger::addIncident(IncidentTypes type, const char *description,
|
|||||||
if (type == QAbstractTestLogger::Pass && QTestLog::verboseLevel() < 0)
|
if (type == QAbstractTestLogger::Pass && QTestLog::verboseLevel() < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QTest::printMessage(QTest::incidentType2String(type), description, file, line);
|
printMessage(QTest::incidentType2String(type), description, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPlainTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
|
void QPlainTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
|
||||||
{
|
{
|
||||||
// QTest::printBenchmarkResult(QTest::benchmarkResult2String(), value, iterations);
|
// printBenchmarkResult(QTest::benchmarkResult2String(), value, iterations);
|
||||||
QTest::printBenchmarkResult(result);
|
printBenchmarkResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPlainTestLogger::addMessage(MessageTypes type, const char *message,
|
void QPlainTestLogger::addMessage(MessageTypes type, const char *message,
|
||||||
@ -485,7 +437,7 @@ void QPlainTestLogger::addMessage(MessageTypes type, const char *message,
|
|||||||
&& QTestLog::verboseLevel() < 0)
|
&& QTestLog::verboseLevel() < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QTest::printMessage(QTest::messageType2String(type), message, file, line);
|
printMessage(QTest::messageType2String(type), message, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPlainTestLogger::registerRandomSeed(unsigned int seed)
|
void QPlainTestLogger::registerRandomSeed(unsigned int seed)
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
QPlainTestLogger();
|
QPlainTestLogger();
|
||||||
~QPlainTestLogger();
|
~QPlainTestLogger();
|
||||||
|
|
||||||
void startLogging();
|
void startLogging(const char *filename);
|
||||||
void stopLogging();
|
void stopLogging();
|
||||||
|
|
||||||
void enterTestFunction(const char *function);
|
void enterTestFunction(const char *function);
|
||||||
@ -79,6 +79,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
unsigned int randomSeed;
|
unsigned int randomSeed;
|
||||||
bool hasRandomSeed;
|
bool hasRandomSeed;
|
||||||
|
|
||||||
|
void printMessage(const char *type, const char *msg, const char *file = 0, int line = 0);
|
||||||
|
void outputMessage(const char *str);
|
||||||
|
void printBenchmarkResult(const QBenchmarkResult &result);
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -50,9 +50,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
QT_MODULE(Test)
|
QT_MODULE(Test)
|
||||||
|
|
||||||
#ifdef QTEST_EMBED
|
#if !defined(QT_SHARED) && !(defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT))
|
||||||
# define Q_TESTLIB_EXPORT
|
|
||||||
#elif !defined(QT_SHARED) && !(defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT))
|
|
||||||
# define Q_TESTLIB_EXPORT
|
# define Q_TESTLIB_EXPORT
|
||||||
#else
|
#else
|
||||||
# ifdef QTESTLIB_MAKEDLL
|
# ifdef QTESTLIB_MAKEDLL
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include "qtestlogger_p.h"
|
#include "qtestlogger_p.h"
|
||||||
#include "qtestelement.h"
|
#include "qtestelement.h"
|
||||||
#include "qtestelementattribute.h"
|
#include "qtestelementattribute.h"
|
||||||
#include "QtTest/private/qtestlog_p.h"
|
|
||||||
#include "qtestassert.h"
|
#include "qtestassert.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -55,14 +54,10 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace QTest
|
QTestBasicStreamer::QTestBasicStreamer(QTestLogger *logger)
|
||||||
{
|
:testLogger(logger)
|
||||||
static FILE *stream = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTestBasicStreamer::QTestBasicStreamer()
|
|
||||||
:testLogger(0)
|
|
||||||
{
|
{
|
||||||
|
QTEST_ASSERT(testLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestBasicStreamer::~QTestBasicStreamer()
|
QTestBasicStreamer::~QTestBasicStreamer()
|
||||||
@ -158,59 +153,10 @@ void QTestBasicStreamer::outputElementAttributes(const QTestElement* element, QT
|
|||||||
|
|
||||||
void QTestBasicStreamer::outputString(const char *msg) const
|
void QTestBasicStreamer::outputString(const char *msg) const
|
||||||
{
|
{
|
||||||
QTEST_ASSERT(QTest::stream);
|
testLogger->outputString(msg);
|
||||||
|
|
||||||
::fputs(msg, QTest::stream);
|
|
||||||
::fflush(QTest::stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestBasicStreamer::startStreaming()
|
QTestLogger *QTestBasicStreamer::logger() const
|
||||||
{
|
|
||||||
QTEST_ASSERT(!QTest::stream);
|
|
||||||
|
|
||||||
const char *out = QTestLog::outputFileName();
|
|
||||||
if (!out) {
|
|
||||||
QTest::stream = stdout;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
|
|
||||||
if (::fopen_s(&QTest::stream, out, "wt")) {
|
|
||||||
#else
|
|
||||||
QTest::stream = ::fopen(out, "wt");
|
|
||||||
if (!QTest::stream) {
|
|
||||||
#endif
|
|
||||||
printf("Unable to open file for logging: %s", out);
|
|
||||||
::exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QTestBasicStreamer::isTtyOutput()
|
|
||||||
{
|
|
||||||
QTEST_ASSERT(QTest::stream);
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_INTEGRITY)
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
static bool ttyoutput = isatty(fileno(QTest::stream));
|
|
||||||
return ttyoutput;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTestBasicStreamer::stopStreaming()
|
|
||||||
{
|
|
||||||
QTEST_ASSERT(QTest::stream);
|
|
||||||
if (QTest::stream != stdout)
|
|
||||||
fclose(QTest::stream);
|
|
||||||
|
|
||||||
QTest::stream = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTestBasicStreamer::setLogger(const QTestLogger *tstLogger)
|
|
||||||
{
|
|
||||||
testLogger = tstLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QTestLogger *QTestBasicStreamer::logger() const
|
|
||||||
{
|
{
|
||||||
return testLogger;
|
return testLogger;
|
||||||
}
|
}
|
||||||
|
@ -58,18 +58,14 @@ struct QTestCharBuffer;
|
|||||||
class QTestBasicStreamer
|
class QTestBasicStreamer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QTestBasicStreamer();
|
QTestBasicStreamer(QTestLogger *logger);
|
||||||
virtual ~QTestBasicStreamer();
|
virtual ~QTestBasicStreamer();
|
||||||
|
|
||||||
virtual void output(QTestElement *element) const;
|
virtual void output(QTestElement *element) const;
|
||||||
|
|
||||||
void outputString(const char *msg) const;
|
void outputString(const char *msg) const;
|
||||||
bool isTtyOutput();
|
|
||||||
void startStreaming();
|
|
||||||
void stopStreaming();
|
|
||||||
|
|
||||||
void setLogger(const QTestLogger *tstLogger);
|
QTestLogger *logger() const;
|
||||||
const QTestLogger *logger() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
|
virtual void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
|
||||||
@ -81,7 +77,7 @@ class QTestBasicStreamer
|
|||||||
virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const;
|
virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QTestLogger *testLogger;
|
QTestLogger *testLogger;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -972,12 +972,6 @@ void seedRandom()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int qTestRandomSeed()
|
|
||||||
{
|
|
||||||
Q_ASSERT(QTest::seedSet);
|
|
||||||
return QTest::seed;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void swap(T * array, int pos, int otherPos)
|
void swap(T * array, int pos, int otherPos)
|
||||||
{
|
{
|
||||||
@ -1018,12 +1012,12 @@ Q_TESTLIB_EXPORT bool printAvailableFunctions = false;
|
|||||||
Q_TESTLIB_EXPORT QStringList testFunctions;
|
Q_TESTLIB_EXPORT QStringList testFunctions;
|
||||||
Q_TESTLIB_EXPORT QStringList testTags;
|
Q_TESTLIB_EXPORT QStringList testTags;
|
||||||
|
|
||||||
static void qPrintTestSlots()
|
static void qPrintTestSlots(FILE *stream)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
|
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
|
||||||
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
|
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
|
||||||
if (isValidSlot(sl))
|
if (isValidSlot(sl))
|
||||||
printf("%s\n", sl.signature());
|
fprintf(stream, "%s\n", sl.signature());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1032,7 +1026,7 @@ static int qToInt(char *str)
|
|||||||
char *pEnd;
|
char *pEnd;
|
||||||
int l = (int)strtol(str, &pEnd, 10);
|
int l = (int)strtol(str, &pEnd, 10);
|
||||||
if (*pEnd != 0) {
|
if (*pEnd != 0) {
|
||||||
printf("Invalid numeric parameter: '%s'\n", str);
|
fprintf(stderr, "Invalid numeric parameter: '%s'\n", str);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
@ -1100,7 +1094,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
if (qml) {
|
if (qml) {
|
||||||
QTest::printAvailableFunctions = true;
|
QTest::printAvailableFunctions = true;
|
||||||
} else {
|
} else {
|
||||||
qPrintTestSlots();
|
qPrintTestSlots(stdout);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
} else if(strcmp(argv[i], "-xunitxml") == 0){
|
} else if(strcmp(argv[i], "-xunitxml") == 0){
|
||||||
@ -1109,8 +1103,8 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
QTestLog::setLogMode(QTestLog::XML);
|
QTestLog::setLogMode(QTestLog::XML);
|
||||||
} else if (strcmp(argv[i], "-lightxml") == 0) {
|
} else if (strcmp(argv[i], "-lightxml") == 0) {
|
||||||
QTestLog::setLogMode(QTestLog::LightXML);
|
QTestLog::setLogMode(QTestLog::LightXML);
|
||||||
}else if(strcmp(argv[i], "-flush") == 0){
|
} else if (strcmp(argv[i], "-flush") == 0){
|
||||||
QTestLog::setFlushMode(QTestLog::FLushOn);
|
QTestLog::setFlushMode(QTestLog::FlushOn);
|
||||||
} else if (strcmp(argv[i], "-silent") == 0) {
|
} else if (strcmp(argv[i], "-silent") == 0) {
|
||||||
QTestLog::setVerboseLevel(-1);
|
QTestLog::setVerboseLevel(-1);
|
||||||
} else if (strcmp(argv[i], "-v1") == 0) {
|
} else if (strcmp(argv[i], "-v1") == 0) {
|
||||||
@ -1121,35 +1115,35 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
QSignalDumper::startDump();
|
QSignalDumper::startDump();
|
||||||
} else if (strcmp(argv[i], "-o") == 0) {
|
} else if (strcmp(argv[i], "-o") == 0) {
|
||||||
if (i + 1 >= argc) {
|
if (i + 1 >= argc) {
|
||||||
printf("-o needs an extra parameter specifying the filename\n");
|
fprintf(stderr, "-o needs an extra parameter specifying the filename\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
QTestLog::redirectOutput(argv[++i]);
|
QTestLog::redirectOutput(argv[++i]);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-eventdelay") == 0) {
|
} else if (strcmp(argv[i], "-eventdelay") == 0) {
|
||||||
if (i + 1 >= argc) {
|
if (i + 1 >= argc) {
|
||||||
printf("-eventdelay needs an extra parameter to indicate the delay(ms)\n");
|
fprintf(stderr, "-eventdelay needs an extra parameter to indicate the delay(ms)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
QTest::eventDelay = qToInt(argv[++i]);
|
QTest::eventDelay = qToInt(argv[++i]);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-keydelay") == 0) {
|
} else if (strcmp(argv[i], "-keydelay") == 0) {
|
||||||
if (i + 1 >= argc) {
|
if (i + 1 >= argc) {
|
||||||
printf("-keydelay needs an extra parameter to indicate the delay(ms)\n");
|
fprintf(stderr, "-keydelay needs an extra parameter to indicate the delay(ms)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
QTest::keyDelay = qToInt(argv[++i]);
|
QTest::keyDelay = qToInt(argv[++i]);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-mousedelay") == 0) {
|
} else if (strcmp(argv[i], "-mousedelay") == 0) {
|
||||||
if (i + 1 >= argc) {
|
if (i + 1 >= argc) {
|
||||||
printf("-mousedelay needs an extra parameter to indicate the delay(ms)\n");
|
fprintf(stderr, "-mousedelay needs an extra parameter to indicate the delay(ms)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
QTest::mouseDelay = qToInt(argv[++i]);
|
QTest::mouseDelay = qToInt(argv[++i]);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-maxwarnings") == 0) {
|
} else if (strcmp(argv[i], "-maxwarnings") == 0) {
|
||||||
if (i + 1 >= argc) {
|
if (i + 1 >= argc) {
|
||||||
printf("-maxwarnings needs an extra parameter with the amount of warnings\n");
|
fprintf(stderr, "-maxwarnings needs an extra parameter with the amount of warnings\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
QTestLog::setMaxWarnings(qToInt(argv[++i]));
|
QTestLog::setMaxWarnings(qToInt(argv[++i]));
|
||||||
@ -1166,10 +1160,10 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
if (QFileInfo(QDir::currentPath()).isWritable()) {
|
if (QFileInfo(QDir::currentPath()).isWritable()) {
|
||||||
QBenchmarkGlobalData::current->setMode(QBenchmarkGlobalData::CallgrindParentProcess);
|
QBenchmarkGlobalData::current->setMode(QBenchmarkGlobalData::CallgrindParentProcess);
|
||||||
} else {
|
} else {
|
||||||
printf("WARNING: Current directory not writable. Using the walltime measurer.\n");
|
fprintf(stderr, "WARNING: Current directory not writable. Using the walltime measurer.\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("WARNING: Valgrind not found or too old. Make sure it is installed and in your path. "
|
fprintf(stderr, "WARNING: Valgrind not found or too old. Make sure it is installed and in your path. "
|
||||||
"Using the walltime measurer.\n");
|
"Using the walltime measurer.\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-callgrindchild") == 0) { // "private" option
|
} else if (strcmp(argv[i], "-callgrindchild") == 0) { // "private" option
|
||||||
@ -1194,28 +1188,28 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
QTest::seed = longSeed;
|
QTest::seed = longSeed;
|
||||||
}
|
}
|
||||||
if (!argumentOk) {
|
if (!argumentOk) {
|
||||||
printf("-seed needs an extra positive integer parameter to specify the seed\n");
|
fprintf(stderr, "-seed needs an extra positive integer parameter to specify the seed\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
QTest::seedSet = true;
|
QTest::seedSet = true;
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-minimumvalue") == 0) {
|
} else if (strcmp(argv[i], "-minimumvalue") == 0) {
|
||||||
if (i + 1 >= argc) {
|
if (i + 1 >= argc) {
|
||||||
printf("-minimumvalue needs an extra parameter to indicate the minimum time(ms)\n");
|
fprintf(stderr, "-minimumvalue needs an extra parameter to indicate the minimum time(ms)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
QBenchmarkGlobalData::current->walltimeMinimum = qToInt(argv[++i]);
|
QBenchmarkGlobalData::current->walltimeMinimum = qToInt(argv[++i]);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-iterations") == 0) {
|
} else if (strcmp(argv[i], "-iterations") == 0) {
|
||||||
if (i + 1 >= argc) {
|
if (i + 1 >= argc) {
|
||||||
printf("-iterations needs an extra parameter to indicate the number of iterations\n");
|
fprintf(stderr, "-iterations needs an extra parameter to indicate the number of iterations\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
QBenchmarkGlobalData::current->iterationCount = qToInt(argv[++i]);
|
QBenchmarkGlobalData::current->iterationCount = qToInt(argv[++i]);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-median") == 0) {
|
} else if (strcmp(argv[i], "-median") == 0) {
|
||||||
if (i + 1 >= argc) {
|
if (i + 1 >= argc) {
|
||||||
printf("-median needs an extra parameter to indicate the number of median iterations\n");
|
fprintf(stderr, "-median needs an extra parameter to indicate the number of median iterations\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
QBenchmarkGlobalData::current->medianIterationCount = qToInt(argv[++i]);
|
QBenchmarkGlobalData::current->medianIterationCount = qToInt(argv[++i]);
|
||||||
@ -1223,30 +1217,28 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
|
|
||||||
} else if (strcmp(argv[i], "-vb") == 0) {
|
} else if (strcmp(argv[i], "-vb") == 0) {
|
||||||
QBenchmarkGlobalData::current->verboseOutput = true;
|
QBenchmarkGlobalData::current->verboseOutput = true;
|
||||||
} else if (strcmp(argv[i], "-chart") == 0) {
|
|
||||||
fprintf(stderr, "Warning: `-chart' option is not available\n");
|
|
||||||
} else if (strcmp(argv[i], "-qws") == 0) {
|
} else if (strcmp(argv[i], "-qws") == 0) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else if (strcmp(argv[i], "-graphicssystem") == 0) {
|
} else if (strcmp(argv[i], "-graphicssystem") == 0) {
|
||||||
// do nothing
|
// do nothing
|
||||||
if (i + 1 >= argc) {
|
if (i + 1 >= argc) {
|
||||||
printf("-graphicssystem needs an extra parameter specifying the graphics system\n");
|
fprintf(stderr, "-graphicssystem needs an extra parameter specifying the graphics system\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
} else if (argv[i][0] == '-') {
|
} else if (argv[i][0] == '-') {
|
||||||
printf("Unknown option: '%s'\n\n%s", argv[i], testOptions);
|
fprintf(stderr, "Unknown option: '%s'\n\n%s", argv[i], testOptions);
|
||||||
if (qml) {
|
if (qml) {
|
||||||
printf ("\nqmltest related options:\n"
|
fprintf(stderr, "\nqmltest related options:\n"
|
||||||
" -import : Specify an import directory.\n"
|
" -import : Specify an import directory.\n"
|
||||||
" -input : Specify the root directory for test cases.\n"
|
" -input : Specify the root directory for test cases.\n"
|
||||||
" -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
|
" -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n"
|
fprintf(stderr, "\n"
|
||||||
" -help : This help\n");
|
" -help : This help\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else if (qml) {
|
} else if (qml) {
|
||||||
// We can't check the availability of test functions until
|
// We can't check the availability of test functions until
|
||||||
@ -1275,9 +1267,9 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
QString::fromLatin1(argv[i] + colon + 1);
|
QString::fromLatin1(argv[i] + colon + 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!QTest::testFuncs) {
|
if (!QTest::testFuncs) {
|
||||||
QTest::testFuncs = new QTest::TestFunction[512];
|
QTest::testFuncs = new QTest::TestFunction[512];
|
||||||
}
|
}
|
||||||
|
|
||||||
int colon = -1;
|
int colon = -1;
|
||||||
char buf[512], *data=0;
|
char buf[512], *data=0;
|
||||||
@ -1295,19 +1287,19 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
QTest::qt_snprintf(buf + off, qMin(512 - off, 3), "()"); // append "()"
|
QTest::qt_snprintf(buf + off, qMin(512 - off, 3), "()"); // append "()"
|
||||||
int idx = QTest::currentTestObject->metaObject()->indexOfMethod(buf);
|
int idx = QTest::currentTestObject->metaObject()->indexOfMethod(buf);
|
||||||
if (idx < 0 || !isValidSlot(QTest::currentTestObject->metaObject()->method(idx))) {
|
if (idx < 0 || !isValidSlot(QTest::currentTestObject->metaObject()->method(idx))) {
|
||||||
printf("Unknown testfunction: '%s'\n", buf);
|
fprintf(stderr, "Unknown testfunction: '%s'\n", buf);
|
||||||
printf("Available testfunctions:\n");
|
fprintf(stderr, "Available testfunctions:\n");
|
||||||
qPrintTestSlots();
|
qPrintTestSlots(stderr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
testFuncs[testFuncCount].set(idx, data);
|
testFuncs[testFuncCount].set(idx, data);
|
||||||
testFuncCount++;
|
testFuncCount++;
|
||||||
QTEST_ASSERT(QTest::testFuncCount < 512);
|
QTEST_ASSERT(QTest::testFuncCount < 512);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QTest::seedSet && !QTest::randomOrder) {
|
if (QTest::seedSet && !QTest::randomOrder) {
|
||||||
printf("-seed requires -random\n");
|
fprintf(stderr, "-seed requires -random\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1466,8 +1458,8 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0)
|
|||||||
if (!*data)
|
if (!*data)
|
||||||
data = 0;
|
data = 0;
|
||||||
else {
|
else {
|
||||||
printf("Unknown testdata for function %s: '%s'\n", slotName, data);
|
fprintf(stderr, "Unknown testdata for function %s: '%s'\n", slotName, data);
|
||||||
printf("Function has no testdata.\n");
|
fprintf(stderr, "Function has no testdata.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1492,10 +1484,10 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data && !foundFunction) {
|
if (data && !foundFunction) {
|
||||||
printf("Unknown testdata for function %s: '%s'\n", slotName, data);
|
fprintf(stderr, "Unknown testdata for function %s: '%s'\n", slotName, data);
|
||||||
printf("Available testdata:\n");
|
fprintf(stderr, "Available testdata:\n");
|
||||||
for(int i = 0; i < table.dataCount(); ++i)
|
for(int i = 0; i < table.dataCount(); ++i)
|
||||||
printf("%s\n", table.testData(i)->dataTag());
|
fprintf(stderr, "%s\n", table.testData(i)->dataTag());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1899,10 +1891,6 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(QTEST_NOEXITCODE)
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
|
|
||||||
#ifdef QTESTLIB_USE_VALGRIND
|
#ifdef QTESTLIB_USE_VALGRIND
|
||||||
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess)
|
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess)
|
||||||
return callgrindChildExitCode;
|
return callgrindChildExitCode;
|
||||||
@ -1910,8 +1898,6 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
|
|||||||
// make sure our exit code is never going above 127
|
// make sure our exit code is never going above 127
|
||||||
// since that could wrap and indicate 0 test fails
|
// since that could wrap and indicate 0 test fails
|
||||||
return qMin(QTestResult::failCount(), 127);
|
return qMin(QTestResult::failCount(), 127);
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1959,7 +1945,7 @@ bool QTest::qVerify(bool statement, const char *statementStr, const char *descri
|
|||||||
void QTest::qSkip(const char *message, QTest::SkipMode mode,
|
void QTest::qSkip(const char *message, QTest::SkipMode mode,
|
||||||
const char *file, int line)
|
const char *file, int line)
|
||||||
{
|
{
|
||||||
QTestResult::addSkip(message, mode, file, line);
|
QTestResult::addSkip(message, file, line);
|
||||||
if (mode == QTest::SkipAll)
|
if (mode == QTest::SkipAll)
|
||||||
QTestResult::setSkipCurrentTest(true);
|
QTestResult::setSkipCurrentTest(true);
|
||||||
}
|
}
|
||||||
@ -2195,7 +2181,7 @@ Q_TESTLIB_EXPORT bool QTest::qCompare<double>(double const &t1, double const &t2
|
|||||||
toString(t1), toString(t2), actual, expected, file, line);
|
toString(t1), toString(t2), actual, expected, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COMPARE_IMPL2(TYPE, FORMAT) \
|
#define TO_STRING_IMPL(TYPE, FORMAT) \
|
||||||
template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE >(const TYPE &t) \
|
template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE >(const TYPE &t) \
|
||||||
{ \
|
{ \
|
||||||
char *msg = new char[128]; \
|
char *msg = new char[128]; \
|
||||||
@ -2203,23 +2189,23 @@ template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE >(const TYPE &t) \
|
|||||||
return msg; \
|
return msg; \
|
||||||
}
|
}
|
||||||
|
|
||||||
COMPARE_IMPL2(short, %hd)
|
TO_STRING_IMPL(short, %hd)
|
||||||
COMPARE_IMPL2(ushort, %hu)
|
TO_STRING_IMPL(ushort, %hu)
|
||||||
COMPARE_IMPL2(int, %d)
|
TO_STRING_IMPL(int, %d)
|
||||||
COMPARE_IMPL2(uint, %u)
|
TO_STRING_IMPL(uint, %u)
|
||||||
COMPARE_IMPL2(long, %ld)
|
TO_STRING_IMPL(long, %ld)
|
||||||
COMPARE_IMPL2(ulong, %lu)
|
TO_STRING_IMPL(ulong, %lu)
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
COMPARE_IMPL2(qint64, %I64d)
|
TO_STRING_IMPL(qint64, %I64d)
|
||||||
COMPARE_IMPL2(quint64, %I64u)
|
TO_STRING_IMPL(quint64, %I64u)
|
||||||
#else
|
#else
|
||||||
COMPARE_IMPL2(qint64, %lld)
|
TO_STRING_IMPL(qint64, %lld)
|
||||||
COMPARE_IMPL2(quint64, %llu)
|
TO_STRING_IMPL(quint64, %llu)
|
||||||
#endif
|
#endif
|
||||||
COMPARE_IMPL2(bool, %d)
|
TO_STRING_IMPL(bool, %d)
|
||||||
COMPARE_IMPL2(char, %c)
|
TO_STRING_IMPL(char, %c)
|
||||||
COMPARE_IMPL2(float, %g)
|
TO_STRING_IMPL(float, %g)
|
||||||
COMPARE_IMPL2(double, %lg)
|
TO_STRING_IMPL(double, %lg)
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
*/
|
*/
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class QTestTable;
|
friend class QTestTable;
|
||||||
QTestData(const char *tag = 0, QTestTable *parent = 0);
|
QTestData(const char *tag, QTestTable *parent);
|
||||||
|
|
||||||
Q_DISABLE_COPY(QTestData)
|
Q_DISABLE_COPY(QTestData)
|
||||||
|
|
||||||
|
@ -1,114 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
** All rights reserved.
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** This file is part of the QtTest module of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
|
||||||
** License version 2.1 as published by the Free Software Foundation and
|
|
||||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU Lesser
|
|
||||||
** General Public License version 2.1 requirements will be met:
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License version 3.0 as published by the Free Software Foundation
|
|
||||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU General
|
|
||||||
** Public License version 3.0 requirements will be met:
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** Other Usage
|
|
||||||
** Alternatively, this file may be used in accordance with the terms and
|
|
||||||
** conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "qtestfilelogger.h"
|
|
||||||
#include "qtestassert.h"
|
|
||||||
#include "QtTest/private/qtestlog_p.h"
|
|
||||||
#include "QtTest/private/qtestresult_p.h"
|
|
||||||
|
|
||||||
#include <QtCore/qdir.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
namespace QTest
|
|
||||||
{
|
|
||||||
static FILE *stream = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTestFileLogger::QTestFileLogger()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QTestFileLogger::~QTestFileLogger()
|
|
||||||
{
|
|
||||||
if(QTest::stream)
|
|
||||||
fclose(QTest::stream);
|
|
||||||
|
|
||||||
QTest::stream = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTestFileLogger::init()
|
|
||||||
{
|
|
||||||
char filename[100];
|
|
||||||
int index = 0;
|
|
||||||
#if defined(Q_OS_SYMBIAN)
|
|
||||||
QByteArray ba(QDir::toNativeSeparators(QString(QDir::homePath()+QDir::separator())).toUtf8());
|
|
||||||
index = ba.length();
|
|
||||||
QTest::qt_snprintf(filename, sizeof(filename), "%s%s.log",
|
|
||||||
ba.constData(), QTestResult::currentTestObjectName());
|
|
||||||
#else
|
|
||||||
QTest::qt_snprintf(filename, sizeof(filename), "%s.log",
|
|
||||||
QTestResult::currentTestObjectName());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Keep filenames simple
|
|
||||||
for (uint i = index; i < sizeof(filename) && filename[i]; ++i) {
|
|
||||||
char& c = filename[i];
|
|
||||||
if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
|
|
||||||
|| (c >= '0' && c <= '9') || c == '-' || c == '.')) {
|
|
||||||
c = '_';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
|
|
||||||
if (::fopen_s(&QTest::stream, filename, "wt")) {
|
|
||||||
#else
|
|
||||||
QTest::stream = ::fopen(filename, "wt");
|
|
||||||
if (!QTest::stream) {
|
|
||||||
#endif
|
|
||||||
printf("Unable to open file for simple logging: %s", filename);
|
|
||||||
::exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTestFileLogger::flush(const char *msg)
|
|
||||||
{
|
|
||||||
QTEST_ASSERT(QTest::stream);
|
|
||||||
|
|
||||||
::fputs(msg, QTest::stream);
|
|
||||||
::fflush(QTest::stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
** All rights reserved.
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** This file is part of the QtTest module of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
|
||||||
** License version 2.1 as published by the Free Software Foundation and
|
|
||||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU Lesser
|
|
||||||
** General Public License version 2.1 requirements will be met:
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License version 3.0 as published by the Free Software Foundation
|
|
||||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU General
|
|
||||||
** Public License version 3.0 requirements will be met:
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** Other Usage
|
|
||||||
** Alternatively, this file may be used in accordance with the terms and
|
|
||||||
** conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QTESTFILELOGGER_H
|
|
||||||
#define QTESTFILELOGGER_H
|
|
||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
|
||||||
|
|
||||||
QT_BEGIN_HEADER
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
QT_MODULE(Test)
|
|
||||||
|
|
||||||
class QTestFileLogger
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QTestFileLogger();
|
|
||||||
~QTestFileLogger();
|
|
||||||
|
|
||||||
void init();
|
|
||||||
void flush(const char *msg);
|
|
||||||
};
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
QT_END_HEADER
|
|
||||||
|
|
||||||
#endif // QTESTFILELOGGER_H
|
|
@ -52,8 +52,8 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QTestLightXmlStreamer::QTestLightXmlStreamer()
|
QTestLightXmlStreamer::QTestLightXmlStreamer(QTestLogger *logger)
|
||||||
:QTestBasicStreamer()
|
: QTestBasicStreamer(logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class QTestElementAttribute;
|
|||||||
class QTestLightXmlStreamer: public QTestBasicStreamer
|
class QTestLightXmlStreamer: public QTestBasicStreamer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QTestLightXmlStreamer();
|
QTestLightXmlStreamer(QTestLogger *logger);
|
||||||
~QTestLightXmlStreamer();
|
~QTestLightXmlStreamer();
|
||||||
|
|
||||||
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
|
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "QtTest/private/qtestresult_p.h"
|
#include "QtTest/private/qtestresult_p.h"
|
||||||
#include "QtTest/private/qabstracttestlogger_p.h"
|
#include "QtTest/private/qabstracttestlogger_p.h"
|
||||||
#include "QtTest/private/qplaintestlogger_p.h"
|
#include "QtTest/private/qplaintestlogger_p.h"
|
||||||
|
#include "QtTest/private/qtestlogger_p.h"
|
||||||
#include "QtTest/private/qxmltestlogger_p.h"
|
#include "QtTest/private/qxmltestlogger_p.h"
|
||||||
#include <QtCore/qatomic.h>
|
#include <QtCore/qatomic.h>
|
||||||
#include <QtCore/qbytearray.h>
|
#include <QtCore/qbytearray.h>
|
||||||
@ -53,9 +54,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
|
||||||
#include "qtestlogger_p.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace QTest {
|
namespace QTest {
|
||||||
@ -168,39 +166,31 @@ namespace QTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initLogger()
|
void initLogger()
|
||||||
{
|
{
|
||||||
switch (QTest::logMode) {
|
switch (QTest::logMode) {
|
||||||
case QTestLog::Plain:
|
case QTestLog::Plain:
|
||||||
QTest::testLogger = new QPlainTestLogger;
|
QTest::testLogger = new QPlainTestLogger;
|
||||||
break;
|
break;
|
||||||
case QTestLog::XML:{
|
case QTestLog::XML:
|
||||||
if(QTest::flushMode == QTestLog::FLushOn)
|
if (QTest::flushMode == QTestLog::FlushOn)
|
||||||
QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete);
|
QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete);
|
||||||
else
|
else
|
||||||
QTest::testLogger = new QTestLogger(QTestLogger::TLF_XML);
|
QTest::testLogger = new QTestLogger(QTestLogger::TLF_XML);
|
||||||
break;
|
break;
|
||||||
}case QTestLog::LightXML:{
|
case QTestLog::LightXML:
|
||||||
if(QTest::flushMode == QTestLog::FLushOn)
|
if (QTest::flushMode == QTestLog::FlushOn)
|
||||||
QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light);
|
QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light);
|
||||||
else
|
else
|
||||||
QTest::testLogger = new QTestLogger(QTestLogger::TLF_LightXml);
|
QTest::testLogger = new QTestLogger(QTestLogger::TLF_LightXml);
|
||||||
break;
|
break;
|
||||||
}case QTestLog::XunitXML:
|
case QTestLog::XunitXML:
|
||||||
QTest::testLogger = new QTestLogger(QTestLogger::TLF_XunitXml);
|
QTest::testLogger = new QTestLogger(QTestLogger::TLF_XunitXml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestLog::QTestLog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QTestLog::~QTestLog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTestLog::enterTestFunction(const char* function)
|
void QTestLog::enterTestFunction(const char* function)
|
||||||
{
|
{
|
||||||
QTEST_ASSERT(QTest::testLogger);
|
QTEST_ASSERT(QTest::testLogger);
|
||||||
@ -253,6 +243,7 @@ void QTestLog::addPass(const char *msg)
|
|||||||
void QTestLog::addFail(const char *msg, const char *file, int line)
|
void QTestLog::addFail(const char *msg, const char *file, int line)
|
||||||
{
|
{
|
||||||
QTEST_ASSERT(QTest::testLogger);
|
QTEST_ASSERT(QTest::testLogger);
|
||||||
|
QTEST_ASSERT(msg);
|
||||||
|
|
||||||
QTest::testLogger->addIncident(QAbstractTestLogger::Fail, msg, file, line);
|
QTest::testLogger->addIncident(QAbstractTestLogger::Fail, msg, file, line);
|
||||||
}
|
}
|
||||||
@ -275,8 +266,7 @@ void QTestLog::addXPass(const char *msg, const char *file, int line)
|
|||||||
QTest::testLogger->addIncident(QAbstractTestLogger::XPass, msg, file, line);
|
QTest::testLogger->addIncident(QAbstractTestLogger::XPass, msg, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestLog::addSkip(const char *msg, QTest::SkipMode /*mode*/,
|
void QTestLog::addSkip(const char *msg, const char *file, int line)
|
||||||
const char *file, int line)
|
|
||||||
{
|
{
|
||||||
QTEST_ASSERT(QTest::testLogger);
|
QTEST_ASSERT(QTest::testLogger);
|
||||||
QTEST_ASSERT(msg);
|
QTEST_ASSERT(msg);
|
||||||
@ -296,7 +286,7 @@ void QTestLog::startLogging(unsigned int randomSeed)
|
|||||||
QTEST_ASSERT(!QTest::testLogger);
|
QTEST_ASSERT(!QTest::testLogger);
|
||||||
QTest::initLogger();
|
QTest::initLogger();
|
||||||
QTest::testLogger->registerRandomSeed(randomSeed);
|
QTest::testLogger->registerRandomSeed(randomSeed);
|
||||||
QTest::testLogger->startLogging();
|
QTest::testLogger->startLogging(QTest::outFile);
|
||||||
QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
|
QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +294,7 @@ void QTestLog::startLogging()
|
|||||||
{
|
{
|
||||||
QTEST_ASSERT(!QTest::testLogger);
|
QTEST_ASSERT(!QTest::testLogger);
|
||||||
QTest::initLogger();
|
QTest::initLogger();
|
||||||
QTest::testLogger->startLogging();
|
QTest::testLogger->startLogging(QTest::outFile);
|
||||||
QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
|
QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +346,8 @@ int QTestLog::verboseLevel()
|
|||||||
|
|
||||||
void QTestLog::addIgnoreMessage(QtMsgType type, const char *msg)
|
void QTestLog::addIgnoreMessage(QtMsgType type, const char *msg)
|
||||||
{
|
{
|
||||||
|
QTEST_ASSERT(msg);
|
||||||
|
|
||||||
QTest::IgnoreResultList *item = new QTest::IgnoreResultList(type, msg);
|
QTest::IgnoreResultList *item = new QTest::IgnoreResultList(type, msg);
|
||||||
|
|
||||||
QTest::IgnoreResultList *list = QTest::ignoreResultList;
|
QTest::IgnoreResultList *list = QTest::ignoreResultList;
|
||||||
|
@ -63,7 +63,7 @@ class Q_TESTLIB_EXPORT QTestLog
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum LogMode { Plain = 0, XML, LightXML, XunitXML };
|
enum LogMode { Plain = 0, XML, LightXML, XunitXML };
|
||||||
enum FlushMode { NoFlush = 0, FLushOn };
|
enum FlushMode { NoFlush = 0, FlushOn };
|
||||||
|
|
||||||
static void enterTestFunction(const char* function);
|
static void enterTestFunction(const char* function);
|
||||||
static void leaveTestFunction();
|
static void leaveTestFunction();
|
||||||
@ -72,8 +72,7 @@ public:
|
|||||||
static void addFail(const char *msg, const char *file, int line);
|
static void addFail(const char *msg, const char *file, int line);
|
||||||
static void addXFail(const char *msg, const char *file, int line);
|
static void addXFail(const char *msg, const char *file, int line);
|
||||||
static void addXPass(const char *msg, const char *file, int line);
|
static void addXPass(const char *msg, const char *file, int line);
|
||||||
static void addSkip(const char *msg, QTest::SkipMode mode,
|
static void addSkip(const char *msg, const char *file, int line);
|
||||||
const char *file, int line);
|
|
||||||
static void addBenchmarkResult(const QBenchmarkResult &result);
|
static void addBenchmarkResult(const QBenchmarkResult &result);
|
||||||
static void addIgnoreMessage(QtMsgType type, const char *msg);
|
static void addIgnoreMessage(QtMsgType type, const char *msg);
|
||||||
static int unhandledIgnoreMessages();
|
static int unhandledIgnoreMessages();
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#include "qtestxunitstreamer.h"
|
#include "qtestxunitstreamer.h"
|
||||||
#include "qtestxmlstreamer.h"
|
#include "qtestxmlstreamer.h"
|
||||||
#include "qtestlightxmlstreamer.h"
|
#include "qtestlightxmlstreamer.h"
|
||||||
#include "qtestfilelogger.h"
|
|
||||||
|
|
||||||
#include "QtTest/qtestcase.h"
|
#include "QtTest/qtestcase.h"
|
||||||
#include "QtTest/private/qtestresult_p.h"
|
#include "QtTest/private/qtestresult_p.h"
|
||||||
@ -55,15 +54,16 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QTestLogger::QTestLogger(int fm)
|
QTestLogger::QTestLogger(int fm)
|
||||||
:listOfTestcases(0), currentLogElement(0), errorLogElement(0),
|
: listOfTestcases(0)
|
||||||
logFormatter(0), format( (TestLoggerFormat)fm ), filelogger(new QTestFileLogger),
|
, currentLogElement(0)
|
||||||
testCounter(0), passCounter(0),
|
, errorLogElement(0)
|
||||||
failureCounter(0), errorCounter(0),
|
, logFormatter(0)
|
||||||
warningCounter(0), skipCounter(0),
|
, format( (TestLoggerFormat)fm )
|
||||||
systemCounter(0), qdebugCounter(0),
|
, testCounter(0)
|
||||||
qwarnCounter(0), qfatalCounter(0),
|
, failureCounter(0)
|
||||||
infoCounter(0), randomSeed_(0),
|
, errorCounter(0)
|
||||||
hasRandomSeed_(false)
|
, randomSeed_(0)
|
||||||
|
, hasRandomSeed_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,31 +75,25 @@ QTestLogger::~QTestLogger()
|
|||||||
delete listOfTestcases;
|
delete listOfTestcases;
|
||||||
|
|
||||||
delete logFormatter;
|
delete logFormatter;
|
||||||
delete filelogger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestLogger::startLogging()
|
void QTestLogger::startLogging(const char *filename)
|
||||||
{
|
{
|
||||||
|
QAbstractTestLogger::startLogging(filename);
|
||||||
|
|
||||||
switch(format){
|
switch(format){
|
||||||
case TLF_LightXml:{
|
case TLF_LightXml:
|
||||||
logFormatter = new QTestLightXmlStreamer;
|
logFormatter = new QTestLightXmlStreamer(this);
|
||||||
filelogger->init();
|
|
||||||
break;
|
break;
|
||||||
}case TLF_XML:{
|
case TLF_XML:
|
||||||
logFormatter = new QTestXmlStreamer;
|
logFormatter = new QTestXmlStreamer(this);
|
||||||
filelogger->init();
|
|
||||||
break;
|
break;
|
||||||
}case TLF_XunitXml:{
|
case TLF_XunitXml:
|
||||||
logFormatter = new QTestXunitStreamer;
|
logFormatter = new QTestXunitStreamer(this);
|
||||||
delete errorLogElement;
|
delete errorLogElement;
|
||||||
errorLogElement = new QTestElement(QTest::LET_SystemError);
|
errorLogElement = new QTestElement(QTest::LET_SystemError);
|
||||||
filelogger->init();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
logFormatter->setLogger(this);
|
|
||||||
logFormatter->startStreaming();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestLogger::stopLogging()
|
void QTestLogger::stopLogging()
|
||||||
@ -161,15 +155,11 @@ void QTestLogger::stopLogging()
|
|||||||
logFormatter->output(iterator);
|
logFormatter->output(iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
logFormatter->stopStreaming();
|
QAbstractTestLogger::stopLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestLogger::enterTestFunction(const char *function)
|
void QTestLogger::enterTestFunction(const char *function)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
|
||||||
QTest::qt_snprintf(buf, sizeof(buf), "Entered test-function: %s\n", function);
|
|
||||||
filelogger->flush(buf);
|
|
||||||
|
|
||||||
currentLogElement = new QTestElement(QTest::LET_TestCase);
|
currentLogElement = new QTestElement(QTest::LET_TestCase);
|
||||||
currentLogElement->addAttribute(QTest::AI_Name, function);
|
currentLogElement->addAttribute(QTest::AI_Name, function);
|
||||||
currentLogElement->addToList(&listOfTestcases);
|
currentLogElement->addToList(&listOfTestcases);
|
||||||
@ -193,11 +183,9 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
|
|||||||
typeBuf = "xpass";
|
typeBuf = "xpass";
|
||||||
break;
|
break;
|
||||||
case QAbstractTestLogger::Pass:
|
case QAbstractTestLogger::Pass:
|
||||||
++passCounter;
|
|
||||||
typeBuf = "pass";
|
typeBuf = "pass";
|
||||||
break;
|
break;
|
||||||
case QAbstractTestLogger::XFail:
|
case QAbstractTestLogger::XFail:
|
||||||
++passCounter;
|
|
||||||
typeBuf = "xfail";
|
typeBuf = "xfail";
|
||||||
break;
|
break;
|
||||||
case QAbstractTestLogger::Fail:
|
case QAbstractTestLogger::Fail:
|
||||||
@ -271,7 +259,6 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
|
|||||||
void QTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
|
void QTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
|
||||||
{
|
{
|
||||||
QTestElement *benchmarkElement = new QTestElement(QTest::LET_Benchmark);
|
QTestElement *benchmarkElement = new QTestElement(QTest::LET_Benchmark);
|
||||||
// printf("element %i", benchmarkElement->elementType());
|
|
||||||
|
|
||||||
benchmarkElement->addAttribute(
|
benchmarkElement->addAttribute(
|
||||||
QTest::AI_Metric,
|
QTest::AI_Metric,
|
||||||
@ -313,31 +300,24 @@ void QTestLogger::addMessage(MessageTypes type, const char *message, const char
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QAbstractTestLogger::Warn:
|
case QAbstractTestLogger::Warn:
|
||||||
++warningCounter;
|
|
||||||
typeBuf = "warn";
|
typeBuf = "warn";
|
||||||
break;
|
break;
|
||||||
case QAbstractTestLogger::QSystem:
|
case QAbstractTestLogger::QSystem:
|
||||||
++systemCounter;
|
|
||||||
typeBuf = "system";
|
typeBuf = "system";
|
||||||
break;
|
break;
|
||||||
case QAbstractTestLogger::QDebug:
|
case QAbstractTestLogger::QDebug:
|
||||||
++qdebugCounter;
|
|
||||||
typeBuf = "qdebug";
|
typeBuf = "qdebug";
|
||||||
break;
|
break;
|
||||||
case QAbstractTestLogger::QWarning:
|
case QAbstractTestLogger::QWarning:
|
||||||
++qwarnCounter;
|
|
||||||
typeBuf = "qwarn";
|
typeBuf = "qwarn";
|
||||||
break;
|
break;
|
||||||
case QAbstractTestLogger::QFatal:
|
case QAbstractTestLogger::QFatal:
|
||||||
++qfatalCounter;
|
|
||||||
typeBuf = "qfatal";
|
typeBuf = "qfatal";
|
||||||
break;
|
break;
|
||||||
case QAbstractTestLogger::Skip:
|
case QAbstractTestLogger::Skip:
|
||||||
++skipCounter;
|
|
||||||
typeBuf = "skip";
|
typeBuf = "skip";
|
||||||
break;
|
break;
|
||||||
case QAbstractTestLogger::Info:
|
case QAbstractTestLogger::Info:
|
||||||
++infoCounter;
|
|
||||||
typeBuf = "info";
|
typeBuf = "info";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -369,66 +349,6 @@ void QTestLogger::addMessage(MessageTypes type, const char *message, const char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestLogger::setLogFormat(TestLoggerFormat fm)
|
|
||||||
{
|
|
||||||
format = fm;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTestLogger::TestLoggerFormat QTestLogger::logFormat()
|
|
||||||
{
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::passCount() const
|
|
||||||
{
|
|
||||||
return passCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::failureCount() const
|
|
||||||
{
|
|
||||||
return failureCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::errorCount() const
|
|
||||||
{
|
|
||||||
return errorCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::warningCount() const
|
|
||||||
{
|
|
||||||
return warningCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::skipCount() const
|
|
||||||
{
|
|
||||||
return skipCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::systemCount() const
|
|
||||||
{
|
|
||||||
return systemCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::qdebugCount() const
|
|
||||||
{
|
|
||||||
return qdebugCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::qwarnCount() const
|
|
||||||
{
|
|
||||||
return qwarnCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::qfatalCount() const
|
|
||||||
{
|
|
||||||
return qfatalCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QTestLogger::infoCount() const
|
|
||||||
{
|
|
||||||
return infoCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTestLogger::registerRandomSeed(unsigned int seed)
|
void QTestLogger::registerRandomSeed(unsigned int seed)
|
||||||
{
|
{
|
||||||
randomSeed_ = seed;
|
randomSeed_ = seed;
|
||||||
|
@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
class QTestBasicStreamer;
|
class QTestBasicStreamer;
|
||||||
class QTestElement;
|
class QTestElement;
|
||||||
class QTestFileLogger;
|
|
||||||
|
|
||||||
class QTestLogger : public QAbstractTestLogger
|
class QTestLogger : public QAbstractTestLogger
|
||||||
{
|
{
|
||||||
@ -74,7 +73,7 @@ class QTestLogger : public QAbstractTestLogger
|
|||||||
TLF_XunitXml = 2
|
TLF_XunitXml = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
void startLogging();
|
void startLogging(const char *filename);
|
||||||
void stopLogging();
|
void stopLogging();
|
||||||
|
|
||||||
void enterTestFunction(const char *function);
|
void enterTestFunction(const char *function);
|
||||||
@ -88,19 +87,6 @@ class QTestLogger : public QAbstractTestLogger
|
|||||||
void addMessage(MessageTypes type, const char *message,
|
void addMessage(MessageTypes type, const char *message,
|
||||||
const char *file = 0, int line = 0);
|
const char *file = 0, int line = 0);
|
||||||
|
|
||||||
void setLogFormat(TestLoggerFormat fm);
|
|
||||||
TestLoggerFormat logFormat();
|
|
||||||
|
|
||||||
int passCount() const;
|
|
||||||
int failureCount() const;
|
|
||||||
int errorCount() const;
|
|
||||||
int warningCount() const;
|
|
||||||
int skipCount() const;
|
|
||||||
int systemCount() const;
|
|
||||||
int qdebugCount() const;
|
|
||||||
int qwarnCount() const;
|
|
||||||
int qfatalCount() const;
|
|
||||||
int infoCount() const;
|
|
||||||
void registerRandomSeed(unsigned int seed);
|
void registerRandomSeed(unsigned int seed);
|
||||||
unsigned int randomSeed() const;
|
unsigned int randomSeed() const;
|
||||||
bool hasRandomSeed() const;
|
bool hasRandomSeed() const;
|
||||||
@ -111,19 +97,10 @@ class QTestLogger : public QAbstractTestLogger
|
|||||||
QTestElement *errorLogElement;
|
QTestElement *errorLogElement;
|
||||||
QTestBasicStreamer *logFormatter;
|
QTestBasicStreamer *logFormatter;
|
||||||
TestLoggerFormat format;
|
TestLoggerFormat format;
|
||||||
QTestFileLogger *filelogger;
|
|
||||||
|
|
||||||
int testCounter;
|
int testCounter;
|
||||||
int passCounter;
|
|
||||||
int failureCounter;
|
int failureCounter;
|
||||||
int errorCounter;
|
int errorCounter;
|
||||||
int warningCounter;
|
|
||||||
int skipCounter;
|
|
||||||
int systemCounter;
|
|
||||||
int qdebugCounter;
|
|
||||||
int qwarnCounter;
|
|
||||||
int qfatalCounter;
|
|
||||||
int infoCounter;
|
|
||||||
unsigned int randomSeed_;
|
unsigned int randomSeed_;
|
||||||
bool hasRandomSeed_;
|
bool hasRandomSeed_;
|
||||||
};
|
};
|
||||||
|
@ -285,12 +285,11 @@ void QTestResult::addFailure(const char *message, const char *file, int line)
|
|||||||
++QTest::fails;
|
++QTest::fails;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestResult::addSkip(const char *message, QTest::SkipMode mode,
|
void QTestResult::addSkip(const char *message, const char *file, int line)
|
||||||
const char *file, int line)
|
|
||||||
{
|
{
|
||||||
clearExpectFail();
|
clearExpectFail();
|
||||||
|
|
||||||
QTestLog::addSkip(message, mode, file, line);
|
QTestLog::addSkip(message, file, line);
|
||||||
++QTest::skips;
|
++QTest::skips;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +93,7 @@ public:
|
|||||||
static void setCurrentTestFunction(const char *func);
|
static void setCurrentTestFunction(const char *func);
|
||||||
static void setCurrentTestLocation(TestLocation loc);
|
static void setCurrentTestLocation(TestLocation loc);
|
||||||
static void setCurrentTestObject(const char *name);
|
static void setCurrentTestObject(const char *name);
|
||||||
static void addSkip(const char *message, QTest::SkipMode mode,
|
static void addSkip(const char *message, const char *file, int line);
|
||||||
const char *file, int line);
|
|
||||||
static bool expectFail(const char *dataIndex, const char *comment,
|
static bool expectFail(const char *dataIndex, const char *comment,
|
||||||
QTest::TestFailMode mode, const char *file, int line);
|
QTest::TestFailMode mode, const char *file, int line);
|
||||||
static bool verify(bool statement, const char *statementStr, const char *extraInfo,
|
static bool verify(bool statement, const char *statementStr, const char *extraInfo,
|
||||||
|
@ -53,8 +53,8 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QTestXmlStreamer::QTestXmlStreamer()
|
QTestXmlStreamer::QTestXmlStreamer(QTestLogger *logger)
|
||||||
:QTestBasicStreamer()
|
: QTestBasicStreamer(logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QTESTXMLSTREAMER_H
|
#ifndef QTESTXMLSTREAMER_H
|
||||||
#define QTESXMLSTREAMER_H
|
#define QTESTXMLSTREAMER_H
|
||||||
|
|
||||||
#include <QtTest/qtestbasicstreamer.h>
|
#include <QtTest/qtestbasicstreamer.h>
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class QTestElementAttribute;
|
|||||||
class QTestXmlStreamer: public QTestBasicStreamer
|
class QTestXmlStreamer: public QTestBasicStreamer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QTestXmlStreamer();
|
QTestXmlStreamer(QTestLogger *logger);
|
||||||
~QTestXmlStreamer();
|
~QTestXmlStreamer();
|
||||||
|
|
||||||
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
|
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QTestXunitStreamer::QTestXunitStreamer()
|
QTestXunitStreamer::QTestXunitStreamer(QTestLogger *logger)
|
||||||
:QTestBasicStreamer()
|
: QTestBasicStreamer(logger)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QTestXunitStreamer::~QTestXunitStreamer()
|
QTestXunitStreamer::~QTestXunitStreamer()
|
||||||
|
@ -55,7 +55,7 @@ class QTestLogger;
|
|||||||
class QTestXunitStreamer: public QTestBasicStreamer
|
class QTestXunitStreamer: public QTestBasicStreamer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QTestXunitStreamer();
|
QTestXunitStreamer(QTestLogger *logger);
|
||||||
~QTestXunitStreamer();
|
~QTestXunitStreamer();
|
||||||
|
|
||||||
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
|
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
|
||||||
|
@ -102,9 +102,9 @@ QXmlTestLogger::~QXmlTestLogger()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QXmlTestLogger::startLogging()
|
void QXmlTestLogger::startLogging(const char *filename)
|
||||||
{
|
{
|
||||||
QAbstractTestLogger::startLogging();
|
QAbstractTestLogger::startLogging(filename);
|
||||||
QTestCharBuffer buf;
|
QTestCharBuffer buf;
|
||||||
|
|
||||||
if (xmlmode == QXmlTestLogger::Complete) {
|
if (xmlmode == QXmlTestLogger::Complete) {
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
QXmlTestLogger(XmlMode mode = Complete);
|
QXmlTestLogger(XmlMode mode = Complete);
|
||||||
~QXmlTestLogger();
|
~QXmlTestLogger();
|
||||||
|
|
||||||
void startLogging();
|
void startLogging(const char *filename);
|
||||||
void stopLogging();
|
void stopLogging();
|
||||||
|
|
||||||
void enterTestFunction(const char *function);
|
void enterTestFunction(const char *function);
|
||||||
|
@ -27,7 +27,6 @@ HEADERS = qbenchmark.h \
|
|||||||
qtestelement.h \
|
qtestelement.h \
|
||||||
qtestevent.h \
|
qtestevent.h \
|
||||||
qtesteventloop.h \
|
qtesteventloop.h \
|
||||||
qtestfilelogger.h \
|
|
||||||
qtest_global.h \
|
qtest_global.h \
|
||||||
qtest_gui.h \
|
qtest_gui.h \
|
||||||
qtest.h \
|
qtest.h \
|
||||||
@ -60,8 +59,7 @@ SOURCES = qtestcase.cpp \
|
|||||||
qtestxunitstreamer.cpp \
|
qtestxunitstreamer.cpp \
|
||||||
qtestxmlstreamer.cpp \
|
qtestxmlstreamer.cpp \
|
||||||
qtestlightxmlstreamer.cpp \
|
qtestlightxmlstreamer.cpp \
|
||||||
qtestlogger.cpp \
|
qtestlogger.cpp
|
||||||
qtestfilelogger.cpp
|
|
||||||
DEFINES *= QT_NO_CAST_TO_ASCII \
|
DEFINES *= QT_NO_CAST_TO_ASCII \
|
||||||
QT_NO_CAST_FROM_ASCII \
|
QT_NO_CAST_FROM_ASCII \
|
||||||
QTESTLIB_MAKEDLL \
|
QTESTLIB_MAKEDLL \
|
||||||
|
@ -527,7 +527,6 @@ QT_CLASS_LIB(QTestMouseEvent, QtTest, qtestevent.h)
|
|||||||
QT_CLASS_LIB(QTestDelayEvent, QtTest, qtestevent.h)
|
QT_CLASS_LIB(QTestDelayEvent, QtTest, qtestevent.h)
|
||||||
QT_CLASS_LIB(QTestEventList, QtTest, qtestevent.h)
|
QT_CLASS_LIB(QTestEventList, QtTest, qtestevent.h)
|
||||||
QT_CLASS_LIB(QTestEventLoop, QtTest, qtesteventloop.h)
|
QT_CLASS_LIB(QTestEventLoop, QtTest, qtesteventloop.h)
|
||||||
QT_CLASS_LIB(QTestFileLogger, QtTest, qtestfilelogger.h)
|
|
||||||
QT_CLASS_LIB(QTestLightXmlStreamer, QtTest, qtestlightxmlstreamer.h)
|
QT_CLASS_LIB(QTestLightXmlStreamer, QtTest, qtestlightxmlstreamer.h)
|
||||||
QT_CLASS_LIB(QEventSizeOfChecker, QtTest, qtestspontaneevent.h)
|
QT_CLASS_LIB(QEventSizeOfChecker, QtTest, qtestspontaneevent.h)
|
||||||
QT_CLASS_LIB(QEventSizeOfChecker, QtTest, qtestspontaneevent.h)
|
QT_CLASS_LIB(QEventSizeOfChecker, QtTest, qtestspontaneevent.h)
|
||||||
|
@ -84,40 +84,40 @@ public:
|
|||||||
MenuCommand = 0x0018,
|
MenuCommand = 0x0018,
|
||||||
|
|
||||||
// Values from IAccessible2
|
// Values from IAccessible2
|
||||||
ActionChanged = 0x0101,
|
ActionChanged = 0x0101,
|
||||||
ActiveDescendantChanged,
|
ActiveDescendantChanged = 0x0102,
|
||||||
AttributeChanged,
|
AttributeChanged = 0x0103,
|
||||||
DocumentContentChanged,
|
DocumentContentChanged = 0x0104,
|
||||||
DocumentLoadComplete,
|
DocumentLoadComplete = 0x0105,
|
||||||
DocumentLoadStopped,
|
DocumentLoadStopped = 0x0106,
|
||||||
DocumentReload,
|
DocumentReload = 0x0107,
|
||||||
HyperlinkEndIndexChanged,
|
HyperlinkEndIndexChanged = 0x0108,
|
||||||
HyperlinkNumberOfAnchorsChanged,
|
HyperlinkNumberOfAnchorsChanged = 0x0109,
|
||||||
HyperlinkSelectedLinkChanged,
|
HyperlinkSelectedLinkChanged = 0x010A,
|
||||||
HypertextLinkActivated,
|
HypertextLinkActivated = 0x010B,
|
||||||
HypertextLinkSelected,
|
HypertextLinkSelected = 0x010C,
|
||||||
HyperlinkStartIndexChanged,
|
HyperlinkStartIndexChanged = 0x010D,
|
||||||
HypertextChanged,
|
HypertextChanged = 0x010E,
|
||||||
HypertextNLinksChanged,
|
HypertextNLinksChanged = 0x010F,
|
||||||
ObjectAttributeChanged,
|
ObjectAttributeChanged = 0x0110,
|
||||||
PageChanged,
|
PageChanged = 0x0111,
|
||||||
SectionChanged,
|
SectionChanged = 0x0112,
|
||||||
TableCaptionChanged,
|
TableCaptionChanged = 0x0113,
|
||||||
TableColumnDescriptionChanged,
|
TableColumnDescriptionChanged = 0x0114,
|
||||||
TableColumnHeaderChanged,
|
TableColumnHeaderChanged = 0x0115,
|
||||||
TableModelChanged,
|
TableModelChanged = 0x0116,
|
||||||
TableRowDescriptionChanged,
|
TableRowDescriptionChanged = 0x0117,
|
||||||
TableRowHeaderChanged,
|
TableRowHeaderChanged = 0x0118,
|
||||||
TableSummaryChanged,
|
TableSummaryChanged = 0x0119,
|
||||||
TextAttributeChanged,
|
TextAttributeChanged = 0x011A,
|
||||||
TextCaretMoved,
|
TextCaretMoved = 0x011B,
|
||||||
// TextChanged, deprecated, use TextUpdated
|
// TextChanged = 0x011C, is deprecated in IA2, use TextUpdated
|
||||||
TextColumnChanged = TextCaretMoved + 2,
|
TextColumnChanged = 0x011D,
|
||||||
TextInserted,
|
TextInserted = 0x011E,
|
||||||
TextRemoved,
|
TextRemoved = 0x011F,
|
||||||
TextUpdated,
|
TextUpdated = 0x0120,
|
||||||
TextSelectionChanged,
|
TextSelectionChanged = 0x0121,
|
||||||
VisibleDataChanged,
|
VisibleDataChanged = 0x0122,
|
||||||
|
|
||||||
ObjectCreated = 0x8000,
|
ObjectCreated = 0x8000,
|
||||||
ObjectDestroyed = 0x8001,
|
ObjectDestroyed = 0x8001,
|
||||||
@ -162,6 +162,9 @@ public:
|
|||||||
Offscreen = 0x00010000,
|
Offscreen = 0x00010000,
|
||||||
Sizeable = 0x00020000,
|
Sizeable = 0x00020000,
|
||||||
Movable = 0x00040000,
|
Movable = 0x00040000,
|
||||||
|
#ifdef QT3_SUPPORT
|
||||||
|
Moveable = Movable,
|
||||||
|
#endif
|
||||||
SelfVoicing = 0x00080000,
|
SelfVoicing = 0x00080000,
|
||||||
Focusable = 0x00100000,
|
Focusable = 0x00100000,
|
||||||
Selectable = 0x00200000,
|
Selectable = 0x00200000,
|
||||||
|
@ -96,7 +96,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
|
|||||||
}
|
}
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
if (bridges()->isEmpty())
|
if (!bridges() || bridges()->isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o);
|
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o);
|
||||||
|
@ -3172,7 +3172,7 @@ bool QApplication::desktopSettingsAware()
|
|||||||
one of the above events. If no keys are being held Qt::NoModifier is
|
one of the above events. If no keys are being held Qt::NoModifier is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
\sa mouseButtons()
|
\sa mouseButtons(), queryKeyboardModifiers()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Qt::KeyboardModifiers QApplication::keyboardModifiers()
|
Qt::KeyboardModifiers QApplication::keyboardModifiers()
|
||||||
@ -3180,6 +3180,31 @@ Qt::KeyboardModifiers QApplication::keyboardModifiers()
|
|||||||
return QApplicationPrivate::modifier_buttons;
|
return QApplicationPrivate::modifier_buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
|
||||||
|
|
||||||
|
Queries and returns the state of the modifier keys on the keyboard.
|
||||||
|
Unlike keyboardModifiers, this method returns the actual keys held
|
||||||
|
on the input device at the time of calling the method.
|
||||||
|
|
||||||
|
It does not rely on the keypress events having been received by this
|
||||||
|
process, which makes it possible to check the modifiers while moving
|
||||||
|
a window, for instance. Note that in most cases, you should use
|
||||||
|
keyboardModifiers(), which is faster and more accurate since it contains
|
||||||
|
the state of the modifiers as they were when the currently processed
|
||||||
|
event was received.
|
||||||
|
|
||||||
|
\sa keyboardModifiers()
|
||||||
|
|
||||||
|
\since 4.8
|
||||||
|
*/
|
||||||
|
|
||||||
|
Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
|
||||||
|
{
|
||||||
|
qWarning("queryKeyboardModifiers() doesn't have a QPA implementation");
|
||||||
|
return QApplicationPrivate::modifier_buttons;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the current state of the buttons on the mouse. The current state is
|
Returns the current state of the buttons on the mouse. The current state is
|
||||||
updated syncronously as the event queue is emptied of events that will
|
updated syncronously as the event queue is emptied of events that will
|
||||||
|
@ -200,6 +200,7 @@ public:
|
|||||||
static void alert(QWidget *widget, int duration = 0);
|
static void alert(QWidget *widget, int duration = 0);
|
||||||
|
|
||||||
static Qt::KeyboardModifiers keyboardModifiers();
|
static Qt::KeyboardModifiers keyboardModifiers();
|
||||||
|
static Qt::KeyboardModifiers queryKeyboardModifiers();
|
||||||
static Qt::MouseButtons mouseButtons();
|
static Qt::MouseButtons mouseButtons();
|
||||||
|
|
||||||
static void setDesktopSettingsAware(bool);
|
static void setDesktopSettingsAware(bool);
|
||||||
|
@ -55,6 +55,10 @@
|
|||||||
#include "private/qstylesheetstyle_p.h"
|
#include "private/qstylesheetstyle_p.h"
|
||||||
#include <qmath.h>
|
#include <qmath.h>
|
||||||
|
|
||||||
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
|
#include <qaccessible.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -377,6 +381,11 @@ void QLabel::setText(const QString &text)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
d->updateLabel();
|
d->updateLabel();
|
||||||
|
|
||||||
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
|
if (accessibleName().isEmpty())
|
||||||
|
QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QLabel::text() const
|
QString QLabel::text() const
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="RegisteredType"/>
|
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="RegisteredType"/>
|
||||||
</signal>
|
</signal>
|
||||||
<method name="voidMethod" />
|
<method name="voidMethod" />
|
||||||
|
<method name="sleepMethod">
|
||||||
|
<arg type="i" />
|
||||||
|
<arg type="i" direction="out"/>
|
||||||
|
</method>
|
||||||
<method name="stringMethod">
|
<method name="stringMethod">
|
||||||
<arg type="s" direction="out"/>
|
<arg type="s" direction="out"/>
|
||||||
</method>
|
</method>
|
||||||
|
@ -40,9 +40,23 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
Interface::Interface()
|
Interface::Interface()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Export the sleep function
|
||||||
|
// TODO QT5: remove this class, QThread::msleep is now public
|
||||||
|
class FriendlySleepyThread : public QThread {
|
||||||
|
public:
|
||||||
|
using QThread::msleep;
|
||||||
|
};
|
||||||
|
|
||||||
|
int Interface::sleepMethod(int msec)
|
||||||
|
{
|
||||||
|
FriendlySleepyThread::msleep(msec);
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_interface.cpp"
|
#include "moc_interface.cpp"
|
||||||
|
@ -101,6 +101,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
Q_SCRIPTABLE void voidMethod() {}
|
Q_SCRIPTABLE void voidMethod() {}
|
||||||
|
Q_SCRIPTABLE int sleepMethod(int);
|
||||||
Q_SCRIPTABLE QString stringMethod() { return "Hello, world"; }
|
Q_SCRIPTABLE QString stringMethod() { return "Hello, world"; }
|
||||||
Q_SCRIPTABLE RegisteredType complexMethod() { return RegisteredType("Hello, world"); }
|
Q_SCRIPTABLE RegisteredType complexMethod() { return RegisteredType("Hello, world"); }
|
||||||
Q_SCRIPTABLE QString multiOutMethod(int &value) { value = 42; return "Hello, world"; }
|
Q_SCRIPTABLE QString multiOutMethod(int &value) { value = 42; return "Hello, world"; }
|
||||||
|
@ -117,6 +117,13 @@ public Q_SLOTS: // METHODS
|
|||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<int> sleepMethod(int in0)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << qVariantFromValue(in0);
|
||||||
|
return asyncCallWithArgumentList(QLatin1String("sleepMethod"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
inline QDBusPendingReply<QString> stringMethod()
|
inline QDBusPendingReply<QString> stringMethod()
|
||||||
{
|
{
|
||||||
QList<QVariant> argumentList;
|
QList<QVariant> argumentList;
|
||||||
|
@ -111,6 +111,8 @@ private slots:
|
|||||||
void makeAsyncComplexCallPeer();
|
void makeAsyncComplexCallPeer();
|
||||||
void makeAsyncMultiOutCallPeer();
|
void makeAsyncMultiOutCallPeer();
|
||||||
|
|
||||||
|
void callWithTimeout();
|
||||||
|
|
||||||
void stringPropRead();
|
void stringPropRead();
|
||||||
void stringPropWrite();
|
void stringPropWrite();
|
||||||
void variantPropRead();
|
void variantPropRead();
|
||||||
@ -458,6 +460,96 @@ void tst_QDBusAbstractInterface::makeAsyncMultiOutCallPeer()
|
|||||||
QCoreApplication::instance()->processEvents();
|
QCoreApplication::instance()->processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char server_serviceName[] = "com.trolltech.autotests.dbusserver";
|
||||||
|
static const char server_objectPath[] = "/com/trolltech/server";
|
||||||
|
static const char server_interfaceName[] = "com.trolltech.QtDBus.Pinger";
|
||||||
|
|
||||||
|
class DBusServerThread : public QThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DBusServerThread() {
|
||||||
|
start();
|
||||||
|
m_ready.acquire();
|
||||||
|
}
|
||||||
|
~DBusServerThread() {
|
||||||
|
quit();
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void run()
|
||||||
|
{
|
||||||
|
QDBusConnection con = QDBusConnection::connectToBus(QDBusConnection::SessionBus, "ThreadConnection");
|
||||||
|
if (!con.isConnected())
|
||||||
|
qWarning("Error registering to DBus");
|
||||||
|
if (!con.registerService(server_serviceName))
|
||||||
|
qWarning("Error registering service name");
|
||||||
|
Interface targetObj;
|
||||||
|
con.registerObject(server_objectPath, &targetObj, QDBusConnection::ExportScriptableContents);
|
||||||
|
m_ready.release();
|
||||||
|
exec();
|
||||||
|
|
||||||
|
QDBusConnection::disconnectFromBus( con.name() );
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
QSemaphore m_ready;
|
||||||
|
};
|
||||||
|
|
||||||
|
void tst_QDBusAbstractInterface::callWithTimeout()
|
||||||
|
{
|
||||||
|
QDBusConnection con = QDBusConnection::sessionBus();
|
||||||
|
QVERIFY2(con.isConnected(), "Not connected to D-Bus");
|
||||||
|
|
||||||
|
DBusServerThread serverThread;
|
||||||
|
|
||||||
|
QDBusMessage msg = QDBusMessage::createMethodCall(server_serviceName,
|
||||||
|
server_objectPath, server_interfaceName, "sleepMethod");
|
||||||
|
msg << 100;
|
||||||
|
|
||||||
|
{
|
||||||
|
// Call with no timeout -> works
|
||||||
|
QDBusMessage reply = con.call(msg);
|
||||||
|
QCOMPARE((int)reply.type(), (int)QDBusMessage::ReplyMessage);
|
||||||
|
QCOMPARE(reply.arguments().at(0).toInt(), 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Call with 1 sec timeout -> fails
|
||||||
|
QDBusMessage reply = con.call(msg, QDBus::Block, 1);
|
||||||
|
QCOMPARE(reply.type(), QDBusMessage::ErrorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now using QDBusInterface
|
||||||
|
|
||||||
|
QDBusInterface iface(server_serviceName, server_objectPath, server_interfaceName, con);
|
||||||
|
{
|
||||||
|
// Call with no timeout
|
||||||
|
QDBusMessage reply = iface.call("sleepMethod", 100);
|
||||||
|
QCOMPARE(reply.type(), QDBusMessage::ReplyMessage);
|
||||||
|
QCOMPARE(reply.arguments().at(0).toInt(), 42);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
// Call with 1 sec timeout -> fails
|
||||||
|
iface.setTimeout(1);
|
||||||
|
QDBusMessage reply = iface.call("sleepMethod", 100);
|
||||||
|
QCOMPARE(reply.type(), QDBusMessage::ErrorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now using generated code
|
||||||
|
com::trolltech::QtDBus::Pinger p(server_serviceName, server_objectPath, QDBusConnection::sessionBus());
|
||||||
|
{
|
||||||
|
// Call with no timeout
|
||||||
|
QDBusReply<int> reply = p.sleepMethod(100);
|
||||||
|
QVERIFY(reply.isValid());
|
||||||
|
QCOMPARE(int(reply), 42);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
// Call with 1 sec timeout -> fails
|
||||||
|
p.setTimeout(1);
|
||||||
|
QDBusReply<int> reply = p.sleepMethod(100);
|
||||||
|
QVERIFY(!reply.isValid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QDBusAbstractInterface::stringPropRead()
|
void tst_QDBusAbstractInterface::stringPropRead()
|
||||||
{
|
{
|
||||||
Pinger p = getPinger();
|
Pinger p = getPinger();
|
||||||
|
@ -26,3 +26,5 @@ wince* {
|
|||||||
} else {
|
} else {
|
||||||
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test
|
||||||
|
@ -3,4 +3,4 @@ QT += widgets widgets-private
|
|||||||
QT += core-private gui-private
|
QT += core-private gui-private
|
||||||
SOURCES += tst_qlistwidget.cpp
|
SOURCES += tst_qlistwidget.cpp
|
||||||
|
|
||||||
|
qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-21098, fails unstably
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
load(qttest_p4)
|
load(qttest_p4)
|
||||||
QT += widgets
|
QT += widgets
|
||||||
SOURCES += tst_qmenu.cpp
|
SOURCES += tst_qmenu.cpp
|
||||||
|
|
||||||
|
qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-21100, unstably fails
|
||||||
|
@ -3,6 +3,8 @@ QT -= gui
|
|||||||
SOURCES += ../tst_qnetworkreply.cpp
|
SOURCES += ../tst_qnetworkreply.cpp
|
||||||
TARGET = ../tst_qnetworkreply
|
TARGET = ../tst_qnetworkreply
|
||||||
|
|
||||||
|
qpa:contains(QT_CONFIG,xcb): CONFIG+=insignificant_test # unstable, QTBUG-21102
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
TARGET = ../../debug/tst_qnetworkreply
|
TARGET = ../../debug/tst_qnetworkreply
|
||||||
|
Loading…
Reference in New Issue
Block a user