From 8fe7f1340bbb09db3d14923835c4e678134c4018 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 16:20:39 +0100 Subject: remove dead code --- tools/linguist/lupdate/main.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 9a9af68..a0ab7f9 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -237,18 +237,12 @@ int main(int argc, char **argv) Verbose | // verbose is on by default starting with Qt 4.2 HeuristicSameText | HeuristicSimilarText | HeuristicNumber; int numFiles = 0; - bool standardSyntax = true; bool metTsFlag = false; bool recursiveScan = true; QString extensions = m_defaultExtensions; QSet extensionsNameFilters; - for (int i = 1; i < argc; ++i) { - if (args.at(i) == QLatin1String("-ts")) - standardSyntax = false; - } - for (int i = 1; i < argc; ++i) { QString arg = args.at(i); if (arg == QLatin1String("-help") @@ -375,8 +369,6 @@ int main(int argc, char **argv) numFiles++; - QString fullText; - codecForTr.clear(); codecForSource.clear(); -- cgit v0.12 From f562d3056a1977ce63653477f095d9678021cf0f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 13:03:52 +0100 Subject: tidy up the test .pro files --- .../linguist/lupdate/testdata/good/backslashes/project.pro | 10 ---------- .../linguist/lupdate/testdata/good/codecforsrc/project.pro | 10 +--------- .../auto/linguist/lupdate/testdata/good/codecfortr/project.pro | 8 +------- .../linguist/lupdate/testdata/good/codecfortr1/project.pro | 4 +--- .../linguist/lupdate/testdata/good/codecfortr2/project.pro | 4 +--- .../linguist/lupdate/testdata/good/lacksqobject/project.pro | 5 +---- .../linguist/lupdate/testdata/good/merge_ordering/project.pro | 5 +---- .../linguist/lupdate/testdata/good/merge_versions/project.pro | 5 +---- .../lupdate/testdata/good/merge_whitespace/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro | 5 +---- .../lupdate/testdata/good/mergecpp_noobsolete/project.pro | 5 +---- .../lupdate/testdata/good/mergecpp_obsolete/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro | 5 +---- .../lupdate/testdata/good/mergeui_obsolete/project.pro | 5 +---- .../lupdate/testdata/good/multiple_locations/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/namespaces/project.pro | 5 +---- .../lupdate/testdata/good/parse_special_chars/project.pro | 5 +---- .../linguist/lupdate/testdata/good/parsecontexts/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/parsecpp2/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/parsejava/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/parseui/project.pro | 5 +---- tests/auto/linguist/lupdate/testdata/good/prefix/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/preprocess/project.pro | 5 +---- .../auto/linguist/lupdate/testdata/good/proparsing/project.pro | 5 +---- .../linguist/lupdate/testdata/good/proparsing2/project.pro | 5 +---- .../linguist/lupdate/testdata/good/proparsingpri/project.pro | 4 +--- .../lupdate/testdata/good/proparsingsubdirs/project.pro | 5 ++--- .../lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro | 6 +----- .../lupdate/testdata/good/proparsingsubs/common/common.pro | 5 +---- .../linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro | 6 +----- .../lupdate/testdata/good/proparsingsubs/unix/unix.pro | 6 +----- .../linguist/lupdate/testdata/good/proparsingsubs/win/win.pro | 6 +----- .../linguist/lupdate/testdata/good/textsimilarity/project.pro | 5 +---- .../testdata/output_ts/toplevel/library/tools/tools.pro | 5 +---- 35 files changed, 35 insertions(+), 154 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro index 3584c89..33eb1f3 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro @@ -1,13 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) ma 22. jan 10:10:16 2007 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input SOURCES += src\main.cpp TRANSLATIONS = ts\project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro index 848ebda..3b6559d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro @@ -1,13 +1,7 @@ -TEMPLATE = app -TARGET += -DEPENDPATH += . -INCLUDEPATH += . - -# Input SOURCES += main.cpp +CONFIG+= console TRANSLATIONS = project.ts -CONFIG+= console CODECFORTR = utf-8 CODECFORSRC = utf-8 @@ -16,5 +10,3 @@ exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) unix: system(rm $$TRANSLATIONS) } - - diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro index 81273ee..841cfa6 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro @@ -1,13 +1,7 @@ -TEMPLATE = app -TARGET += -DEPENDPATH += . -INCLUDEPATH += . - -# Input SOURCES += main.cpp +CONFIG+= console TRANSLATIONS = project.ts -CONFIG+= console CODECFORTR = CP1251 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro index 1d5b071..acbf8b9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro @@ -1,9 +1,7 @@ -TEMPLATE = app - SOURCES += main.cpp +CONFIG += console TRANSLATIONS = project.ts -CONFIG += console CODECFORTR = CP1252 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro index f4975f2..5b382ad 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro @@ -1,9 +1,7 @@ -TEMPLATE = app - SOURCES += main.cpp +CONFIG += console TRANSLATIONS = project.ts -CONFIG += console CODECFORSRC = CP1252 CODECFORTR = UTF-8 diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro index 7547a8d..ff4dbd2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro index e79456f..f8c7ca2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += foo.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro index 6c704c2..70dd7ce 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro index f4faf2f..7eea86d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro index e988c0a..698047a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += finddialog.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro index e988c0a..698047a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += finddialog.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro index e988c0a..698047a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += finddialog.cpp -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro index 28ba291..9a0d55d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro index 28ba291..9a0d55d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro index 4582705..c3f1112 100644 --- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro @@ -1,10 +1,7 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp SOURCES += finddialog.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro index 56d472c..4ab0edf 100644 --- a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro index cb18ea4..4ab0edf 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro index 7547a8d..ff4dbd2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro index 4582705..c3f1112 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro @@ -1,10 +1,7 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp SOURCES += finddialog.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro index 7547a8d..ff4dbd2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro index 7e64c80..2032674 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = Java - SOURCES += main.java -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro index bdc06e7..9ae812c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32 : system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro index 7547a8d..ff4dbd2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES = main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro index 012c7e0..a66306d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro index 3078817..5282863 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro @@ -1,6 +1,3 @@ -TEMPLATE = app -LANGUAGE = C++ - # Try to reference a variable that does not exist: MYVAR=$$THIS_VARIABLE_IS_NOT_DEFINED @@ -31,7 +28,7 @@ if (exists($$member($$(PATH), 0))) { SOURCES += main_dependpath.cpp } -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro index 1d6895a..92644e5 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro @@ -3,9 +3,6 @@ # It also tries to verify the behaviour of combining quoted and non-quoted elements with literals. # -TEMPLATE = app -LANGUAGE = C++ - QUOTED = $$quote(variable with spaces) VERSIONAB = "a.b" VAB = $$split(VERSIONAB, ".") @@ -33,7 +30,7 @@ SOURCES += $$Q3 win32: SOURCES += $$system(type files-cc.txt) unix: SOURCES += $$system(cat files-cc.txt) -TRANSLATIONS += project.ts +TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro index 3810a02..14a991f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro @@ -1,6 +1,3 @@ -TEMPLATE = app -LANGUAGE = C++ - include(win/win.pri) include(mac/mac.pri) include(unix/unix.pri) @@ -8,6 +5,7 @@ include (common/common.pri) # Important: keep the space before the ' include(relativity/relativity.pri) message($$SOURCES) + TRANSLATIONS = project.ts exists( $$TRANSLATIONS ) { diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro index 4de6622..88f2435 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro @@ -1,3 +1,2 @@ -TEMPLATE =subdirs - -SUBDIRS = sub1 +TEMPLATE = subdirs +SUBDIRS = sub1 diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro index 1d50c2b..cf55f10 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro @@ -1,12 +1,8 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += ../project.ts +TRANSLATIONS = ../project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) unix: system(rm -f $$TRANSLATIONS) } - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro index a8b3106..3f6c643 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro @@ -1,5 +1,2 @@ -TEMPLATE = app -LANGUAGE = C++ - -SOURCES += main.cpp +SOURCES += main.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro index 87478bf..a1863b6 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro @@ -1,5 +1 @@ -TEMPLATE = app -LANGUAGE = C++ - -SOURCES += main_mac.cpp - +SOURCES += main_mac.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro index d0ebec7..71b1a22 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro @@ -1,5 +1 @@ -TEMPLATE = app -LANGUAGE = C++ - -SOURCES += main_unix.cpp - +SOURCES += main_unix.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro index a9a9751..afd7197 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro @@ -1,5 +1 @@ -TEMPLATE = app -LANGUAGE = C++ - -SOURCES += main_win.cpp - +SOURCES += main_win.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro index 28ba291..9a0d55d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - FORMS += project.ui -TRANSLATIONS = project.ts +TRANSLATIONS = project.ts # Copy the ts to a temp file because: # 1. The depot file is usually read-only diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro index ec6c01d..5d263ae 100644 --- a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro +++ b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro @@ -1,9 +1,6 @@ -TEMPLATE = app -LANGUAGE = C++ - SOURCES += main.cpp -TRANSLATIONS += translations/project.ts +TRANSLATIONS = translations/project.ts exists( $$TRANSLATIONS ) { win32: system(del $$TRANSLATIONS) -- cgit v0.12 From 9e6104565cbe2ae7559791fa6e4787d890477588 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 18:36:35 +0100 Subject: clean up the lupdatecmd files --- tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd | 3 +-- tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd | 6 +----- .../linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd | 6 +----- tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd | 4 ---- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd index 9b83a04..13b2927 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd @@ -1,3 +1,2 @@ -# Add the command that lupdate should run here. If it can't find anything it will default to TRANSLATION: ts\project.ts -lupdate -silent project.pro +lupdate project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd index 91a4800..82b4b0d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd @@ -1,5 +1 @@ -# Add the command that lupdate should run here. If it can't find anything it will default to -# 'lupdate project.pro -ts project.ts' - -# lupdate project.pro -lupdate -silent -locations relative project.pro +lupdate -locations relative project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd index d200143..500a822 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd @@ -1,5 +1 @@ -# Add the command that lupdate should run here. If it can't find anything it will default to -# 'lupdate project.pro -ts project.ts' - -# lupdate project.pro -lupdate -silent -noobsolete project.pro +lupdate -noobsolete project.pro diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd b/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd index 80319de..d3a5bf7 100644 --- a/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd @@ -1,5 +1 @@ -# Add the command that lupdate should run here. If it can't find anything it will default to -# 'lupdate project.pro -ts project.ts' - -# lupdate project.pro lupdate toplevel/library/tools/tools.pro -- cgit v0.12 From 79f1414fabe097d1fb87b2f3153dcde910e0b2cb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 14:11:42 +0100 Subject: no point in specifying -ts when a .pro file is specified ... unless of course one hits this weird lupdate behavior regarding SUBDIRS in conjunction with -ts. just use the flag for this one test for now. --- tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd | 1 - tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd | 1 + tests/auto/linguist/lupdate/tst_lupdate.cpp | 5 ++--- 3 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd index 13b2927..f0e1ab2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd @@ -1,2 +1 @@ TRANSLATION: ts\project.ts -lupdate project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd new file mode 100644 index 0000000..b7e12cc --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd @@ -0,0 +1 @@ +lupdate project.pro -ts project.ts diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 7140ede..e880eed 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -197,9 +197,8 @@ void tst_lupdate::good() file.close(); } - if (lupdatecmd.isEmpty()) { - lupdatecmd = QLatin1String("project.pro -ts project.ts"); - } + if (lupdatecmd.isEmpty()) + lupdatecmd = QLatin1String("project.pro"); lupdatecmd.prepend("-silent "); m_lupdate.updateProFile(lupdatecmd); -- cgit v0.12 From 14fc1147d156b9f600a66ec8a5bfc71e936f0bdf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 5 Jan 2010 21:01:30 +0100 Subject: fix number heuristics, part 1 Reviewed-by: TrustMe --- tools/linguist/lupdate/merge.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index fa0dd3d..1f006ea 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -63,7 +63,7 @@ static bool isDigitFriendly(QChar c) static int numberLength(const QString &s, int i) { - if (i < s.size() || !s.at(i).isDigit()) + if (i >= s.size() || !s.at(i).isDigit()) return 0; int pos = i; @@ -90,7 +90,7 @@ static QString zeroKey(const QString &key) QString zeroed; bool metSomething = false; - for (int i = 0; i != key.size(); ++i) { + for (int i = 0; i < key.size(); ++i) { int len = numberLength(key, i); if (len > 0) { i += len; -- cgit v0.12 From 2bd2e35078e0cdf9f1458892adcd0939504b59bb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 12:34:12 +0100 Subject: fix sametext and number heuristics 92e9a48 ("eliminate Translator::replace()") eliminated the correctness as well. whoops. this code should be more efficient as well ... --- .../testdata/good/heuristics/expectedoutput.txt | 5 ++ .../lupdate/testdata/good/heuristics/lupdatecmd | 2 + .../lupdate/testdata/good/heuristics/main.cpp | 62 +++++++++++++++ .../lupdate/testdata/good/heuristics/project.pro | 3 + .../testdata/good/heuristics/project.ts.before | 38 +++++++++ .../testdata/good/heuristics/project.ts.result | 22 ++++++ tools/linguist/lupdate/merge.cpp | 91 +++++++++++----------- 7 files changed, 178 insertions(+), 45 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt new file mode 100644 index 0000000..1eed403 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt @@ -0,0 +1,5 @@ +Updating 'project\.ts'\.\.\. + Found 3 source text\(s\) \(3 new and 0 already existing\) + Removed 5 obsolete entries + Number heuristic provided 1 translation\(s\) + Same-text heuristic provided 1 translation\(s\) diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd new file mode 100644 index 0000000..6bda261 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd @@ -0,0 +1,2 @@ +TRANSLATION: project.ts +lupdate -verbose -disable-heuristic similartext -no-obsolete project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp b/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp new file mode 100644 index 0000000..9f36b33 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +#define QTCORE +#include QTCORE // Hidden from lupdate, but compiles + +class A: public QObject { + Q_OBJECT + void foo() + { + // number Heuristics + tr("version 2.0 now"); + + // same text match + tr("this is the matched same text"); + + // failed same text + tr("this is the non-matched same text"); + } +}; + diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro new file mode 100644 index 0000000..759bea0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before new file mode 100644 index 0000000..ce82810 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before @@ -0,0 +1,38 @@ + + + + + A + + + version 1.0 now + teraz wersja 1.0 + + + + B + + + this is the matched same text + der same-text-treffer + + + + this is the non-matched same text + same-text-reinfall variante eins + + + + C + + + this is the matched same text + der same-text-treffer + + + + this is the non-matched same text + völlig andere variante des reinfalls mit same-text + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result new file mode 100644 index 0000000..402ad9a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result @@ -0,0 +1,22 @@ + + + + + A + + + version 2.0 now + teraz wersja 1.0 {2.0 ?} + + + + this is the matched same text + der same-text-treffer + + + + this is the non-matched same text + + + + diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index 1f006ea..b657282 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -50,9 +50,6 @@ #include #include -typedef QList TML; -typedef QMap TMM; - QT_BEGIN_NAMESPACE @@ -225,31 +222,36 @@ static QString translationAttempt(const QString &oldTranslation, */ int applyNumberHeuristic(Translator &tor) { - TMM translated, untranslated; - TMM::Iterator t, u; - TML all = tor.messages(); - TML::Iterator it; + QMap > translated; + QVector untranslated(tor.messageCount()); int inserted = 0; - for (it = all.begin(); it != all.end(); ++it) { - bool hasTranslation = it->isTranslated(); - if (it->type() == TranslatorMessage::Unfinished) { + for (int i = 0; i < tor.messageCount(); ++i) { + const TranslatorMessage &msg = tor.message(i); + bool hasTranslation = msg.isTranslated(); + if (msg.type() == TranslatorMessage::Unfinished) { if (!hasTranslation) - untranslated.insert(it->context() + QLatin1Char('\n') - + it->sourceText() + QLatin1Char('\n') - + it->comment(), *it); - } else if (hasTranslation && it->translations().count() == 1) { - translated.insert(zeroKey(it->sourceText()), *it); + untranslated[i] = true; + } else if (hasTranslation && msg.translations().count() == 1) { + const QString &key = zeroKey(msg.sourceText()); + if (!key.isEmpty()) + translated.insert(key, qMakePair(msg.sourceText(), msg.translation())); } } - for (u = untranslated.begin(); u != untranslated.end(); ++u) { - t = translated.find(zeroKey((*u).sourceText())); - if (t != translated.end() && !t.key().isEmpty() - && t->sourceText() != u->sourceText()) { - u->setTranslation(translationAttempt(t->translation(), t->sourceText(), - u->sourceText())); - inserted++; + for (int i = 0; i < tor.messageCount(); ++i) { + if (untranslated[i]) { + TranslatorMessage &msg = tor.message(i); + const QString &key = zeroKey(msg.sourceText()); + if (!key.isEmpty()) { + QMap >::ConstIterator t = + translated.constFind(key); + if (t != translated.constEnd() && t->first != msg.sourceText()) { + msg.setTranslation(translationAttempt(t->second, t->first, + msg.sourceText())); + inserted++; + } + } } } return inserted; @@ -268,43 +270,42 @@ int applyNumberHeuristic(Translator &tor) int applySameTextHeuristic(Translator &tor) { - TMM translated; - TMM avoid; - TMM::Iterator t; - TML untranslated; - TML::Iterator u; - TML all = tor.messages(); - TML::Iterator it; + QMap translated; + QMap avoid; // Want a QTreeSet, in fact + QVector untranslated(tor.messageCount()); int inserted = 0; - for (it = all.begin(); it != all.end(); ++it) { - if (!it->isTranslated()) { - if (it->type() == TranslatorMessage::Unfinished) - untranslated.append(*it); + for (int i = 0; i < tor.messageCount(); ++i) { + const TranslatorMessage &msg = tor.message(i); + if (!msg.isTranslated()) { + if (msg.type() == TranslatorMessage::Unfinished) + untranslated[i] = true; } else { - QString key = it->sourceText(); - t = translated.find(key); - if (t != translated.end()) { + const QString &key = msg.sourceText(); + QMap::ConstIterator t = translated.constFind(key); + if (t != translated.constEnd()) { /* The same source text is translated at least two different ways. Do nothing then. */ - if (t->translations() != it->translations()) { + if (*t != msg.translations()) { translated.remove(key); - avoid.insert(key, *it); + avoid.insert(key, true); } } else if (!avoid.contains(key)) { - translated.insert(key, *it); + translated.insert(key, msg.translations()); } } } - for (u = untranslated.begin(); u != untranslated.end(); ++u) { - QString key = u->sourceText(); - t = translated.find(key); - if (t != translated.end()) { - u->setTranslations(t->translations()); - ++inserted; + for (int i = 0; i < tor.messageCount(); ++i) { + if (untranslated[i]) { + TranslatorMessage &msg = tor.message(i); + QMap::ConstIterator t = translated.constFind(msg.sourceText()); + if (t != translated.constEnd()) { + msg.setTranslations(*t); + ++inserted; + } } } return inserted; -- cgit v0.12 From 1ee6d3dc9529be1304c5d546e92bf1db832b5bb4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 12:51:43 +0100 Subject: look for the .result file in the dir where the output is expected to go that makes manual diffing simpler and makes more complex dir structures less confusing. --- .../linguist/lupdate/testdata/good/backslashes/project.pro | 6 ------ .../lupdate/testdata/good/backslashes/project.ts.result | 13 ------------- .../lupdate/testdata/good/backslashes/ts/project.ts.result | 13 +++++++++++++ tests/auto/linguist/lupdate/tst_lupdate.cpp | 2 +- 4 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro index 33eb1f3..4698b2b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro @@ -1,9 +1,3 @@ SOURCES += src\main.cpp TRANSLATIONS = ts\project.ts - - -!exists(ts) { - win32: system(md ts) - else: system(mkdir ts) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result deleted file mode 100644 index d3a5fdf..0000000 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result +++ /dev/null @@ -1,13 +0,0 @@ - - - - - QApplication - - - QT_LAYOUT_DIRECTION - Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. - - - - diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result new file mode 100644 index 0000000..d3a5fdf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result @@ -0,0 +1,13 @@ + + + + + QApplication + + + QT_LAYOUT_DIRECTION + Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. + + + + diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index e880eed..0442d27 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -167,7 +167,6 @@ void tst_lupdate::good() QFETCH(QString, directory); QString dir = m_basePath + "good/" + directory; - QString expectedFile = dir + QLatin1String("/project.ts.result"); qDebug() << "Checking..."; @@ -213,6 +212,7 @@ void tst_lupdate::good() return; } + QString expectedFile = generatedtsfile + QLatin1String(".result"); doCompare(generatedtsfile, expectedFile, false); } -- cgit v0.12 From a54a8961bad16c55bd0a56896dec42de875cc0b4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 12:51:02 +0100 Subject: move equivalent of output_ts test to good/ --- tests/auto/linguist/lupdate/.gitignore | 2 +- .../lupdate/testdata/good/reloutput/lupdatecmd | 2 + .../lupdate/testdata/good/reloutput/main.cpp | 50 ++++++++++++++++++++++ .../lupdate/testdata/good/reloutput/project.pro | 9 ++++ .../good/reloutput/translations/project.ts.result | 12 ++++++ .../linguist/lupdate/testdata/output_ts/lupdatecmd | 1 - .../lupdate/testdata/output_ts/project.ts.result | 12 ------ .../output_ts/toplevel/library/tools/main.cpp | 50 ---------------------- .../output_ts/toplevel/library/tools/tools.pro | 9 ---- .../toplevel/library/tools/translations/readme.txt | 2 - tests/auto/linguist/lupdate/tst_lupdate.cpp | 49 --------------------- 11 files changed, 74 insertions(+), 124 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro delete mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt diff --git a/tests/auto/linguist/lupdate/.gitignore b/tests/auto/linguist/lupdate/.gitignore index 4ba5b79..389f2dc 100644 --- a/tests/auto/linguist/lupdate/.gitignore +++ b/tests/auto/linguist/lupdate/.gitignore @@ -1,4 +1,4 @@ tst_lupdate testdata/good/*/project.ts -testdata/output_ts/toplevel/library/tools/translations/project.ts +testdata/good/*/*/project.ts testdata/recursivescan/*.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd new file mode 100644 index 0000000..da6103f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd @@ -0,0 +1,2 @@ +TRANSLATION: translations/project.ts +lupdate project.pro -ts translations/project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp b/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp new file mode 100644 index 0000000..5a681e2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro new file mode 100644 index 0000000..5d263ae --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro @@ -0,0 +1,9 @@ +SOURCES += main.cpp + +TRANSLATIONS = translations/project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm -f $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result new file mode 100644 index 0000000..e398701 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result @@ -0,0 +1,12 @@ + + + + + QApplication + + + Hello world + + + + diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd b/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd deleted file mode 100644 index d3a5bf7..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd +++ /dev/null @@ -1 +0,0 @@ -lupdate toplevel/library/tools/tools.pro diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result b/tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result deleted file mode 100644 index e398701..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result +++ /dev/null @@ -1,12 +0,0 @@ - - - - - QApplication - - - Hello world - - - - diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp deleted file mode 100644 index 5a681e2..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// IMPORTANT!!!! If you want to add testdata to this file, -// always add it to the end in order to not change the linenumbers of translations!!! - - -void func1() { - QApplication::tr("Hello world"); -} - - diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro deleted file mode 100644 index 5d263ae..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro +++ /dev/null @@ -1,9 +0,0 @@ -SOURCES += main.cpp - -TRANSLATIONS = translations/project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt deleted file mode 100644 index 83adcd2..0000000 --- a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is just a dummy file so that GIT creates this folder - diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 0442d27..73ede2f 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -60,7 +60,6 @@ public: private slots: void good_data(); void good(); - void output_ts(); void commandline_data(); void commandline(); #if CHECK_SIMTEXTH @@ -216,54 +215,6 @@ void tst_lupdate::good() doCompare(generatedtsfile, expectedFile, false); } -void tst_lupdate::output_ts() -{ - QString dir = m_basePath + "output_ts"; - m_lupdate.setWorkingDirectory(dir); - - // look for a command - QString lupdatecmd; - QFile file(dir + "/lupdatecmd"); - if (file.exists()) { - QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); - while (!file.atEnd()) { - QByteArray cmdstring = file.readLine().simplified(); - if (cmdstring.startsWith('#')) - continue; - if (cmdstring.startsWith("lupdate")) { - cmdstring.remove(0, 8); - lupdatecmd.append(cmdstring); - break; - } - } - file.close(); - } - - QDir parsingDir(m_basePath + "output_ts"); - - QString generatedtsfile = - dir + QLatin1String("/toplevel/library/tools/translations/project.ts"); - - QFile::remove(generatedtsfile); - - lupdatecmd.prepend("-silent "); - m_lupdate.qmake(); - m_lupdate.updateProFile(lupdatecmd); - - // If the file expectedoutput.txt exists, compare the - // console output with the content of that file - QFile outfile(dir + "/expectedoutput.txt"); - if (outfile.exists()) { - QString errs = m_lupdate.getErrorMessages().at(1).trimmed(); - QStringList errslist = errs.split(QLatin1Char('\n')); - doCompare(errslist, outfile.fileName(), true); - if (QTest::currentTestFailed()) - return; - } - - doCompare(generatedtsfile, dir + QLatin1String("/project.ts.result"), false); -} - void tst_lupdate::commandline_data() { QTest::addColumn("currentPath"); -- cgit v0.12 From 40e3c68a38152ecdc354a2d503490f9b0ff49740 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 14:17:57 +0100 Subject: don't use qmake for test setup this makes the tests rather significantly faster --- tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro | 5 ----- tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro | 7 ------- tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro | 7 ------- tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro | 7 ------- .../auto/linguist/lupdate/testdata/good/lacksqobject/project.pro | 6 ------ .../linguist/lupdate/testdata/good/merge_ordering/project.pro | 8 -------- .../linguist/lupdate/testdata/good/merge_versions/project.pro | 8 -------- .../linguist/lupdate/testdata/good/merge_whitespace/project.pro | 8 -------- tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro | 8 -------- .../lupdate/testdata/good/mergecpp_noobsolete/project.pro | 8 -------- .../linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro | 8 -------- tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro | 8 -------- .../linguist/lupdate/testdata/good/mergeui_obsolete/project.pro | 8 -------- .../linguist/lupdate/testdata/good/multiple_locations/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro | 6 ------ .../lupdate/testdata/good/parse_special_chars/project.pro | 6 ------ .../auto/linguist/lupdate/testdata/good/parsecontexts/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/parseui/project.pro | 7 ------- tests/auto/linguist/lupdate/testdata/good/prefix/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro | 6 ------ tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro | 6 ------ .../linguist/lupdate/testdata/good/proparsingpaths/project.pro | 5 ----- .../auto/linguist/lupdate/testdata/good/proparsingpri/project.pro | 5 ----- .../lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro | 5 ----- .../linguist/lupdate/testdata/good/proparsingsubs/project.pro | 5 ----- tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro | 6 ------ .../linguist/lupdate/testdata/good/textsimilarity/project.pro | 8 -------- tests/auto/linguist/lupdate/testlupdate.cpp | 8 -------- tests/auto/linguist/lupdate/testlupdate.h | 2 -- tests/auto/linguist/lupdate/tst_lupdate.cpp | 7 +++++-- 34 files changed, 5 insertions(+), 215 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro index 3b6559d..7225608 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro @@ -5,8 +5,3 @@ TRANSLATIONS = project.ts CODECFORTR = utf-8 CODECFORSRC = utf-8 - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro index 841cfa6..64f3c85 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro @@ -4,10 +4,3 @@ CONFIG+= console TRANSLATIONS = project.ts CODECFORTR = CP1251 - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - - diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro index acbf8b9..d5697eb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro @@ -4,10 +4,3 @@ CONFIG += console TRANSLATIONS = project.ts CODECFORTR = CP1252 - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - - diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro index 5b382ad..c95939c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro @@ -5,10 +5,3 @@ TRANSLATIONS = project.ts CODECFORSRC = CP1252 CODECFORTR = UTF-8 - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - - diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro index ff4dbd2..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro @@ -1,9 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro index f8c7ca2..6149858 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro @@ -1,11 +1,3 @@ SOURCES += foo.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro index 70dd7ce..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro @@ -1,11 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro index 7eea86d..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro @@ -1,11 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro index 698047a..63f5d66 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro @@ -1,11 +1,3 @@ SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro index 698047a..63f5d66 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro @@ -1,11 +1,3 @@ SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro index 698047a..63f5d66 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro @@ -1,11 +1,3 @@ SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro index 9a0d55d..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro @@ -1,11 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro index 9a0d55d..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro @@ -1,11 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro index c3f1112..bbabdfb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro @@ -2,9 +2,3 @@ SOURCES += main.cpp SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro index 4ab0edf..c96859b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro @@ -1,9 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro index 4ab0edf..c96859b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro @@ -1,9 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro index ff4dbd2..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro @@ -1,9 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro index c3f1112..bbabdfb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro @@ -2,9 +2,3 @@ SOURCES += main.cpp SOURCES += finddialog.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro index ff4dbd2..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro @@ -1,9 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro index 2032674..657b535 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro @@ -1,9 +1,3 @@ SOURCES += main.java TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro index 9ae812c..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro @@ -1,10 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32 : system(del $$TRANSLATIONS) - unix : system(rm $$TRANSLATIONS) -} - - diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro index ff4dbd2..759bea0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro @@ -1,9 +1,3 @@ SOURCES = main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro index a66306d..c96859b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro @@ -1,9 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro index 5282863..0e920f9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro @@ -29,9 +29,3 @@ if (exists($$member($$(PATH), 0))) { } TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro index 92644e5..3dc4208 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro @@ -31,9 +31,3 @@ win32: SOURCES += $$system(type files-cc.txt) unix: SOURCES += $$system(cat files-cc.txt) TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro index 820b4fa..6bfe751 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro @@ -3,8 +3,3 @@ SOURCES += file*.cpp filter.cpp non-existing.cpp include(sub/sub.pri) TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro index 14a991f..5e23538 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro @@ -7,8 +7,3 @@ include(relativity/relativity.pri) message($$SOURCES) TRANSLATIONS = project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm $$TRANSLATIONS) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro index cf55f10..df18c5a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro @@ -1,8 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = ../project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro index 668ecf4..f75a462 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro @@ -1,7 +1,2 @@ TEMPLATE = subdirs SUBDIRS = win mac unix common - -exists( project.ts ) { - win32: system(del project.ts) - unix: system(rm project.ts) -} diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro index 5d263ae..4e2e6ad 100644 --- a/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro @@ -1,9 +1,3 @@ SOURCES += main.cpp TRANSLATIONS = translations/project.ts - -exists( $$TRANSLATIONS ) { - win32: system(del $$TRANSLATIONS) - unix: system(rm -f $$TRANSLATIONS) -} - diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro index 9a0d55d..fa56972 100644 --- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro @@ -1,11 +1,3 @@ FORMS += project.ui TRANSLATIONS = project.ts - -# Copy the ts to a temp file because: -# 1. The depot file is usually read-only -# 2. We don't want to modify the original file, since then it won't be possible to run the test twice -# without reverting the original file again. - -win32: system(copy /Y project.ts.before $$TRANSLATIONS) -unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp index d43fbc4..877959a 100644 --- a/tests/auto/linguist/lupdate/testlupdate.cpp +++ b/tests/auto/linguist/lupdate/testlupdate.cpp @@ -58,7 +58,6 @@ TestLUpdate::TestLUpdate() childProc = 0; QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath); m_cmdLupdate = binPath + QLatin1String("/lupdate"); - m_cmdQMake = binPath + QLatin1String("/qmake"); } TestLUpdate::~TestLUpdate() @@ -149,10 +148,3 @@ bool TestLUpdate::updateProFile(const QString &arguments) QStringList args = arguments.split(QChar(' ')); return runChild( true, m_cmdLupdate, args ); } - -bool TestLUpdate::qmake() -{ - QStringList args; - args << "-r"; - return runChild(true, m_cmdQMake, args); -} diff --git a/tests/auto/linguist/lupdate/testlupdate.h b/tests/auto/linguist/lupdate/testlupdate.h index 581e5e9..153d7ba 100644 --- a/tests/auto/linguist/lupdate/testlupdate.h +++ b/tests/auto/linguist/lupdate/testlupdate.h @@ -57,7 +57,6 @@ public: void setWorkingDirectory( const QString &workDir); bool run( const QString &commandline); bool updateProFile( const QString &arguments); - bool qmake(); QStringList getErrorMessages() { return make_result; } @@ -66,7 +65,6 @@ public: } private: QString m_cmdLupdate; - QString m_cmdQMake; QString m_workDir; QProcess *childProc; QStringList env_list; diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 73ede2f..02bb71e 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -169,11 +169,9 @@ void tst_lupdate::good() qDebug() << "Checking..."; - // qmake will delete the previous one, to ensure that we don't do any merging.... QString generatedtsfile(QLatin1String("project.ts")); m_lupdate.setWorkingDirectory(dir); - m_lupdate.qmake(); // look for a command QString lupdatecmd; QFile file(dir + "/lupdatecmd"); @@ -195,6 +193,11 @@ void tst_lupdate::good() file.close(); } + QFile::remove(generatedtsfile); + QString beforetsfile = generatedtsfile + QLatin1String(".before"); + if (QFile::exists(beforetsfile)) + QVERIFY2(QFile::copy(beforetsfile, generatedtsfile), qPrintable(beforetsfile)); + if (lupdatecmd.isEmpty()) lupdatecmd = QLatin1String("project.pro"); lupdatecmd.prepend("-silent "); -- cgit v0.12 From b1b6b0aae294def9b7d04a1fea387d82ed852026 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jan 2010 12:36:35 +0100 Subject: make the lupdate tests more verbose in case of failure on the way, replace the convoluted TestLUpdate class with a few QProcess calls. --- tests/auto/linguist/lupdate/lupdate.pro | 3 +- tests/auto/linguist/lupdate/testlupdate.cpp | 150 ---------------------------- tests/auto/linguist/lupdate/testlupdate.h | 85 ---------------- tests/auto/linguist/lupdate/tst_lupdate.cpp | 50 +++++++--- 4 files changed, 37 insertions(+), 251 deletions(-) delete mode 100644 tests/auto/linguist/lupdate/testlupdate.cpp delete mode 100644 tests/auto/linguist/lupdate/testlupdate.h diff --git a/tests/auto/linguist/lupdate/lupdate.pro b/tests/auto/linguist/lupdate/lupdate.pro index 19259dc..bcaaf66 100644 --- a/tests/auto/linguist/lupdate/lupdate.pro +++ b/tests/auto/linguist/lupdate/lupdate.pro @@ -2,6 +2,5 @@ CONFIG += qttest_p4 TARGET = tst_lupdate -HEADERS += testlupdate.h -SOURCES += tst_lupdate.cpp testlupdate.cpp +SOURCES += tst_lupdate.cpp diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp deleted file mode 100644 index 877959a..0000000 --- a/tests/auto/linguist/lupdate/testlupdate.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Linguist of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "testlupdate.h" -#include -#include -#include -#include -#include - -#ifdef Q_OS_WIN32 -# include -#endif - -#include - - -TestLUpdate::TestLUpdate() -{ - childProc = 0; - QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath); - m_cmdLupdate = binPath + QLatin1String("/lupdate"); -} - -TestLUpdate::~TestLUpdate() -{ - if (childProc) - delete childProc; -} - -void TestLUpdate::setWorkingDirectory(const QString &workDir) -{ - m_workDir = workDir; - QDir::setCurrent(m_workDir); -} - -void TestLUpdate::addMakeResult( const QString &result ) -{ - make_result.append( result ); -} - -bool TestLUpdate::runChild( bool showOutput, const QString &program, const QStringList &argList) -{ - make_result.clear(); - exit_ok = FALSE; - if (childProc) - delete childProc; - - child_show = showOutput; - if ( showOutput ) { - QString S = argList.join(" "); - addMakeResult( program + QLatin1String(" ") + S ); - } - - childProc = new QProcess(); - Q_ASSERT(childProc); - - childProc->setWorkingDirectory(m_workDir); - connect(childProc, SIGNAL(finished(int)), this, SLOT(childReady(int))); - childProc->setProcessChannelMode(QProcess::MergedChannels); - if (argList.isEmpty()) { - childProc->start( program, QIODevice::ReadWrite | QIODevice::Text ); - } else { - childProc->start( program, argList, QIODevice::ReadWrite | QIODevice::Text ); - } - bool ok; - - ok = childProc->waitForStarted(); - - if (ok) - ok = childProc->waitForFinished(); - - if (!ok) - addMakeResult( "Error executing '" + program + "'." ); - - childReady(ok ? 0 : -1); - - return ok; -} - -void TestLUpdate::childReady(int /*exitCode*/) -{ - if (childProc != 0) { - childHasData(); - exit_ok = childProc->state() == QProcess::NotRunning - && childProc->exitStatus() == 0; - childProc->deleteLater(); - } - childProc = 0; -} - -void TestLUpdate::childHasData() -{ - //QByteArray ba = childProc->readAllStandardError(); - //qDebug() << "ERROR:" << ba; - QString stdoutput = childProc->readAllStandardOutput(); - stdoutput = stdoutput.replace("\t", " "); - if (child_show) - addMakeResult(stdoutput); -} - -bool TestLUpdate::run(const QString &commandline) -{ - return runChild(true, m_cmdLupdate + QLatin1String(" ") + commandline); -} - - -bool TestLUpdate::updateProFile(const QString &arguments) -{ - QStringList args = arguments.split(QChar(' ')); - return runChild( true, m_cmdLupdate, args ); -} diff --git a/tests/auto/linguist/lupdate/testlupdate.h b/tests/auto/linguist/lupdate/testlupdate.h deleted file mode 100644 index 153d7ba..0000000 --- a/tests/auto/linguist/lupdate/testlupdate.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Linguist of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TESTLUPDATE_H -#define TESTLUPDATE_H - -#include -#include -#include - -class TestLUpdate : public QObject -{ - Q_OBJECT - -public: - TestLUpdate(); - virtual ~TestLUpdate(); - - void setWorkingDirectory( const QString &workDir); - bool run( const QString &commandline); - bool updateProFile( const QString &arguments); - QStringList getErrorMessages() { - return make_result; - } - void clearResult() { - make_result.clear(); - } -private: - QString m_cmdLupdate; - QString m_workDir; - QProcess *childProc; - QStringList env_list; - QStringList make_result; - - bool child_show; - bool qws_mode; - bool exit_ok; - - bool runChild( bool showOutput, const QString &program, const QStringList &argList = QStringList()); - void addMakeResult( const QString &result ); - void childHasData(); - -private slots: - void childReady(int exitCode); -}; - -#endif // TESTLUPDATE_H diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 02bb71e..80c8f4f 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include "testlupdate.h" #if CHECK_SIMTEXTH #include "../shared/simtexth.h" #endif @@ -55,7 +54,7 @@ class tst_lupdate : public QObject { Q_OBJECT public: - tst_lupdate() { m_basePath = QDir::currentPath() + QLatin1String("/testdata/"); } + tst_lupdate(); private slots: void good_data(); @@ -68,7 +67,7 @@ private slots: #endif private: - TestLUpdate m_lupdate; + QString m_cmdLupdate; QString m_basePath; void doCompare(const QStringList &actual, const QString &expectedFn, bool err); @@ -76,10 +75,17 @@ private: }; +tst_lupdate::tst_lupdate() +{ + QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath); + m_cmdLupdate = binPath + QLatin1String("/lupdate"); + m_basePath = QDir::currentPath() + QLatin1String("/testdata/"); +} + void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn, bool err) { QFile file(expectedFn); - QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); + QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Text), qPrintable(expectedFn)); QStringList expected = QString(file.readAll()).trimmed().split('\n'); int i = 0, ei = expected.size(), gi = actual.size(); @@ -140,7 +146,7 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn void tst_lupdate::doCompare(const QString &actualFn, const QString &expectedFn, bool err) { QFile afile(actualFn); - QVERIFY(afile.open(QIODevice::ReadOnly | QIODevice::Text)); + QVERIFY2(afile.open(QIODevice::ReadOnly | QIODevice::Text), qPrintable(actualFn)); QStringList actual = QString(afile.readAll()).trimmed().split('\n'); doCompare(actual, expectedFn, err); @@ -169,14 +175,13 @@ void tst_lupdate::good() qDebug() << "Checking..."; - QString generatedtsfile(QLatin1String("project.ts")); + QString generatedtsfile(dir + QLatin1String("/project.ts")); - m_lupdate.setWorkingDirectory(dir); // look for a command QString lupdatecmd; QFile file(dir + "/lupdatecmd"); if (file.exists()) { - QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); + QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Text), qPrintable(file.fileName())); while (!file.atEnd()) { QByteArray cmdstring = file.readLine().simplified(); if (cmdstring.startsWith('#')) @@ -201,14 +206,24 @@ void tst_lupdate::good() if (lupdatecmd.isEmpty()) lupdatecmd = QLatin1String("project.pro"); lupdatecmd.prepend("-silent "); - m_lupdate.updateProFile(lupdatecmd); + + QProcess proc; + proc.setWorkingDirectory(dir); + proc.setProcessChannelMode(QProcess::MergedChannels); + proc.start(m_cmdLupdate + ' ' + lupdatecmd, QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(proc.waitForFinished(5000), qPrintable(lupdatecmd)); + QByteArray output = proc.readAll().trimmed(); + QVERIFY2(proc.exitStatus() == QProcess::NormalExit, + "\"lupdate " + lupdatecmd.toLatin1() + "\" crashed\n" + output); + QVERIFY2(!proc.exitCode(), + "\"lupdate " + lupdatecmd.toLatin1() + "\" exited with code " + + QByteArray::number(proc.exitCode()) + "\n" + proc.readAll()); // If the file expectedoutput.txt exists, compare the // console output with the content of that file QFile outfile(dir + "/expectedoutput.txt"); if (outfile.exists()) { - QString errs = m_lupdate.getErrorMessages().at(1).trimmed(); - QStringList errslist = errs.split(QLatin1Char('\n')); + QStringList errslist = QString::fromLatin1(output).split(QLatin1Char('\n')); doCompare(errslist, outfile.fileName(), true); if (QTest::currentTestFailed()) return; @@ -238,14 +253,21 @@ void tst_lupdate::commandline() QFETCH(QString, generatedtsfile); QFETCH(QString, expectedtsfile); - m_lupdate.setWorkingDirectory(m_basePath + currentPath); QString generated = m_basePath + currentPath + QLatin1Char('/') + generatedtsfile; QFile gen(generated); if (gen.exists()) QVERIFY(gen.remove()); - if (!m_lupdate.run("-silent " + commandline)) - qDebug() << m_lupdate.getErrorMessages().last(); + QProcess proc; + proc.setWorkingDirectory(m_basePath + currentPath); + proc.setProcessChannelMode(QProcess::MergedChannels); + proc.start(m_cmdLupdate + " -silent " + commandline, QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(proc.waitForFinished(5000), qPrintable(commandline)); + QVERIFY2(proc.exitStatus() == QProcess::NormalExit, + "\"lupdate -silent " + commandline.toLatin1() + "\" crashed\n" + proc.readAll()); + QVERIFY2(!proc.exitCode(), + "\"lupdate -silent " + commandline.toLatin1() + "\" exited with code " + + QByteArray::number(proc.exitCode()) + "\n" + proc.readAll()); doCompare(generated, m_basePath + currentPath + QLatin1Char('/') + expectedtsfile, false); } -- cgit v0.12 From 1ff8e5ae0a3108086aacd53d3f8d213f13e05a4e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 7 Jan 2010 21:56:55 +0100 Subject: don't complain about unresolved base when the reference is absolute Task-number: QTBUG-6072 --- tools/linguist/lupdate/cpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 857233e..b7f7807 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1732,7 +1732,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) plural = true; } } - if (!pendingContext.isEmpty()) { + if (!pendingContext.isEmpty() && !prefix.startsWith(strColons)) { QStringList unresolved; if (!fullyQualify(namespaces, pendingContext, true, &functionContext, &unresolved)) { functionContextUnresolved = unresolved.join(strColons); -- cgit v0.12 From a25fbb9afdda4315a501ebf10c9fede8905b4329 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 7 Jan 2010 22:05:28 +0100 Subject: fix test under windows the windows mkspecs auto-add debug_and_release to CONFIG and thus trigger warnings from the profile parser. --- tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro index 759bea0..034f298 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro @@ -1,3 +1,4 @@ SOURCES = main.cpp +CONFIG -= debug_and_release TRANSLATIONS = project.ts -- cgit v0.12 From 4f362459366122d12939057bfa13c770f09037a3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 8 Jan 2010 11:11:15 +0100 Subject: Translations: Update German for 4.6.1 --- translations/qt_de.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/translations/qt_de.ts b/translations/qt_de.ts index 81968fb..a06691a 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -7958,6 +7958,34 @@ Bitte wählen Sie einen anderen Dateinamen. + QXmlPatternistCLI + + + Warning in %1, at line %2, column %3: %4 + Fehler in %1, bei Zeile %2, Spalte %3: %4 + + + + Warning in %1: %2 + Warnung in %1: %2 + + + + Unknown location + unbekannt + + + + Error %1 in %2, at line %3, column %4: %5 + Fehler %1 in %2, bei Zeile %3, Spalte %4: %5 + + + + Error %1 in %2: %3 + Fehler %1 in %2: %3 + + + QXmlStream -- cgit v0.12 From 5533c854c154ec39ecdf15734a5be090dba19d0e Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 8 Jan 2010 13:51:58 +0100 Subject: Doc typos fixed Reviewed-by: David Boddie --- doc/src/examples/moveblocks.qdoc | 6 +++--- examples/animation/moveblocks/main.cpp | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/src/examples/moveblocks.qdoc b/doc/src/examples/moveblocks.qdoc index 2dce477..250251d 100644 --- a/doc/src/examples/moveblocks.qdoc +++ b/doc/src/examples/moveblocks.qdoc @@ -60,7 +60,7 @@ states. \o \c StateSwitchTransition is a custom transition that triggers on \c{StateSwitchEvent}s. - \o \c StateSwitchEvent is a QEvent that trigger \c{StateSwitchTransition}s. + \o \c StateSwitchEvent is a QEvent that triggers \c{StateSwitchTransition}s. \o \c QGraphicsRectWidget is a QGraphicsWidget that simply paints its background in a solid \l{Qt::}{blue} color. \endlist @@ -141,7 +141,7 @@ Finally, we can create the state machine, add our initial state, and start execution of the state graph. - \section2 The \c createGemetryState() Function + \section2 The \c createGeometryState() Function In \c createGeometryState(), we set up the geometry for each graphics item. @@ -155,7 +155,7 @@ \section1 The StateSwitcher Class \c StateSwitcher has state switch transitions to each \l{QState}s - we created with \c createGemetryState(). Its job is to transition + we created with \c createGeometryState(). Its job is to transition to one of these states at random when it is entered. All functions in \c StateSwitcher are inlined. We'll step through diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp index f8aa434..a2c0958 100644 --- a/examples/animation/moveblocks/main.cpp +++ b/examples/animation/moveblocks/main.cpp @@ -147,7 +147,6 @@ QState *createGeometryState(QObject *w1, const QRect &rect1, { QState *result = new QState(parent); result->assignProperty(w1, "geometry", rect1); - result->assignProperty(w1, "geometry", rect1); result->assignProperty(w2, "geometry", rect2); result->assignProperty(w3, "geometry", rect3); result->assignProperty(w4, "geometry", rect4); -- cgit v0.12