summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-08-29 12:11:53 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-08-29 12:11:53 +0200
commitd0c48efbae386dc88ea2313264e739715d9154b4 (patch)
tree97a30a0c58c8ecb8a9a58ae892f53c6e9efe03d7 /src
parente35a83b293e6b38f6060895262b5494d36515e6e (diff)
parentd7305c10948f501450b6b3358d261217d13c6d6e (diff)
Merge remote branch 'gerrit/master' into refactor
Conflicts: src/gui/accessible/qaccessible.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qapplication_mac.mm src/gui/kernel/qapplication_qws.cpp src/gui/kernel/qapplication_s60.cpp src/gui/kernel/qapplication_win.cpp src/gui/kernel/qapplication_x11.cpp src/gui/kernel/qdnd_x11.cpp src/gui/kernel/qwidget.cpp src/gui/widgets/qlabel.cpp Change-Id: Ief9c75724d2cff89ed45f009bdee2ffc5e4395ba
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qregexp.cpp537
-rw-r--r--src/dbus/qdbusabstractinterface.cpp31
-rw-r--r--src/dbus/qdbusabstractinterface.h3
-rw-r--r--src/dbus/qdbusabstractinterface_p.h1
-rw-r--r--src/gui/text/qfontengine_p.h5
-rw-r--r--src/gui/text/qtextengine.cpp3
-rw-r--r--src/gui/text/qtextlayout.cpp2
-rw-r--r--src/plugins/accessible/widgets/rangecontrols.cpp2
-rw-r--r--src/testlib/qabstracttestlogger.cpp50
-rw-r--r--src/testlib/qabstracttestlogger_p.h11
-rw-r--r--src/testlib/qplaintestlogger.cpp356
-rw-r--r--src/testlib/qplaintestlogger_p.h6
-rw-r--r--src/testlib/qtest_global.h4
-rw-r--r--src/testlib/qtestbasicstreamer.cpp64
-rw-r--r--src/testlib/qtestbasicstreamer.h10
-rw-r--r--src/testlib/qtestcase.cpp126
-rw-r--r--src/testlib/qtestdata.h2
-rw-r--r--src/testlib/qtestfilelogger.cpp114
-rw-r--r--src/testlib/qtestfilelogger.h67
-rw-r--r--src/testlib/qtestlightxmlstreamer.cpp4
-rw-r--r--src/testlib/qtestlightxmlstreamer.h2
-rw-r--r--src/testlib/qtestlog.cpp40
-rw-r--r--src/testlib/qtestlog_p.h5
-rw-r--r--src/testlib/qtestlogger.cpp120
-rw-r--r--src/testlib/qtestlogger_p.h25
-rw-r--r--src/testlib/qtestresult.cpp5
-rw-r--r--src/testlib/qtestresult_p.h3
-rw-r--r--src/testlib/qtestxmlstreamer.cpp4
-rw-r--r--src/testlib/qtestxmlstreamer.h4
-rw-r--r--src/testlib/qtestxunitstreamer.cpp4
-rw-r--r--src/testlib/qtestxunitstreamer.h2
-rw-r--r--src/testlib/qxmltestlogger.cpp4
-rw-r--r--src/testlib/qxmltestlogger_p.h2
-rw-r--r--src/testlib/testlib.pro4
-rw-r--r--src/tools/uic/qclass_lib_map.h1
-rw-r--r--src/widgets/accessible/qaccessible.h71
-rw-r--r--src/widgets/accessible/qaccessible_unix.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp27
-rw-r--r--src/widgets/kernel/qapplication.h1
-rw-r--r--src/widgets/widgets/qlabel.cpp9
40 files changed, 702 insertions, 1031 deletions
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 325320da12..5e2e56ea34 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -1252,8 +1252,6 @@ private:
friend class Box;
- void setupCategoriesRangeMap();
-
/*
This is the lexical analyzer for regular expressions.
*/
@@ -1293,7 +1291,6 @@ private:
int yyTok; // the last token read
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;
};
@@ -2735,151 +2732,162 @@ void QRegExpEngine::Box::addAnchorsToEngine(const Box &to) const
}
}
-void QRegExpEngine::setupCategoriesRangeMap()
-{
- categoriesRangeMap.insert("IsBasicLatin", qMakePair(0x0000, 0x007F));
- categoriesRangeMap.insert("IsLatin-1Supplement", qMakePair(0x0080, 0x00FF));
- categoriesRangeMap.insert("IsLatinExtended-A", qMakePair(0x0100, 0x017F));
- categoriesRangeMap.insert("IsLatinExtended-B", qMakePair(0x0180, 0x024F));
- categoriesRangeMap.insert("IsIPAExtensions", qMakePair(0x0250, 0x02AF));
- categoriesRangeMap.insert("IsSpacingModifierLetters", qMakePair(0x02B0, 0x02FF));
- categoriesRangeMap.insert("IsCombiningDiacriticalMarks", qMakePair(0x0300, 0x036F));
- categoriesRangeMap.insert("IsGreek", qMakePair(0x0370, 0x03FF));
- categoriesRangeMap.insert("IsCyrillic", qMakePair(0x0400, 0x04FF));
- categoriesRangeMap.insert("IsCyrillicSupplement", qMakePair(0x0500, 0x052F));
- categoriesRangeMap.insert("IsArmenian", qMakePair(0x0530, 0x058F));
- categoriesRangeMap.insert("IsHebrew", qMakePair(0x0590, 0x05FF));
- categoriesRangeMap.insert("IsArabic", qMakePair(0x0600, 0x06FF));
- categoriesRangeMap.insert("IsSyriac", qMakePair(0x0700, 0x074F));
- categoriesRangeMap.insert("IsArabicSupplement", qMakePair(0x0750, 0x077F));
- categoriesRangeMap.insert("IsThaana", qMakePair(0x0780, 0x07BF));
- categoriesRangeMap.insert("IsDevanagari", qMakePair(0x0900, 0x097F));
- categoriesRangeMap.insert("IsBengali", qMakePair(0x0980, 0x09FF));
- categoriesRangeMap.insert("IsGurmukhi", qMakePair(0x0A00, 0x0A7F));
- categoriesRangeMap.insert("IsGujarati", qMakePair(0x0A80, 0x0AFF));
- categoriesRangeMap.insert("IsOriya", qMakePair(0x0B00, 0x0B7F));
- categoriesRangeMap.insert("IsTamil", qMakePair(0x0B80, 0x0BFF));
- categoriesRangeMap.insert("IsTelugu", qMakePair(0x0C00, 0x0C7F));
- categoriesRangeMap.insert("IsKannada", qMakePair(0x0C80, 0x0CFF));
- categoriesRangeMap.insert("IsMalayalam", qMakePair(0x0D00, 0x0D7F));
- categoriesRangeMap.insert("IsSinhala", qMakePair(0x0D80, 0x0DFF));
- categoriesRangeMap.insert("IsThai", qMakePair(0x0E00, 0x0E7F));
- categoriesRangeMap.insert("IsLao", qMakePair(0x0E80, 0x0EFF));
- categoriesRangeMap.insert("IsTibetan", qMakePair(0x0F00, 0x0FFF));
- categoriesRangeMap.insert("IsMyanmar", qMakePair(0x1000, 0x109F));
- categoriesRangeMap.insert("IsGeorgian", qMakePair(0x10A0, 0x10FF));
- categoriesRangeMap.insert("IsHangulJamo", qMakePair(0x1100, 0x11FF));
- categoriesRangeMap.insert("IsEthiopic", qMakePair(0x1200, 0x137F));
- categoriesRangeMap.insert("IsEthiopicSupplement", qMakePair(0x1380, 0x139F));
- categoriesRangeMap.insert("IsCherokee", qMakePair(0x13A0, 0x13FF));
- categoriesRangeMap.insert("IsUnifiedCanadianAboriginalSyllabics", qMakePair(0x1400, 0x167F));
- categoriesRangeMap.insert("IsOgham", qMakePair(0x1680, 0x169F));
- categoriesRangeMap.insert("IsRunic", qMakePair(0x16A0, 0x16FF));
- categoriesRangeMap.insert("IsTagalog", qMakePair(0x1700, 0x171F));
- categoriesRangeMap.insert("IsHanunoo", qMakePair(0x1720, 0x173F));
- categoriesRangeMap.insert("IsBuhid", qMakePair(0x1740, 0x175F));
- categoriesRangeMap.insert("IsTagbanwa", qMakePair(0x1760, 0x177F));
- categoriesRangeMap.insert("IsKhmer", qMakePair(0x1780, 0x17FF));
- categoriesRangeMap.insert("IsMongolian", qMakePair(0x1800, 0x18AF));
- categoriesRangeMap.insert("IsLimbu", qMakePair(0x1900, 0x194F));
- categoriesRangeMap.insert("IsTaiLe", qMakePair(0x1950, 0x197F));
- categoriesRangeMap.insert("IsNewTaiLue", qMakePair(0x1980, 0x19DF));
- categoriesRangeMap.insert("IsKhmerSymbols", qMakePair(0x19E0, 0x19FF));
- categoriesRangeMap.insert("IsBuginese", qMakePair(0x1A00, 0x1A1F));
- categoriesRangeMap.insert("IsPhoneticExtensions", qMakePair(0x1D00, 0x1D7F));
- categoriesRangeMap.insert("IsPhoneticExtensionsSupplement", qMakePair(0x1D80, 0x1DBF));
- categoriesRangeMap.insert("IsCombiningDiacriticalMarksSupplement", qMakePair(0x1DC0, 0x1DFF));
- categoriesRangeMap.insert("IsLatinExtendedAdditional", qMakePair(0x1E00, 0x1EFF));
- categoriesRangeMap.insert("IsGreekExtended", qMakePair(0x1F00, 0x1FFF));
- categoriesRangeMap.insert("IsGeneralPunctuation", qMakePair(0x2000, 0x206F));
- categoriesRangeMap.insert("IsSuperscriptsandSubscripts", qMakePair(0x2070, 0x209F));
- categoriesRangeMap.insert("IsCurrencySymbols", qMakePair(0x20A0, 0x20CF));
- categoriesRangeMap.insert("IsCombiningMarksforSymbols", qMakePair(0x20D0, 0x20FF));
- categoriesRangeMap.insert("IsLetterlikeSymbols", qMakePair(0x2100, 0x214F));
- categoriesRangeMap.insert("IsNumberForms", qMakePair(0x2150, 0x218F));
- categoriesRangeMap.insert("IsArrows", qMakePair(0x2190, 0x21FF));
- categoriesRangeMap.insert("IsMathematicalOperators", qMakePair(0x2200, 0x22FF));
- categoriesRangeMap.insert("IsMiscellaneousTechnical", qMakePair(0x2300, 0x23FF));
- categoriesRangeMap.insert("IsControlPictures", qMakePair(0x2400, 0x243F));
- categoriesRangeMap.insert("IsOpticalCharacterRecognition", qMakePair(0x2440, 0x245F));
- categoriesRangeMap.insert("IsEnclosedAlphanumerics", qMakePair(0x2460, 0x24FF));
- categoriesRangeMap.insert("IsBoxDrawing", qMakePair(0x2500, 0x257F));
- categoriesRangeMap.insert("IsBlockElements", qMakePair(0x2580, 0x259F));
- categoriesRangeMap.insert("IsGeometricShapes", qMakePair(0x25A0, 0x25FF));
- categoriesRangeMap.insert("IsMiscellaneousSymbols", qMakePair(0x2600, 0x26FF));
- categoriesRangeMap.insert("IsDingbats", qMakePair(0x2700, 0x27BF));
- categoriesRangeMap.insert("IsMiscellaneousMathematicalSymbols-A", qMakePair(0x27C0, 0x27EF));
- categoriesRangeMap.insert("IsSupplementalArrows-A", qMakePair(0x27F0, 0x27FF));
- categoriesRangeMap.insert("IsBraillePatterns", qMakePair(0x2800, 0x28FF));
- categoriesRangeMap.insert("IsSupplementalArrows-B", qMakePair(0x2900, 0x297F));
- categoriesRangeMap.insert("IsMiscellaneousMathematicalSymbols-B", qMakePair(0x2980, 0x29FF));
- categoriesRangeMap.insert("IsSupplementalMathematicalOperators", qMakePair(0x2A00, 0x2AFF));
- categoriesRangeMap.insert("IsMiscellaneousSymbolsandArrows", qMakePair(0x2B00, 0x2BFF));
- categoriesRangeMap.insert("IsGlagolitic", qMakePair(0x2C00, 0x2C5F));
- categoriesRangeMap.insert("IsCoptic", qMakePair(0x2C80, 0x2CFF));
- categoriesRangeMap.insert("IsGeorgianSupplement", qMakePair(0x2D00, 0x2D2F));
- categoriesRangeMap.insert("IsTifinagh", qMakePair(0x2D30, 0x2D7F));
- categoriesRangeMap.insert("IsEthiopicExtended", qMakePair(0x2D80, 0x2DDF));
- categoriesRangeMap.insert("IsSupplementalPunctuation", qMakePair(0x2E00, 0x2E7F));
- categoriesRangeMap.insert("IsCJKRadicalsSupplement", qMakePair(0x2E80, 0x2EFF));
- categoriesRangeMap.insert("IsKangxiRadicals", qMakePair(0x2F00, 0x2FDF));
- categoriesRangeMap.insert("IsIdeographicDescriptionCharacters", qMakePair(0x2FF0, 0x2FFF));
- categoriesRangeMap.insert("IsCJKSymbolsandPunctuation", qMakePair(0x3000, 0x303F));
- categoriesRangeMap.insert("IsHiragana", qMakePair(0x3040, 0x309F));
- categoriesRangeMap.insert("IsKatakana", qMakePair(0x30A0, 0x30FF));
- categoriesRangeMap.insert("IsBopomofo", qMakePair(0x3100, 0x312F));
- categoriesRangeMap.insert("IsHangulCompatibilityJamo", qMakePair(0x3130, 0x318F));
- categoriesRangeMap.insert("IsKanbun", qMakePair(0x3190, 0x319F));
- categoriesRangeMap.insert("IsBopomofoExtended", qMakePair(0x31A0, 0x31BF));
- categoriesRangeMap.insert("IsCJKStrokes", qMakePair(0x31C0, 0x31EF));
- categoriesRangeMap.insert("IsKatakanaPhoneticExtensions", qMakePair(0x31F0, 0x31FF));
- categoriesRangeMap.insert("IsEnclosedCJKLettersandMonths", qMakePair(0x3200, 0x32FF));
- categoriesRangeMap.insert("IsCJKCompatibility", qMakePair(0x3300, 0x33FF));
- categoriesRangeMap.insert("IsCJKUnifiedIdeographsExtensionA", qMakePair(0x3400, 0x4DB5));
- categoriesRangeMap.insert("IsYijingHexagramSymbols", qMakePair(0x4DC0, 0x4DFF));
- categoriesRangeMap.insert("IsCJKUnifiedIdeographs", qMakePair(0x4E00, 0x9FFF));
- categoriesRangeMap.insert("IsYiSyllables", qMakePair(0xA000, 0xA48F));
- categoriesRangeMap.insert("IsYiRadicals", qMakePair(0xA490, 0xA4CF));
- categoriesRangeMap.insert("IsModifierToneLetters", qMakePair(0xA700, 0xA71F));
- categoriesRangeMap.insert("IsSylotiNagri", qMakePair(0xA800, 0xA82F));
- categoriesRangeMap.insert("IsHangulSyllables", qMakePair(0xAC00, 0xD7A3));
- categoriesRangeMap.insert("IsPrivateUse", qMakePair(0xE000, 0xF8FF));
- categoriesRangeMap.insert("IsCJKCompatibilityIdeographs", qMakePair(0xF900, 0xFAFF));
- categoriesRangeMap.insert("IsAlphabeticPresentationForms", qMakePair(0xFB00, 0xFB4F));
- categoriesRangeMap.insert("IsArabicPresentationForms-A", qMakePair(0xFB50, 0xFDFF));
- categoriesRangeMap.insert("IsVariationSelectors", qMakePair(0xFE00, 0xFE0F));
- categoriesRangeMap.insert("IsVerticalForms", qMakePair(0xFE10, 0xFE1F));
- categoriesRangeMap.insert("IsCombiningHalfMarks", qMakePair(0xFE20, 0xFE2F));
- categoriesRangeMap.insert("IsCJKCompatibilityForms", qMakePair(0xFE30, 0xFE4F));
- categoriesRangeMap.insert("IsSmallFormVariants", qMakePair(0xFE50, 0xFE6F));
- categoriesRangeMap.insert("IsArabicPresentationForms-B", qMakePair(0xFE70, 0xFEFF));
- categoriesRangeMap.insert("IsHalfwidthandFullwidthForms", qMakePair(0xFF00, 0xFFEF));
- categoriesRangeMap.insert("IsSpecials", qMakePair(0xFFF0, 0xFFFF));
- categoriesRangeMap.insert("IsLinearBSyllabary", qMakePair(0x10000, 0x1007F));
- categoriesRangeMap.insert("IsLinearBIdeograms", qMakePair(0x10080, 0x100FF));
- categoriesRangeMap.insert("IsAegeanNumbers", qMakePair(0x10100, 0x1013F));
- categoriesRangeMap.insert("IsAncientGreekNumbers", qMakePair(0x10140, 0x1018F));
- categoriesRangeMap.insert("IsOldItalic", qMakePair(0x10300, 0x1032F));
- categoriesRangeMap.insert("IsGothic", qMakePair(0x10330, 0x1034F));
- categoriesRangeMap.insert("IsUgaritic", qMakePair(0x10380, 0x1039F));
- categoriesRangeMap.insert("IsOldPersian", qMakePair(0x103A0, 0x103DF));
- categoriesRangeMap.insert("IsDeseret", qMakePair(0x10400, 0x1044F));
- categoriesRangeMap.insert("IsShavian", qMakePair(0x10450, 0x1047F));
- categoriesRangeMap.insert("IsOsmanya", qMakePair(0x10480, 0x104AF));
- categoriesRangeMap.insert("IsCypriotSyllabary", qMakePair(0x10800, 0x1083F));
- categoriesRangeMap.insert("IsKharoshthi", qMakePair(0x10A00, 0x10A5F));
- categoriesRangeMap.insert("IsByzantineMusicalSymbols", qMakePair(0x1D000, 0x1D0FF));
- categoriesRangeMap.insert("IsMusicalSymbols", qMakePair(0x1D100, 0x1D1FF));
- categoriesRangeMap.insert("IsAncientGreekMusicalNotation", qMakePair(0x1D200, 0x1D24F));
- categoriesRangeMap.insert("IsTaiXuanJingSymbols", qMakePair(0x1D300, 0x1D35F));
- categoriesRangeMap.insert("IsMathematicalAlphanumericSymbols", qMakePair(0x1D400, 0x1D7FF));
- categoriesRangeMap.insert("IsCJKUnifiedIdeographsExtensionB", qMakePair(0x20000, 0x2A6DF));
- categoriesRangeMap.insert("IsCJKCompatibilityIdeographsSupplement", qMakePair(0x2F800, 0x2FA1F));
- categoriesRangeMap.insert("IsTags", qMakePair(0xE0000, 0xE007F));
- categoriesRangeMap.insert("IsVariationSelectorsSupplement", qMakePair(0xE0100, 0xE01EF));
- categoriesRangeMap.insert("IsSupplementaryPrivateUseArea-A", qMakePair(0xF0000, 0xFFFFF));
- categoriesRangeMap.insert("IsSupplementaryPrivateUseArea-B", qMakePair(0x100000, 0x10FFFF));
-}
+#ifndef QT_NO_REGEXP_CCLASS
+// fast lookup hash for xml schema extensions
+// sorted by name for b-search
+static const struct CategoriesRangeMapEntry {
+ const char name[40];
+ uint first, second;
+} categoriesRangeMap[] = {
+ { "AegeanNumbers", 0x10100, 0x1013F },
+ { "AlphabeticPresentationForms", 0xFB00, 0xFB4F },
+ { "AncientGreekMusicalNotation", 0x1D200, 0x1D24F },
+ { "AncientGreekNumbers", 0x10140, 0x1018F },
+ { "Arabic", 0x0600, 0x06FF },
+ { "ArabicPresentationForms-A", 0xFB50, 0xFDFF },
+ { "ArabicPresentationForms-B", 0xFE70, 0xFEFF },
+ { "ArabicSupplement", 0x0750, 0x077F },
+ { "Armenian", 0x0530, 0x058F },
+ { "Arrows", 0x2190, 0x21FF },
+ { "BasicLatin", 0x0000, 0x007F },
+ { "Bengali", 0x0980, 0x09FF },
+ { "BlockElements", 0x2580, 0x259F },
+ { "Bopomofo", 0x3100, 0x312F },
+ { "BopomofoExtended", 0x31A0, 0x31BF },
+ { "BoxDrawing", 0x2500, 0x257F },
+ { "BraillePatterns", 0x2800, 0x28FF },
+ { "Buginese", 0x1A00, 0x1A1F },
+ { "Buhid", 0x1740, 0x175F },
+ { "ByzantineMusicalSymbols", 0x1D000, 0x1D0FF },
+ { "CJKCompatibility", 0x3300, 0x33FF },
+ { "CJKCompatibilityForms", 0xFE30, 0xFE4F },
+ { "CJKCompatibilityIdeographs", 0xF900, 0xFAFF },
+ { "CJKCompatibilityIdeographsSupplement", 0x2F800, 0x2FA1F },
+ { "CJKRadicalsSupplement", 0x2E80, 0x2EFF },
+ { "CJKStrokes", 0x31C0, 0x31EF },
+ { "CJKSymbolsandPunctuation", 0x3000, 0x303F },
+ { "CJKUnifiedIdeographs", 0x4E00, 0x9FFF },
+ { "CJKUnifiedIdeographsExtensionA", 0x3400, 0x4DB5 },
+ { "CJKUnifiedIdeographsExtensionB", 0x20000, 0x2A6DF },
+ { "Cherokee", 0x13A0, 0x13FF },
+ { "CombiningDiacriticalMarks", 0x0300, 0x036F },
+ { "CombiningDiacriticalMarksSupplement", 0x1DC0, 0x1DFF },
+ { "CombiningHalfMarks", 0xFE20, 0xFE2F },
+ { "CombiningMarksforSymbols", 0x20D0, 0x20FF },
+ { "ControlPictures", 0x2400, 0x243F },
+ { "Coptic", 0x2C80, 0x2CFF },
+ { "CurrencySymbols", 0x20A0, 0x20CF },
+ { "CypriotSyllabary", 0x10800, 0x1083F },
+ { "Cyrillic", 0x0400, 0x04FF },
+ { "CyrillicSupplement", 0x0500, 0x052F },
+ { "Deseret", 0x10400, 0x1044F },
+ { "Devanagari", 0x0900, 0x097F },
+ { "Dingbats", 0x2700, 0x27BF },
+ { "EnclosedAlphanumerics", 0x2460, 0x24FF },
+ { "EnclosedCJKLettersandMonths", 0x3200, 0x32FF },
+ { "Ethiopic", 0x1200, 0x137F },
+ { "EthiopicExtended", 0x2D80, 0x2DDF },
+ { "EthiopicSupplement", 0x1380, 0x139F },
+ { "GeneralPunctuation", 0x2000, 0x206F },
+ { "GeometricShapes", 0x25A0, 0x25FF },
+ { "Georgian", 0x10A0, 0x10FF },
+ { "GeorgianSupplement", 0x2D00, 0x2D2F },
+ { "Glagolitic", 0x2C00, 0x2C5F },
+ { "Gothic", 0x10330, 0x1034F },
+ { "Greek", 0x0370, 0x03FF },
+ { "GreekExtended", 0x1F00, 0x1FFF },
+ { "Gujarati", 0x0A80, 0x0AFF },
+ { "Gurmukhi", 0x0A00, 0x0A7F },
+ { "HalfwidthandFullwidthForms", 0xFF00, 0xFFEF },
+ { "HangulCompatibilityJamo", 0x3130, 0x318F },
+ { "HangulJamo", 0x1100, 0x11FF },
+ { "HangulSyllables", 0xAC00, 0xD7A3 },
+ { "Hanunoo", 0x1720, 0x173F },
+ { "Hebrew", 0x0590, 0x05FF },
+ { "Hiragana", 0x3040, 0x309F },
+ { "IPAExtensions", 0x0250, 0x02AF },
+ { "IdeographicDescriptionCharacters", 0x2FF0, 0x2FFF },
+ { "Kanbun", 0x3190, 0x319F },
+ { "KangxiRadicals", 0x2F00, 0x2FDF },
+ { "Kannada", 0x0C80, 0x0CFF },
+ { "Katakana", 0x30A0, 0x30FF },
+ { "KatakanaPhoneticExtensions", 0x31F0, 0x31FF },
+ { "Kharoshthi", 0x10A00, 0x10A5F },
+ { "Khmer", 0x1780, 0x17FF },
+ { "KhmerSymbols", 0x19E0, 0x19FF },
+ { "Lao", 0x0E80, 0x0EFF },
+ { "Latin-1Supplement", 0x0080, 0x00FF },
+ { "LatinExtended-A", 0x0100, 0x017F },
+ { "LatinExtended-B", 0x0180, 0x024F },
+ { "LatinExtendedAdditional", 0x1E00, 0x1EFF },
+ { "LetterlikeSymbols", 0x2100, 0x214F },
+ { "Limbu", 0x1900, 0x194F },
+ { "LinearBIdeograms", 0x10080, 0x100FF },
+ { "LinearBSyllabary", 0x10000, 0x1007F },
+ { "Malayalam", 0x0D00, 0x0D7F },
+ { "MathematicalAlphanumericSymbols", 0x1D400, 0x1D7FF },
+ { "MathematicalOperators", 0x2200, 0x22FF },
+ { "MiscellaneousMathematicalSymbols-A", 0x27C0, 0x27EF },
+ { "MiscellaneousMathematicalSymbols-B", 0x2980, 0x29FF },
+ { "MiscellaneousSymbols", 0x2600, 0x26FF },
+ { "MiscellaneousSymbolsandArrows", 0x2B00, 0x2BFF },
+ { "MiscellaneousTechnical", 0x2300, 0x23FF },
+ { "ModifierToneLetters", 0xA700, 0xA71F },
+ { "Mongolian", 0x1800, 0x18AF },
+ { "MusicalSymbols", 0x1D100, 0x1D1FF },
+ { "Myanmar", 0x1000, 0x109F },
+ { "NewTaiLue", 0x1980, 0x19DF },
+ { "NumberForms", 0x2150, 0x218F },
+ { "Ogham", 0x1680, 0x169F },
+ { "OldItalic", 0x10300, 0x1032F },
+ { "OldPersian", 0x103A0, 0x103DF },
+ { "OpticalCharacterRecognition", 0x2440, 0x245F },
+ { "Oriya", 0x0B00, 0x0B7F },
+ { "Osmanya", 0x10480, 0x104AF },
+ { "PhoneticExtensions", 0x1D00, 0x1D7F },
+ { "PhoneticExtensionsSupplement", 0x1D80, 0x1DBF },
+ { "PrivateUse", 0xE000, 0xF8FF },
+ { "Runic", 0x16A0, 0x16FF },
+ { "Shavian", 0x10450, 0x1047F },
+ { "Sinhala", 0x0D80, 0x0DFF },
+ { "SmallFormVariants", 0xFE50, 0xFE6F },
+ { "SpacingModifierLetters", 0x02B0, 0x02FF },
+ { "Specials", 0xFFF0, 0xFFFF },
+ { "SuperscriptsandSubscripts", 0x2070, 0x209F },
+ { "SupplementalArrows-A", 0x27F0, 0x27FF },
+ { "SupplementalArrows-B", 0x2900, 0x297F },
+ { "SupplementalMathematicalOperators", 0x2A00, 0x2AFF },
+ { "SupplementalPunctuation", 0x2E00, 0x2E7F },
+ { "SupplementaryPrivateUseArea-A", 0xF0000, 0xFFFFF },
+ { "SupplementaryPrivateUseArea-B", 0x100000, 0x10FFFF },
+ { "SylotiNagri", 0xA800, 0xA82F },
+ { "Syriac", 0x0700, 0x074F },
+ { "Tagalog", 0x1700, 0x171F },
+ { "Tagbanwa", 0x1760, 0x177F },
+ { "Tags", 0xE0000, 0xE007F },
+ { "TaiLe", 0x1950, 0x197F },
+ { "TaiXuanJingSymbols", 0x1D300, 0x1D35F },
+ { "Tamil", 0x0B80, 0x0BFF },
+ { "Telugu", 0x0C00, 0x0C7F },
+ { "Thaana", 0x0780, 0x07BF },
+ { "Thai", 0x0E00, 0x0E7F },
+ { "Tibetan", 0x0F00, 0x0FFF },
+ { "Tifinagh", 0x2D30, 0x2D7F },
+ { "Ugaritic", 0x10380, 0x1039F },
+ { "UnifiedCanadianAboriginalSyllabics", 0x1400, 0x167F },
+ { "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()
{
@@ -3101,113 +3109,136 @@ int QRegExpEngine::getEscape()
}
yyCh = getChar(); // skip closing '}'
- if (category == "M") {
- yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing) |
- FLAG(QChar::Mark_SpacingCombining) |
- FLAG(QChar::Mark_Enclosing));
- } else if (category == "Mn") {
- yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing));
- } else if (category == "Mc") {
- yyCharClass->addCategories(FLAG(QChar::Mark_SpacingCombining));
- } else if (category == "Me") {
- yyCharClass->addCategories(FLAG(QChar::Mark_Enclosing));
- } else if (category == "N") {
- yyCharClass->addCategories(FLAG(QChar::Number_DecimalDigit) |
- FLAG(QChar::Number_Letter) |
- FLAG(QChar::Number_Other));
- } else if (category == "Nd") {
- yyCharClass->addCategories(FLAG(QChar::Number_DecimalDigit));
- } else if (category == "Nl") {
- yyCharClass->addCategories(FLAG(QChar::Number_Letter));
- } else if (category == "No") {
- yyCharClass->addCategories(FLAG(QChar::Number_Other));
- } else if (category == "Z") {
- yyCharClass->addCategories(FLAG(QChar::Separator_Space) |
- FLAG(QChar::Separator_Line) |
- FLAG(QChar::Separator_Paragraph));
- } else if (category == "Zs") {
- yyCharClass->addCategories(FLAG(QChar::Separator_Space));
- } else if (category == "Zl") {
- yyCharClass->addCategories(FLAG(QChar::Separator_Line));
- } else if (category == "Zp") {
- yyCharClass->addCategories(FLAG(QChar::Separator_Paragraph));
- } else if (category == "C") {
- yyCharClass->addCategories(FLAG(QChar::Other_Control) |
- FLAG(QChar::Other_Format) |
- FLAG(QChar::Other_Surrogate) |
- FLAG(QChar::Other_PrivateUse) |
- FLAG(QChar::Other_NotAssigned));
- } else if (category == "Cc") {
- yyCharClass->addCategories(FLAG(QChar::Other_Control));
- } else if (category == "Cf") {
- yyCharClass->addCategories(FLAG(QChar::Other_Format));
- } else if (category == "Cs") {
- yyCharClass->addCategories(FLAG(QChar::Other_Surrogate));
- } else if (category == "Co") {
- yyCharClass->addCategories(FLAG(QChar::Other_PrivateUse));
- } else if (category == "Cn") {
- yyCharClass->addCategories(FLAG(QChar::Other_NotAssigned));
- } else if (category == "L") {
- yyCharClass->addCategories(FLAG(QChar::Letter_Uppercase) |
- FLAG(QChar::Letter_Lowercase) |
- FLAG(QChar::Letter_Titlecase) |
- FLAG(QChar::Letter_Modifier) |
- FLAG(QChar::Letter_Other));
- } else if (category == "Lu") {
- yyCharClass->addCategories(FLAG(QChar::Letter_Uppercase));
- } else if (category == "Ll") {
- yyCharClass->addCategories(FLAG(QChar::Letter_Lowercase));
- } else if (category == "Lt") {
- yyCharClass->addCategories(FLAG(QChar::Letter_Titlecase));
- } else if (category == "Lm") {
- yyCharClass->addCategories(FLAG(QChar::Letter_Modifier));
- } else if (category == "Lo") {
- yyCharClass->addCategories(FLAG(QChar::Letter_Other));
- } else if (category == "P") {
- yyCharClass->addCategories(FLAG(QChar::Punctuation_Connector) |
- FLAG(QChar::Punctuation_Dash) |
- FLAG(QChar::Punctuation_Open) |
- FLAG(QChar::Punctuation_Close) |
- FLAG(QChar::Punctuation_InitialQuote) |
- FLAG(QChar::Punctuation_FinalQuote) |
- FLAG(QChar::Punctuation_Other));
- } else if (category == "Pc") {
- yyCharClass->addCategories(FLAG(QChar::Punctuation_Connector));
- } else if (category == "Pd") {
- yyCharClass->addCategories(FLAG(QChar::Punctuation_Dash));
- } else if (category == "Ps") {
- yyCharClass->addCategories(FLAG(QChar::Punctuation_Open));
- } else if (category == "Pe") {
- yyCharClass->addCategories(FLAG(QChar::Punctuation_Close));
- } else if (category == "Pi") {
- yyCharClass->addCategories(FLAG(QChar::Punctuation_InitialQuote));
- } else if (category == "Pf") {
- yyCharClass->addCategories(FLAG(QChar::Punctuation_FinalQuote));
- } else if (category == "Po") {
- yyCharClass->addCategories(FLAG(QChar::Punctuation_Other));
- } else if (category == "S") {
- yyCharClass->addCategories(FLAG(QChar::Symbol_Math) |
- FLAG(QChar::Symbol_Currency) |
- FLAG(QChar::Symbol_Modifier) |
- FLAG(QChar::Symbol_Other));
- } else if (category == "Sm") {
- yyCharClass->addCategories(FLAG(QChar::Symbol_Math));
- } else if (category == "Sc") {
- yyCharClass->addCategories(FLAG(QChar::Symbol_Currency));
- } else if (category == "Sk") {
- yyCharClass->addCategories(FLAG(QChar::Symbol_Modifier));
- } else if (category == "So") {
- yyCharClass->addCategories(FLAG(QChar::Symbol_Other));
- } else if (category.startsWith("Is")) {
- if (categoriesRangeMap.isEmpty())
- setupCategoriesRangeMap();
-
- if (categoriesRangeMap.contains(category)) {
- const QPair<int, int> range = categoriesRangeMap.value(category);
- yyCharClass->addRange(range.first, range.second);
- } else {
+ int catlen = category.length();
+ if (catlen == 1 || catlen == 2) {
+ switch (category.at(0)) {
+ case 'M':
+ if (catlen == 1) {
+ yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing) |
+ FLAG(QChar::Mark_SpacingCombining) |
+ FLAG(QChar::Mark_Enclosing));
+ } else {
+ switch (category.at(1)) {
+ case 'n': yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing)); break; // Mn
+ case 'c': yyCharClass->addCategories(FLAG(QChar::Mark_SpacingCombining)); break; // Mc
+ case 'e': yyCharClass->addCategories(FLAG(QChar::Mark_Enclosing)); break; // Me
+ default: error(RXERR_CATEGORY); break;
+ }
+ }
+ break;
+ case 'N':
+ if (catlen == 1) {
+ yyCharClass->addCategories(FLAG(QChar::Number_DecimalDigit) |
+ FLAG(QChar::Number_Letter) |
+ FLAG(QChar::Number_Other));
+ } else {
+ switch (category.at(1)) {
+ case 'd': yyCharClass->addCategories(FLAG(QChar::Number_DecimalDigit)); break; // Nd
+ case 'l': yyCharClass->addCategories(FLAG(QChar::Number_Letter)); break; // Hl
+ case 'o': yyCharClass->addCategories(FLAG(QChar::Number_Other)); break; // No
+ default: error(RXERR_CATEGORY); break;
+ }
+ }
+ break;
+ case 'Z':
+ if (catlen == 1) {
+ yyCharClass->addCategories(FLAG(QChar::Separator_Space) |
+ FLAG(QChar::Separator_Line) |
+ FLAG(QChar::Separator_Paragraph));
+ } else {
+ switch (category.at(1)) {
+ case 's': yyCharClass->addCategories(FLAG(QChar::Separator_Space)); break; // Zs
+ case 'l': yyCharClass->addCategories(FLAG(QChar::Separator_Line)); break; // Zl
+ case 'p': yyCharClass->addCategories(FLAG(QChar::Separator_Paragraph)); break; // Zp
+ default: error(RXERR_CATEGORY); break;
+ }
+ }
+ break;
+ case 'C':
+ if (catlen == 1) {
+ yyCharClass->addCategories(FLAG(QChar::Other_Control) |
+ FLAG(QChar::Other_Format) |
+ FLAG(QChar::Other_Surrogate) |
+ FLAG(QChar::Other_PrivateUse) |
+ FLAG(QChar::Other_NotAssigned));
+ } else {
+ switch (category.at(1)) {
+ case 'c': yyCharClass->addCategories(FLAG(QChar::Other_Control)); break; // Cc
+ case 'f': yyCharClass->addCategories(FLAG(QChar::Other_Format)); break; // Cf
+ case 's': yyCharClass->addCategories(FLAG(QChar::Other_Surrogate)); break; // Cs
+ case 'o': yyCharClass->addCategories(FLAG(QChar::Other_PrivateUse)); break; // Co
+ case 'n': yyCharClass->addCategories(FLAG(QChar::Other_NotAssigned)); break; // Cn
+ default: error(RXERR_CATEGORY); break;
+ }
+ }
+ break;
+ case 'L':
+ if (catlen == 1) {
+ yyCharClass->addCategories(FLAG(QChar::Letter_Uppercase) |
+ FLAG(QChar::Letter_Lowercase) |
+ FLAG(QChar::Letter_Titlecase) |
+ FLAG(QChar::Letter_Modifier) |
+ FLAG(QChar::Letter_Other));
+ } else {
+ switch (category.at(1)) {
+ case 'u': yyCharClass->addCategories(FLAG(QChar::Letter_Uppercase)); break; // Lu
+ case 'l': yyCharClass->addCategories(FLAG(QChar::Letter_Lowercase)); break; // Ll
+ case 't': yyCharClass->addCategories(FLAG(QChar::Letter_Titlecase)); break; // Lt
+ case 'm': yyCharClass->addCategories(FLAG(QChar::Letter_Modifier)); break; // Lm
+ case 'o': yyCharClass->addCategories(FLAG(QChar::Letter_Other)); break; // Lo
+ default: error(RXERR_CATEGORY); break;
+ }
+ }
+ break;
+ case 'P':
+ if (catlen == 1) {
+ yyCharClass->addCategories(FLAG(QChar::Punctuation_Connector) |
+ FLAG(QChar::Punctuation_Dash) |
+ FLAG(QChar::Punctuation_Open) |
+ FLAG(QChar::Punctuation_Close) |
+ FLAG(QChar::Punctuation_InitialQuote) |
+ FLAG(QChar::Punctuation_FinalQuote) |
+ FLAG(QChar::Punctuation_Other));
+ } else {
+ switch (category.at(1)) {
+ case 'c': yyCharClass->addCategories(FLAG(QChar::Punctuation_Connector)); break; // Pc
+ case 'd': yyCharClass->addCategories(FLAG(QChar::Punctuation_Dash)); break; // Pd
+ case 's': yyCharClass->addCategories(FLAG(QChar::Punctuation_Open)); break; // Ps
+ case 'e': yyCharClass->addCategories(FLAG(QChar::Punctuation_Close)); break; // Pe
+ case 'i': yyCharClass->addCategories(FLAG(QChar::Punctuation_InitialQuote)); break; // Pi
+ case 'f': yyCharClass->addCategories(FLAG(QChar::Punctuation_FinalQuote)); break; // Pf
+ case 'o': yyCharClass->addCategories(FLAG(QChar::Punctuation_Other)); break; // Po
+ default: error(RXERR_CATEGORY); break;
+ }
+ }
+ break;
+ case 'S':
+ 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);
+ 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 {
error(RXERR_CATEGORY);
}
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 187ad67ddb..9f68313040 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -88,6 +88,7 @@ QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(const QString &serv
: connection(con), service(serv), path(p), interface(iface),
lastError(checkIfValid(serv, p, iface, isDynamic, (connectionPrivate() &&
connectionPrivate()->mode == QDBusConnectionPrivate::PeerMode))),
+ timeout(-1),
isValid(!lastError.isValid())
{
if (!isValid)
@@ -144,7 +145,7 @@ void QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, QVariant &
QLatin1String("Get"));
QDBusMessagePrivate::setParametersValidated(msg, true);
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) {
lastError = reply;
@@ -210,7 +211,7 @@ bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const Q
QLatin1String("Set"));
QDBusMessagePrivate::setParametersValidated(msg, true);
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) {
lastError = reply;
@@ -384,6 +385,28 @@ QDBusError QDBusAbstractInterface::lastError() const
}
/*!
+ 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
arguments. This function returns the message that was received as a reply, which can be a normal
QDBusMessage::ReplyMessage (indicating success) or QDBusMessage::ErrorMessage (if the call
@@ -442,7 +465,7 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode,
QDBusMessagePrivate::setParametersValidated(msg, true);
msg.setArguments(args);
- QDBusMessage reply = d->connection.call(msg, mode);
+ QDBusMessage reply = d->connection.call(msg, mode, d->timeout);
if (thread() == QThread::currentThread())
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);
QDBusMessagePrivate::setParametersValidated(msg, true);
msg.setArguments(args);
- return d->connection.asyncCall(msg);
+ return d->connection.asyncCall(msg, d->timeout);
}
/*!
diff --git a/src/dbus/qdbusabstractinterface.h b/src/dbus/qdbusabstractinterface.h
index 72b922e499..34ff4107f9 100644
--- a/src/dbus/qdbusabstractinterface.h
+++ b/src/dbus/qdbusabstractinterface.h
@@ -95,6 +95,9 @@ public:
QDBusError lastError() const;
+ void setTimeout(int timeout);
+ int timeout() const;
+
QDBusMessage call(const QString &method,
const QVariant &arg1 = QVariant(),
const QVariant &arg2 = QVariant(),
diff --git a/src/dbus/qdbusabstractinterface_p.h b/src/dbus/qdbusabstractinterface_p.h
index a000dafa8b..4f96165aa0 100644
--- a/src/dbus/qdbusabstractinterface_p.h
+++ b/src/dbus/qdbusabstractinterface_p.h
@@ -77,6 +77,7 @@ public:
QString path;
QString interface;
mutable QDBusError lastError;
+ int timeout;
// this is set during creation and never changed
// it can't be const because QDBusInterfacePrivate has one more check
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index b32e6916f0..a5858ffc7d 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -438,6 +438,11 @@ public:
QFontEngine *engine(int at) const
{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:
friend class QPSPrintEnginePrivate;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 58cccfcbf7..95a797439a 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -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) {
// line overflows already!
const_cast<QScriptLine &>(line).justified = true;
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 25d7de827e..5539acffd7 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2303,6 +2303,7 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
continue;
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
+ multiFontEngine->ensureEngineAt(which);
glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
subLayout, pos, flags, x, width));
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);
+ multiFontEngine->ensureEngineAt(which);
QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which),
subLayout, pos, flags, x, width);
if (!glyphRun.isEmpty())
diff --git a/src/plugins/accessible/widgets/rangecontrols.cpp b/src/plugins/accessible/widgets/rangecontrols.cpp
index 8868d53dc7..485983ef12 100644
--- a/src/plugins/accessible/widgets/rangecontrols.cpp
+++ b/src/plugins/accessible/widgets/rangecontrols.cpp
@@ -212,7 +212,7 @@ QVariant QAccessibleAbstractSpinBox::currentValue()
void QAccessibleAbstractSpinBox::setCurrentValue(const QVariant &value)
{
- abstractSpinBox()->setProperty("setValue", value);
+ abstractSpinBox()->setProperty("value", value);
}
QVariant QAccessibleAbstractSpinBox::maximumValue()
diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp
index 735ad0122a..d71addb655 100644
--- a/src/testlib/qabstracttestlogger.cpp
+++ b/src/testlib/qabstracttestlogger.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "QtTest/private/qabstracttestlogger_p.h"
-#include "QtTest/private/qtestlog_p.h"
#include "QtTest/qtestassert.h"
#include "QtCore/qbytearray.h"
@@ -55,57 +54,38 @@
QT_BEGIN_NAMESPACE
-namespace QTest
-{
- static FILE *stream = 0;
-}
-
void QAbstractTestLogger::outputString(const char *msg)
{
- QTEST_ASSERT(QTest::stream);
+ QTEST_ASSERT(stream);
- ::fputs(msg, QTest::stream);
- ::fflush(QTest::stream);
+ ::fputs(msg, stream);
+ ::fflush(stream);
}
-bool QAbstractTestLogger::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 QAbstractTestLogger::startLogging()
+void QAbstractTestLogger::startLogging(const char *filename)
{
- QTEST_ASSERT(!QTest::stream);
+ QTEST_ASSERT(!stream);
- const char *out = QTestLog::outputFileName();
- if (!out) {
- QTest::stream = stdout;
+ if (!filename) {
+ stream = stdout;
return;
}
#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
- QTest::stream = ::fopen(out, "wt");
- if (!QTest::stream) {
+ stream = ::fopen(filename, "wt");
+ if (!stream) {
#endif
- printf("Unable to open file for logging: %s", out);
+ fprintf(stderr, "Unable to open file for logging: %s", filename);
::exit(1);
}
}
void QAbstractTestLogger::stopLogging()
{
- QTEST_ASSERT(QTest::stream);
- if (QTest::stream != stdout) {
- fclose(QTest::stream);
+ QTEST_ASSERT(stream);
+ if (stream != stdout) {
+ fclose(stream);
} else {
#ifdef Q_OS_SYMBIAN
// 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);
#endif
}
- QTest::stream = 0;
+ stream = 0;
}
namespace QTest
diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h
index 847c14453a..e592249e71 100644
--- a/src/testlib/qabstracttestlogger_p.h
+++ b/src/testlib/qabstracttestlogger_p.h
@@ -54,6 +54,7 @@
//
#include <qglobal.h>
+#include <stdio.h>
QT_BEGIN_NAMESPACE
@@ -79,10 +80,10 @@ public:
Info
};
- QAbstractTestLogger() {}
+ QAbstractTestLogger() : stream(0) {}
virtual ~QAbstractTestLogger() {}
- virtual void startLogging();
+ virtual void startLogging(const char *filename);
virtual void stopLogging();
virtual void enterTestFunction(const char *function) = 0;
@@ -97,8 +98,10 @@ public:
virtual void registerRandomSeed(unsigned int seed) = 0;
- static void outputString(const char *msg);
- static bool isTtyOutput();
+ void outputString(const char *msg);
+
+private:
+ FILE *stream;
};
struct QTestCharBuffer
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index 5656ac60c5..44ec792400 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -71,164 +71,50 @@ QT_BEGIN_NAMESPACE
namespace QTest {
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
-
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
static const char *incidentType2String(QAbstractTestLogger::IncidentTypes type)
{
- static bool colored = (!qgetenv("QTEST_COLORED").isEmpty());
switch (type) {
case QAbstractTestLogger::Pass:
- return COLORED_MSG(0, 32, "PASS "); //green
+ return "PASS ";
case QAbstractTestLogger::XFail:
- return COLORED_MSG(1, 32, "XFAIL "); //light green
+ return "XFAIL ";
case QAbstractTestLogger::Fail:
- return COLORED_MSG(0, 31, "FAIL! "); //red
+ return "FAIL! ";
case QAbstractTestLogger::XPass:
- return COLORED_MSG(0, 31, "XPASS "); //red, too
+ return "XPASS ";
}
return "??????";
}
static const char *benchmarkResult2String()
{
- static bool colored = (!qgetenv("QTEST_COLORED").isEmpty());
- return COLORED_MSG(0, 36, "RESULT "); // cyan
+ return "RESULT ";
}
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) {
case QAbstractTestLogger::Skip:
- return COLORED_MSG(0, 37, "SKIP "); //white
+ return "SKIP ";
case QAbstractTestLogger::Warn:
- return COLORED_MSG(0, 33, "WARNING"); // yellow
+ return "WARNING";
case QAbstractTestLogger::QWarning:
- return COLORED_MSG(1, 33, "QWARN ");
+ return "QWARN ";
case QAbstractTestLogger::QDebug:
- return COLORED_MSG(1, 33, "QDEBUG ");
+ return "QDEBUG ";
case QAbstractTestLogger::QSystem:
- return COLORED_MSG(1, 33, "QSYSTEM");
+ return "QSYSTEM";
case QAbstractTestLogger::QFatal:
- return COLORED_MSG(0, 31, "QFATAL "); // red
+ return "QFATAL ";
case QAbstractTestLogger::Info:
- return "INFO "; // no coloring
+ return "INFO ";
}
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>
static int countSignificantDigits(T num)
{
@@ -313,74 +199,149 @@ namespace QTest {
int size = result.count();
return size;
}
+}
-// static void printBenchmarkResult(const char *bmtag, int value, int iterations)
- static void 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());
+void QPlainTestLogger::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(&QTest::outputCriticalSection);
+ // OutputDebugString is not threadsafe
+ OutputDebugStringA(str);
+ LeaveCriticalSection(&QTest::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
+ 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());
+}
- 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);
+//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());
+ }
- 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 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 buf2_[1024];
- QByteArray iterationText = " per iteration";
- Q_ASSERT(result.iterations > 0);
- QTest::qt_snprintf(
- buf2_,
- sizeof(buf2_), "%s",
- iterationText.data());
+ char buf[1024];
- char buf3[1024];
- Q_ASSERT(result.iterations > 0);
- formatResult(resultBuffer, 100, result.value, countSignificantDigits(result.value));
+ if (result.setByMacro) {
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);
+ 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()
@@ -388,15 +349,6 @@ QPlainTestLogger::QPlainTestLogger()
{
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
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
}
@@ -407,9 +359,9 @@ QPlainTestLogger::~QPlainTestLogger()
#endif
}
-void QPlainTestLogger::startLogging()
+void QPlainTestLogger::startLogging(const char *filename)
{
- QAbstractTestLogger::startLogging();
+ QAbstractTestLogger::startLogging(filename);
char buf[1024];
if (QTestLog::verboseLevel() < 0) {
@@ -428,7 +380,7 @@ void QPlainTestLogger::startLogging()
", Qt %s\n", QTestResult::currentTestObjectName(), qVersion());
}
}
- QTest::outputMessage(buf);
+ outputMessage(buf);
}
void QPlainTestLogger::stopLogging()
@@ -445,7 +397,7 @@ void QPlainTestLogger::stopLogging()
QTestResult::passCount(), QTestResult::failCount(),
QTestResult::skipCount(), QTestResult::currentTestObjectName());
}
- QTest::outputMessage(buf);
+ outputMessage(buf);
QAbstractTestLogger::stopLogging();
}
@@ -454,7 +406,7 @@ void QPlainTestLogger::stopLogging()
void QPlainTestLogger::enterTestFunction(const char * /*function*/)
{
if (QTestLog::verboseLevel() >= 1)
- QTest::printMessage(QTest::messageType2String(Info), "entering");
+ printMessage(QTest::messageType2String(Info), "entering");
}
void QPlainTestLogger::leaveTestFunction()
@@ -468,13 +420,13 @@ void QPlainTestLogger::addIncident(IncidentTypes type, const char *description,
if (type == QAbstractTestLogger::Pass && QTestLog::verboseLevel() < 0)
return;
- QTest::printMessage(QTest::incidentType2String(type), description, file, line);
+ printMessage(QTest::incidentType2String(type), description, file, line);
}
void QPlainTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
{
-// QTest::printBenchmarkResult(QTest::benchmarkResult2String(), value, iterations);
- QTest::printBenchmarkResult(result);
+// printBenchmarkResult(QTest::benchmarkResult2String(), value, iterations);
+ printBenchmarkResult(result);
}
void QPlainTestLogger::addMessage(MessageTypes type, const char *message,
@@ -485,7 +437,7 @@ void QPlainTestLogger::addMessage(MessageTypes type, const char *message,
&& QTestLog::verboseLevel() < 0)
return;
- QTest::printMessage(QTest::messageType2String(type), message, file, line);
+ printMessage(QTest::messageType2String(type), message, file, line);
}
void QPlainTestLogger::registerRandomSeed(unsigned int seed)
diff --git a/src/testlib/qplaintestlogger_p.h b/src/testlib/qplaintestlogger_p.h
index aa9df834eb..5fa33e6b51 100644
--- a/src/testlib/qplaintestlogger_p.h
+++ b/src/testlib/qplaintestlogger_p.h
@@ -63,7 +63,7 @@ public:
QPlainTestLogger();
~QPlainTestLogger();
- void startLogging();
+ void startLogging(const char *filename);
void stopLogging();
void enterTestFunction(const char *function);
@@ -79,6 +79,10 @@ public:
private:
unsigned int randomSeed;
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
diff --git a/src/testlib/qtest_global.h b/src/testlib/qtest_global.h
index 85b9d6e1c1..b7479a8102 100644
--- a/src/testlib/qtest_global.h
+++ b/src/testlib/qtest_global.h
@@ -50,9 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Test)
-#ifdef QTEST_EMBED
-# define Q_TESTLIB_EXPORT
-#elif !defined(QT_SHARED) && !(defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT))
+#if !defined(QT_SHARED) && !(defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT))
# define Q_TESTLIB_EXPORT
#else
# ifdef QTESTLIB_MAKEDLL
diff --git a/src/testlib/qtestbasicstreamer.cpp b/src/testlib/qtestbasicstreamer.cpp
index 25e48ee4d5..d371b4d08e 100644
--- a/src/testlib/qtestbasicstreamer.cpp
+++ b/src/testlib/qtestbasicstreamer.cpp
@@ -43,7 +43,6 @@
#include "qtestlogger_p.h"
#include "qtestelement.h"
#include "qtestelementattribute.h"
-#include "QtTest/private/qtestlog_p.h"
#include "qtestassert.h"
#include <stdio.h>
@@ -55,14 +54,10 @@
QT_BEGIN_NAMESPACE
-namespace QTest
-{
- static FILE *stream = 0;
-}
-
-QTestBasicStreamer::QTestBasicStreamer()
- :testLogger(0)
+QTestBasicStreamer::QTestBasicStreamer(QTestLogger *logger)
+ :testLogger(logger)
{
+ QTEST_ASSERT(testLogger);
}
QTestBasicStreamer::~QTestBasicStreamer()
@@ -158,59 +153,10 @@ void QTestBasicStreamer::outputElementAttributes(const QTestElement* element, QT
void QTestBasicStreamer::outputString(const char *msg) const
{
- QTEST_ASSERT(QTest::stream);
-
- ::fputs(msg, QTest::stream);
- ::fflush(QTest::stream);
-}
-
-void QTestBasicStreamer::startStreaming()
-{
- 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;
+ testLogger->outputString(msg);
}
-const QTestLogger *QTestBasicStreamer::logger() const
+QTestLogger *QTestBasicStreamer::logger() const
{
return testLogger;
}
diff --git a/src/testlib/qtestbasicstreamer.h b/src/testlib/qtestbasicstreamer.h
index 867c1f1d7d..04bc40638f 100644
--- a/src/testlib/qtestbasicstreamer.h
+++ b/src/testlib/qtestbasicstreamer.h
@@ -58,18 +58,14 @@ struct QTestCharBuffer;
class QTestBasicStreamer
{
public:
- QTestBasicStreamer();
+ QTestBasicStreamer(QTestLogger *logger);
virtual ~QTestBasicStreamer();
virtual void output(QTestElement *element) const;
void outputString(const char *msg) const;
- bool isTtyOutput();
- void startStreaming();
- void stopStreaming();
- void setLogger(const QTestLogger *tstLogger);
- const QTestLogger *logger() const;
+ QTestLogger *logger() const;
protected:
virtual void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
@@ -81,7 +77,7 @@ class QTestBasicStreamer
virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const;
private:
- const QTestLogger *testLogger;
+ QTestLogger *testLogger;
};
QT_END_NAMESPACE
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 27a897c263..b6aaa34756 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -972,12 +972,6 @@ void seedRandom()
}
}
-int qTestRandomSeed()
-{
- Q_ASSERT(QTest::seedSet);
- return QTest::seed;
-}
-
template<typename T>
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 testTags;
-static void qPrintTestSlots()
+static void qPrintTestSlots(FILE *stream)
{
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
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;
int l = (int)strtol(str, &pEnd, 10);
if (*pEnd != 0) {
- printf("Invalid numeric parameter: '%s'\n", str);
+ fprintf(stderr, "Invalid numeric parameter: '%s'\n", str);
exit(1);
}
return l;
@@ -1100,7 +1094,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
if (qml) {
QTest::printAvailableFunctions = true;
} else {
- qPrintTestSlots();
+ qPrintTestSlots(stdout);
exit(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);
} else if (strcmp(argv[i], "-lightxml") == 0) {
QTestLog::setLogMode(QTestLog::LightXML);
- }else if(strcmp(argv[i], "-flush") == 0){
- QTestLog::setFlushMode(QTestLog::FLushOn);
+ } else if (strcmp(argv[i], "-flush") == 0){
+ QTestLog::setFlushMode(QTestLog::FlushOn);
} else if (strcmp(argv[i], "-silent") == 0) {
QTestLog::setVerboseLevel(-1);
} 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();
} else if (strcmp(argv[i], "-o") == 0) {
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);
} else {
QTestLog::redirectOutput(argv[++i]);
}
} else if (strcmp(argv[i], "-eventdelay") == 0) {
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);
} else {
QTest::eventDelay = qToInt(argv[++i]);
}
} else if (strcmp(argv[i], "-keydelay") == 0) {
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);
} else {
QTest::keyDelay = qToInt(argv[++i]);
}
} else if (strcmp(argv[i], "-mousedelay") == 0) {
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);
} else {
QTest::mouseDelay = qToInt(argv[++i]);
}
} else if (strcmp(argv[i], "-maxwarnings") == 0) {
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);
} else {
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()) {
QBenchmarkGlobalData::current->setMode(QBenchmarkGlobalData::CallgrindParentProcess);
} 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 {
- 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");
}
} 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;
}
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);
} else {
QTest::seedSet = true;
}
} else if (strcmp(argv[i], "-minimumvalue") == 0) {
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);
} else {
QBenchmarkGlobalData::current->walltimeMinimum = qToInt(argv[++i]);
}
} else if (strcmp(argv[i], "-iterations") == 0) {
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);
} else {
QBenchmarkGlobalData::current->iterationCount = qToInt(argv[++i]);
}
} else if (strcmp(argv[i], "-median") == 0) {
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);
} else {
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) {
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) {
// do nothing
} else if (strcmp(argv[i], "-graphicssystem") == 0) {
// do nothing
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);
} else {
++i;
}
} 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) {
- printf ("\nqmltest related options:\n"
- " -import : Specify an import directory.\n"
- " -input : Specify the root directory for test cases.\n"
- " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
- );
+ fprintf(stderr, "\nqmltest related options:\n"
+ " -import : Specify an import directory.\n"
+ " -input : Specify the root directory for test cases.\n"
+ " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
+ );
}
- printf("\n"
- " -help : This help\n");
+ fprintf(stderr, "\n"
+ " -help : This help\n");
exit(1);
} else if (qml) {
// 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);
}
} else {
- if (!QTest::testFuncs) {
- QTest::testFuncs = new QTest::TestFunction[512];
- }
+ if (!QTest::testFuncs) {
+ QTest::testFuncs = new QTest::TestFunction[512];
+ }
int colon = -1;
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 "()"
int idx = QTest::currentTestObject->metaObject()->indexOfMethod(buf);
if (idx < 0 || !isValidSlot(QTest::currentTestObject->metaObject()->method(idx))) {
- printf("Unknown testfunction: '%s'\n", buf);
- printf("Available testfunctions:\n");
- qPrintTestSlots();
+ fprintf(stderr, "Unknown testfunction: '%s'\n", buf);
+ fprintf(stderr, "Available testfunctions:\n");
+ qPrintTestSlots(stderr);
exit(1);
}
testFuncs[testFuncCount].set(idx, data);
- testFuncCount++;
- QTEST_ASSERT(QTest::testFuncCount < 512);
+ testFuncCount++;
+ QTEST_ASSERT(QTest::testFuncCount < 512);
}
}
if (QTest::seedSet && !QTest::randomOrder) {
- printf("-seed requires -random\n");
+ fprintf(stderr, "-seed requires -random\n");
exit(1);
}
}
@@ -1466,8 +1458,8 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0)
if (!*data)
data = 0;
else {
- printf("Unknown testdata for function %s: '%s'\n", slotName, data);
- printf("Function has no testdata.\n");
+ fprintf(stderr, "Unknown testdata for function %s: '%s'\n", slotName, data);
+ fprintf(stderr, "Function has no testdata.\n");
return false;
}
}
@@ -1492,10 +1484,10 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0)
}
if (data && !foundFunction) {
- printf("Unknown testdata for function %s: '%s'\n", slotName, data);
- printf("Available testdata:\n");
+ fprintf(stderr, "Unknown testdata for function %s: '%s'\n", slotName, data);
+ fprintf(stderr, "Available testdata:\n");
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;
}
@@ -1899,10 +1891,6 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
}
#endif
-#if defined(QTEST_NOEXITCODE)
- return 0;
-#else
-
#ifdef QTESTLIB_USE_VALGRIND
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess)
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
// since that could wrap and indicate 0 test fails
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,
const char *file, int line)
{
- QTestResult::addSkip(message, mode, file, line);
+ QTestResult::addSkip(message, file, line);
if (mode == QTest::SkipAll)
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);
}
-#define COMPARE_IMPL2(TYPE, FORMAT) \
+#define TO_STRING_IMPL(TYPE, FORMAT) \
template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE >(const TYPE &t) \
{ \
char *msg = new char[128]; \
@@ -2203,23 +2189,23 @@ template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE >(const TYPE &t) \
return msg; \
}
-COMPARE_IMPL2(short, %hd)
-COMPARE_IMPL2(ushort, %hu)
-COMPARE_IMPL2(int, %d)
-COMPARE_IMPL2(uint, %u)
-COMPARE_IMPL2(long, %ld)
-COMPARE_IMPL2(ulong, %lu)
+TO_STRING_IMPL(short, %hd)
+TO_STRING_IMPL(ushort, %hu)
+TO_STRING_IMPL(int, %d)
+TO_STRING_IMPL(uint, %u)
+TO_STRING_IMPL(long, %ld)
+TO_STRING_IMPL(ulong, %lu)
#if defined(Q_OS_WIN)
-COMPARE_IMPL2(qint64, %I64d)
-COMPARE_IMPL2(quint64, %I64u)
+TO_STRING_IMPL(qint64, %I64d)
+TO_STRING_IMPL(quint64, %I64u)
#else
-COMPARE_IMPL2(qint64, %lld)
-COMPARE_IMPL2(quint64, %llu)
+TO_STRING_IMPL(qint64, %lld)
+TO_STRING_IMPL(quint64, %llu)
#endif
-COMPARE_IMPL2(bool, %d)
-COMPARE_IMPL2(char, %c)
-COMPARE_IMPL2(float, %g)
-COMPARE_IMPL2(double, %lg)
+TO_STRING_IMPL(bool, %d)
+TO_STRING_IMPL(char, %c)
+TO_STRING_IMPL(float, %g)
+TO_STRING_IMPL(double, %lg)
/*! \internal
*/
diff --git a/src/testlib/qtestdata.h b/src/testlib/qtestdata.h
index b964ec1dcc..02ee03ff7d 100644
--- a/src/testlib/qtestdata.h
+++ b/src/testlib/qtestdata.h
@@ -69,7 +69,7 @@ public:
private:
friend class QTestTable;
- QTestData(const char *tag = 0, QTestTable *parent = 0);
+ QTestData(const char *tag, QTestTable *parent);
Q_DISABLE_COPY(QTestData)
diff --git a/src/testlib/qtestfilelogger.cpp b/src/testlib/qtestfilelogger.cpp
deleted file mode 100644
index 2349ca3cd5..0000000000
--- a/src/testlib/qtestfilelogger.cpp
+++ /dev/null
@@ -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
-
diff --git a/src/testlib/qtestfilelogger.h b/src/testlib/qtestfilelogger.h
deleted file mode 100644
index 9b10a49539..0000000000
--- a/src/testlib/qtestfilelogger.h
+++ /dev/null
@@ -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
diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp
index 5a8f96d068..8ac4e03d77 100644
--- a/src/testlib/qtestlightxmlstreamer.cpp
+++ b/src/testlib/qtestlightxmlstreamer.cpp
@@ -52,8 +52,8 @@
QT_BEGIN_NAMESPACE
-QTestLightXmlStreamer::QTestLightXmlStreamer()
- :QTestBasicStreamer()
+QTestLightXmlStreamer::QTestLightXmlStreamer(QTestLogger *logger)
+ : QTestBasicStreamer(logger)
{
}
diff --git a/src/testlib/qtestlightxmlstreamer.h b/src/testlib/qtestlightxmlstreamer.h
index c8ac68146d..b3076c1623 100644
--- a/src/testlib/qtestlightxmlstreamer.h
+++ b/src/testlib/qtestlightxmlstreamer.h
@@ -56,7 +56,7 @@ class QTestElementAttribute;
class QTestLightXmlStreamer: public QTestBasicStreamer
{
public:
- QTestLightXmlStreamer();
+ QTestLightXmlStreamer(QTestLogger *logger);
~QTestLightXmlStreamer();
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 8a2d5596f3..36b69e1155 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -45,6 +45,7 @@
#include "QtTest/private/qtestresult_p.h"
#include "QtTest/private/qabstracttestlogger_p.h"
#include "QtTest/private/qplaintestlogger_p.h"
+#include "QtTest/private/qtestlogger_p.h"
#include "QtTest/private/qxmltestlogger_p.h"
#include <QtCore/qatomic.h>
#include <QtCore/qbytearray.h>
@@ -53,9 +54,6 @@
#include <string.h>
#include <limits.h>
-
-#include "qtestlogger_p.h"
-
QT_BEGIN_NAMESPACE
namespace QTest {
@@ -168,37 +166,29 @@ namespace QTest {
}
}
-void initLogger()
-{
- switch (QTest::logMode) {
+ void initLogger()
+ {
+ switch (QTest::logMode) {
case QTestLog::Plain:
QTest::testLogger = new QPlainTestLogger;
break;
- case QTestLog::XML:{
- if(QTest::flushMode == QTestLog::FLushOn)
+ case QTestLog::XML:
+ if (QTest::flushMode == QTestLog::FlushOn)
QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete);
else
QTest::testLogger = new QTestLogger(QTestLogger::TLF_XML);
break;
- }case QTestLog::LightXML:{
- if(QTest::flushMode == QTestLog::FLushOn)
+ case QTestLog::LightXML:
+ if (QTest::flushMode == QTestLog::FlushOn)
QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light);
else
QTest::testLogger = new QTestLogger(QTestLogger::TLF_LightXml);
break;
- }case QTestLog::XunitXML:
+ case QTestLog::XunitXML:
QTest::testLogger = new QTestLogger(QTestLogger::TLF_XunitXml);
}
-}
-
-}
-
-QTestLog::QTestLog()
-{
-}
+ }
-QTestLog::~QTestLog()
-{
}
void QTestLog::enterTestFunction(const char* function)
@@ -253,6 +243,7 @@ void QTestLog::addPass(const char *msg)
void QTestLog::addFail(const char *msg, const char *file, int line)
{
QTEST_ASSERT(QTest::testLogger);
+ QTEST_ASSERT(msg);
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);
}
-void QTestLog::addSkip(const char *msg, QTest::SkipMode /*mode*/,
- const char *file, int line)
+void QTestLog::addSkip(const char *msg, const char *file, int line)
{
QTEST_ASSERT(QTest::testLogger);
QTEST_ASSERT(msg);
@@ -296,7 +286,7 @@ void QTestLog::startLogging(unsigned int randomSeed)
QTEST_ASSERT(!QTest::testLogger);
QTest::initLogger();
QTest::testLogger->registerRandomSeed(randomSeed);
- QTest::testLogger->startLogging();
+ QTest::testLogger->startLogging(QTest::outFile);
QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
}
@@ -304,7 +294,7 @@ void QTestLog::startLogging()
{
QTEST_ASSERT(!QTest::testLogger);
QTest::initLogger();
- QTest::testLogger->startLogging();
+ QTest::testLogger->startLogging(QTest::outFile);
QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
}
@@ -356,6 +346,8 @@ int QTestLog::verboseLevel()
void QTestLog::addIgnoreMessage(QtMsgType type, const char *msg)
{
+ QTEST_ASSERT(msg);
+
QTest::IgnoreResultList *item = new QTest::IgnoreResultList(type, msg);
QTest::IgnoreResultList *list = QTest::ignoreResultList;
diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
index 20c731fee6..006b3ac12f 100644
--- a/src/testlib/qtestlog_p.h
+++ b/src/testlib/qtestlog_p.h
@@ -63,7 +63,7 @@ class Q_TESTLIB_EXPORT QTestLog
{
public:
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 leaveTestFunction();
@@ -72,8 +72,7 @@ public:
static void addFail(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 addSkip(const char *msg, QTest::SkipMode mode,
- const char *file, int line);
+ static void addSkip(const char *msg, const char *file, int line);
static void addBenchmarkResult(const QBenchmarkResult &result);
static void addIgnoreMessage(QtMsgType type, const char *msg);
static int unhandledIgnoreMessages();
diff --git a/src/testlib/qtestlogger.cpp b/src/testlib/qtestlogger.cpp
index 2c81a4bec7..d53a968719 100644
--- a/src/testlib/qtestlogger.cpp
+++ b/src/testlib/qtestlogger.cpp
@@ -44,7 +44,6 @@
#include "qtestxunitstreamer.h"
#include "qtestxmlstreamer.h"
#include "qtestlightxmlstreamer.h"
-#include "qtestfilelogger.h"
#include "QtTest/qtestcase.h"
#include "QtTest/private/qtestresult_p.h"
@@ -55,15 +54,16 @@
QT_BEGIN_NAMESPACE
QTestLogger::QTestLogger(int fm)
- :listOfTestcases(0), currentLogElement(0), errorLogElement(0),
- logFormatter(0), format( (TestLoggerFormat)fm ), filelogger(new QTestFileLogger),
- testCounter(0), passCounter(0),
- failureCounter(0), errorCounter(0),
- warningCounter(0), skipCounter(0),
- systemCounter(0), qdebugCounter(0),
- qwarnCounter(0), qfatalCounter(0),
- infoCounter(0), randomSeed_(0),
- hasRandomSeed_(false)
+ : listOfTestcases(0)
+ , currentLogElement(0)
+ , errorLogElement(0)
+ , logFormatter(0)
+ , format( (TestLoggerFormat)fm )
+ , testCounter(0)
+ , failureCounter(0)
+ , errorCounter(0)
+ , randomSeed_(0)
+ , hasRandomSeed_(false)
{
}
@@ -75,31 +75,25 @@ QTestLogger::~QTestLogger()
delete listOfTestcases;
delete logFormatter;
- delete filelogger;
}
-void QTestLogger::startLogging()
+void QTestLogger::startLogging(const char *filename)
{
+ QAbstractTestLogger::startLogging(filename);
+
switch(format){
- case TLF_LightXml:{
- logFormatter = new QTestLightXmlStreamer;
- filelogger->init();
+ case TLF_LightXml:
+ logFormatter = new QTestLightXmlStreamer(this);
break;
- }case TLF_XML:{
- logFormatter = new QTestXmlStreamer;
- filelogger->init();
+ case TLF_XML:
+ logFormatter = new QTestXmlStreamer(this);
break;
- }case TLF_XunitXml:{
- logFormatter = new QTestXunitStreamer;
+ case TLF_XunitXml:
+ logFormatter = new QTestXunitStreamer(this);
delete errorLogElement;
errorLogElement = new QTestElement(QTest::LET_SystemError);
- filelogger->init();
break;
}
- }
-
- logFormatter->setLogger(this);
- logFormatter->startStreaming();
}
void QTestLogger::stopLogging()
@@ -161,15 +155,11 @@ void QTestLogger::stopLogging()
logFormatter->output(iterator);
}
- logFormatter->stopStreaming();
+ QAbstractTestLogger::stopLogging();
}
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->addAttribute(QTest::AI_Name, function);
currentLogElement->addToList(&listOfTestcases);
@@ -193,11 +183,9 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
typeBuf = "xpass";
break;
case QAbstractTestLogger::Pass:
- ++passCounter;
typeBuf = "pass";
break;
case QAbstractTestLogger::XFail:
- ++passCounter;
typeBuf = "xfail";
break;
case QAbstractTestLogger::Fail:
@@ -271,7 +259,6 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
void QTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
{
QTestElement *benchmarkElement = new QTestElement(QTest::LET_Benchmark);
-// printf("element %i", benchmarkElement->elementType());
benchmarkElement->addAttribute(
QTest::AI_Metric,
@@ -313,31 +300,24 @@ void QTestLogger::addMessage(MessageTypes type, const char *message, const char
switch (type) {
case QAbstractTestLogger::Warn:
- ++warningCounter;
typeBuf = "warn";
break;
case QAbstractTestLogger::QSystem:
- ++systemCounter;
typeBuf = "system";
break;
case QAbstractTestLogger::QDebug:
- ++qdebugCounter;
typeBuf = "qdebug";
break;
case QAbstractTestLogger::QWarning:
- ++qwarnCounter;
typeBuf = "qwarn";
break;
case QAbstractTestLogger::QFatal:
- ++qfatalCounter;
typeBuf = "qfatal";
break;
case QAbstractTestLogger::Skip:
- ++skipCounter;
typeBuf = "skip";
break;
case QAbstractTestLogger::Info:
- ++infoCounter;
typeBuf = "info";
break;
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)
{
randomSeed_ = seed;
diff --git a/src/testlib/qtestlogger_p.h b/src/testlib/qtestlogger_p.h
index 1d27b63e21..eef5b92d2b 100644
--- a/src/testlib/qtestlogger_p.h
+++ b/src/testlib/qtestlogger_p.h
@@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE
class QTestBasicStreamer;
class QTestElement;
-class QTestFileLogger;
class QTestLogger : public QAbstractTestLogger
{
@@ -74,7 +73,7 @@ class QTestLogger : public QAbstractTestLogger
TLF_XunitXml = 2
};
- void startLogging();
+ void startLogging(const char *filename);
void stopLogging();
void enterTestFunction(const char *function);
@@ -88,19 +87,6 @@ class QTestLogger : public QAbstractTestLogger
void addMessage(MessageTypes type, const char *message,
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);
unsigned int randomSeed() const;
bool hasRandomSeed() const;
@@ -111,19 +97,10 @@ class QTestLogger : public QAbstractTestLogger
QTestElement *errorLogElement;
QTestBasicStreamer *logFormatter;
TestLoggerFormat format;
- QTestFileLogger *filelogger;
int testCounter;
- int passCounter;
int failureCounter;
int errorCounter;
- int warningCounter;
- int skipCounter;
- int systemCounter;
- int qdebugCounter;
- int qwarnCounter;
- int qfatalCounter;
- int infoCounter;
unsigned int randomSeed_;
bool hasRandomSeed_;
};
diff --git a/src/testlib/qtestresult.cpp b/src/testlib/qtestresult.cpp
index 7fb0208bb3..4a6764b115 100644
--- a/src/testlib/qtestresult.cpp
+++ b/src/testlib/qtestresult.cpp
@@ -285,12 +285,11 @@ void QTestResult::addFailure(const char *message, const char *file, int line)
++QTest::fails;
}
-void QTestResult::addSkip(const char *message, QTest::SkipMode mode,
- const char *file, int line)
+void QTestResult::addSkip(const char *message, const char *file, int line)
{
clearExpectFail();
- QTestLog::addSkip(message, mode, file, line);
+ QTestLog::addSkip(message, file, line);
++QTest::skips;
}
diff --git a/src/testlib/qtestresult_p.h b/src/testlib/qtestresult_p.h
index a3e265ffac..1ce81854b5 100644
--- a/src/testlib/qtestresult_p.h
+++ b/src/testlib/qtestresult_p.h
@@ -93,8 +93,7 @@ public:
static void setCurrentTestFunction(const char *func);
static void setCurrentTestLocation(TestLocation loc);
static void setCurrentTestObject(const char *name);
- static void addSkip(const char *message, QTest::SkipMode mode,
- const char *file, int line);
+ static void addSkip(const char *message, const char *file, int line);
static bool expectFail(const char *dataIndex, const char *comment,
QTest::TestFailMode mode, const char *file, int line);
static bool verify(bool statement, const char *statementStr, const char *extraInfo,
diff --git a/src/testlib/qtestxmlstreamer.cpp b/src/testlib/qtestxmlstreamer.cpp
index 6a7f9ae8f7..7a4115262b 100644
--- a/src/testlib/qtestxmlstreamer.cpp
+++ b/src/testlib/qtestxmlstreamer.cpp
@@ -53,8 +53,8 @@
QT_BEGIN_NAMESPACE
-QTestXmlStreamer::QTestXmlStreamer()
- :QTestBasicStreamer()
+QTestXmlStreamer::QTestXmlStreamer(QTestLogger *logger)
+ : QTestBasicStreamer(logger)
{
}
diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h
index 46318a9d18..96e8246779 100644
--- a/src/testlib/qtestxmlstreamer.h
+++ b/src/testlib/qtestxmlstreamer.h
@@ -40,7 +40,7 @@
****************************************************************************/
#ifndef QTESTXMLSTREAMER_H
-#define QTESXMLSTREAMER_H
+#define QTESTXMLSTREAMER_H
#include <QtTest/qtestbasicstreamer.h>
@@ -56,7 +56,7 @@ class QTestElementAttribute;
class QTestXmlStreamer: public QTestBasicStreamer
{
public:
- QTestXmlStreamer();
+ QTestXmlStreamer(QTestLogger *logger);
~QTestXmlStreamer();
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
diff --git a/src/testlib/qtestxunitstreamer.cpp b/src/testlib/qtestxunitstreamer.cpp
index c4b3192c5a..fb9699eef1 100644
--- a/src/testlib/qtestxunitstreamer.cpp
+++ b/src/testlib/qtestxunitstreamer.cpp
@@ -48,8 +48,8 @@
QT_BEGIN_NAMESPACE
-QTestXunitStreamer::QTestXunitStreamer()
- :QTestBasicStreamer()
+QTestXunitStreamer::QTestXunitStreamer(QTestLogger *logger)
+ : QTestBasicStreamer(logger)
{}
QTestXunitStreamer::~QTestXunitStreamer()
diff --git a/src/testlib/qtestxunitstreamer.h b/src/testlib/qtestxunitstreamer.h
index f99e231f8d..4d1cb2734a 100644
--- a/src/testlib/qtestxunitstreamer.h
+++ b/src/testlib/qtestxunitstreamer.h
@@ -55,7 +55,7 @@ class QTestLogger;
class QTestXunitStreamer: public QTestBasicStreamer
{
public:
- QTestXunitStreamer();
+ QTestXunitStreamer(QTestLogger *logger);
~QTestXunitStreamer();
void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp
index 2c8ba6c0a7..15b5c84fd5 100644
--- a/src/testlib/qxmltestlogger.cpp
+++ b/src/testlib/qxmltestlogger.cpp
@@ -102,9 +102,9 @@ QXmlTestLogger::~QXmlTestLogger()
{
}
-void QXmlTestLogger::startLogging()
+void QXmlTestLogger::startLogging(const char *filename)
{
- QAbstractTestLogger::startLogging();
+ QAbstractTestLogger::startLogging(filename);
QTestCharBuffer buf;
if (xmlmode == QXmlTestLogger::Complete) {
diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h
index dc2f4b8aa1..ad510d5ce0 100644
--- a/src/testlib/qxmltestlogger_p.h
+++ b/src/testlib/qxmltestlogger_p.h
@@ -66,7 +66,7 @@ public:
QXmlTestLogger(XmlMode mode = Complete);
~QXmlTestLogger();
- void startLogging();
+ void startLogging(const char *filename);
void stopLogging();
void enterTestFunction(const char *function);
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index a017d33b4a..a65510f567 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -27,7 +27,6 @@ HEADERS = qbenchmark.h \
qtestelement.h \
qtestevent.h \
qtesteventloop.h \
- qtestfilelogger.h \
qtest_global.h \
qtest_gui.h \
qtest.h \
@@ -60,8 +59,7 @@ SOURCES = qtestcase.cpp \
qtestxunitstreamer.cpp \
qtestxmlstreamer.cpp \
qtestlightxmlstreamer.cpp \
- qtestlogger.cpp \
- qtestfilelogger.cpp
+ qtestlogger.cpp
DEFINES *= QT_NO_CAST_TO_ASCII \
QT_NO_CAST_FROM_ASCII \
QTESTLIB_MAKEDLL \
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index ca79cbb670..2d176552a8 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -527,7 +527,6 @@ QT_CLASS_LIB(QTestMouseEvent, QtTest, qtestevent.h)
QT_CLASS_LIB(QTestDelayEvent, QtTest, qtestevent.h)
QT_CLASS_LIB(QTestEventList, QtTest, qtestevent.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(QEventSizeOfChecker, QtTest, qtestspontaneevent.h)
QT_CLASS_LIB(QEventSizeOfChecker, QtTest, qtestspontaneevent.h)
diff --git a/src/widgets/accessible/qaccessible.h b/src/widgets/accessible/qaccessible.h
index 312e2a3088..3a59810866 100644
--- a/src/widgets/accessible/qaccessible.h
+++ b/src/widgets/accessible/qaccessible.h
@@ -84,40 +84,40 @@ public:
MenuCommand = 0x0018,
// Values from IAccessible2
- ActionChanged = 0x0101,
- ActiveDescendantChanged,
- AttributeChanged,
- DocumentContentChanged,
- DocumentLoadComplete,
- DocumentLoadStopped,
- DocumentReload,
- HyperlinkEndIndexChanged,
- HyperlinkNumberOfAnchorsChanged,
- HyperlinkSelectedLinkChanged,
- HypertextLinkActivated,
- HypertextLinkSelected,
- HyperlinkStartIndexChanged,
- HypertextChanged,
- HypertextNLinksChanged,
- ObjectAttributeChanged,
- PageChanged,
- SectionChanged,
- TableCaptionChanged,
- TableColumnDescriptionChanged,
- TableColumnHeaderChanged,
- TableModelChanged,
- TableRowDescriptionChanged,
- TableRowHeaderChanged,
- TableSummaryChanged,
- TextAttributeChanged,
- TextCaretMoved,
- // TextChanged, deprecated, use TextUpdated
- TextColumnChanged = TextCaretMoved + 2,
- TextInserted,
- TextRemoved,
- TextUpdated,
- TextSelectionChanged,
- VisibleDataChanged,
+ ActionChanged = 0x0101,
+ ActiveDescendantChanged = 0x0102,
+ AttributeChanged = 0x0103,
+ DocumentContentChanged = 0x0104,
+ DocumentLoadComplete = 0x0105,
+ DocumentLoadStopped = 0x0106,
+ DocumentReload = 0x0107,
+ HyperlinkEndIndexChanged = 0x0108,
+ HyperlinkNumberOfAnchorsChanged = 0x0109,
+ HyperlinkSelectedLinkChanged = 0x010A,
+ HypertextLinkActivated = 0x010B,
+ HypertextLinkSelected = 0x010C,
+ HyperlinkStartIndexChanged = 0x010D,
+ HypertextChanged = 0x010E,
+ HypertextNLinksChanged = 0x010F,
+ ObjectAttributeChanged = 0x0110,
+ PageChanged = 0x0111,
+ SectionChanged = 0x0112,
+ TableCaptionChanged = 0x0113,
+ TableColumnDescriptionChanged = 0x0114,
+ TableColumnHeaderChanged = 0x0115,
+ TableModelChanged = 0x0116,
+ TableRowDescriptionChanged = 0x0117,
+ TableRowHeaderChanged = 0x0118,
+ TableSummaryChanged = 0x0119,
+ TextAttributeChanged = 0x011A,
+ TextCaretMoved = 0x011B,
+ // TextChanged = 0x011C, is deprecated in IA2, use TextUpdated
+ TextColumnChanged = 0x011D,
+ TextInserted = 0x011E,
+ TextRemoved = 0x011F,
+ TextUpdated = 0x0120,
+ TextSelectionChanged = 0x0121,
+ VisibleDataChanged = 0x0122,
ObjectCreated = 0x8000,
ObjectDestroyed = 0x8001,
@@ -162,6 +162,9 @@ public:
Offscreen = 0x00010000,
Sizeable = 0x00020000,
Movable = 0x00040000,
+#ifdef QT3_SUPPORT
+ Moveable = Movable,
+#endif
SelfVoicing = 0x00080000,
Focusable = 0x00100000,
Selectable = 0x00200000,
diff --git a/src/widgets/accessible/qaccessible_unix.cpp b/src/widgets/accessible/qaccessible_unix.cpp
index 19fbe78301..1c1eb2ad05 100644
--- a/src/widgets/accessible/qaccessible_unix.cpp
+++ b/src/widgets/accessible/qaccessible_unix.cpp
@@ -96,7 +96,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
}
initialize();
- if (bridges()->isEmpty())
+ if (!bridges() || bridges()->isEmpty())
return;
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o);
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index a8ac1a1bc0..e597760a61 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3172,7 +3172,7 @@ bool QApplication::desktopSettingsAware()
one of the above events. If no keys are being held Qt::NoModifier is
returned.
- \sa mouseButtons()
+ \sa mouseButtons(), queryKeyboardModifiers()
*/
Qt::KeyboardModifiers QApplication::keyboardModifiers()
@@ -3181,6 +3181,31 @@ Qt::KeyboardModifiers QApplication::keyboardModifiers()
}
/*!
+ \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
updated syncronously as the event queue is emptied of events that will
spontaneously change the mouse state (QEvent::MouseButtonPress and
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index c7ec35c83d..aec2c07763 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -200,6 +200,7 @@ public:
static void alert(QWidget *widget, int duration = 0);
static Qt::KeyboardModifiers keyboardModifiers();
+ static Qt::KeyboardModifiers queryKeyboardModifiers();
static Qt::MouseButtons mouseButtons();
static void setDesktopSettingsAware(bool);
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index fa75aeaebc..b122632e44 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -55,6 +55,10 @@
#include "private/qstylesheetstyle_p.h"
#include <qmath.h>
+#ifndef QT_NO_ACCESSIBILITY
+#include <qaccessible.h>
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -377,6 +381,11 @@ void QLabel::setText(const QString &text)
#endif
d->updateLabel();
+
+#ifndef QT_NO_ACCESSIBILITY
+ if (accessibleName().isEmpty())
+ QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+#endif
}
QString QLabel::text() const