on xenial help sign in
Last test
commit56c732a3a173aae2d237b5b0bbaa86ee4b2438eb authorAndrea Cimitan <andrea.cimitan@gmail.com> dateMon 8 Aug 2016, 17:29 (10 years ago) parent91abc2c
3 files changed+15−5
qml/Components/flickableUtils.js+3 tests/imports/check_imports.py+11−5 tests/qmltests/Dash/Previews/tst_PreviewRatingDisplayCreationRanges.qml+1
qml/Components/flickableUtils.js+3
@@ -16,6 +16,9 @@
1616
1717.pragma library
1818
19+/* TODO the "8" is is DEFAULT_GRID_UNIT_PX, we use it to normalize the values with the current grid unit size.
20+ Add a way to fetch this default grid unit px value from UITK. */
21+
1922function getFlickDeceleration(gridUnit) {
2023 return 1500 * gridUnit / 8;
2124}
tests/imports/check_imports.py+11−5
@@ -82,13 +82,16 @@ def scan_for_bad_import(file_path, all_pat, good_pats):
8282 return bool(errors)
8383
8484# Flickable matches
85−flickable_pat = re.compile(r'.*\ Flickable {')
86−listview_pat = re.compile(r'.*\ ListView {')
87−gridview_pat = re.compile(r'.*\ GridView {')
85+flickable_pat = re.compile(r'.*\s*Flickable\s*{')
86+listview_pat = re.compile(r'.*\s*ListView\s*{')
87+gridview_pat = re.compile(r'.*\s*GridView\s*{')
8888flickable_pats = [flickable_pat, listview_pat, gridview_pat]
8989unity_components_pat = re.compile(r'.*import ".*Components"')
9090components_import_pat = re.compile(r'.*import "."')
9191components_path = re.compile(r'.*qml/Components.*')
92+skip_components_flickable_path = re.compile(r'.*qml/Components/Flickable.qml')
93+skip_components_listview_path = re.compile(r'.*qml/Components/ListView.qml')
94+skip_components_gridview_path = re.compile(r'.*qml/Components/GridView.qml')
9295
9396def scan_for_flickable_imports(file_path, component_pats, qtquick_pat, unitycomponents_pat):
9497 errors = []
@@ -163,8 +166,11 @@ try:
163166 if scan_for_flickable_imports(path, flickable_pats, quick_good_pat, unity_components_pat):
164167 found_bad_import = True
165168 else:
166− if scan_for_flickable_imports(path, flickable_pats, quick_good_pat, components_import_pat):
167− found_bad_import = True
169+ if not skip_components_flickable_path.match(path) and \
170+ not skip_components_listview_path.match(path) and \
171+ not skip_components_gridview_path.match(path):
172+ if scan_for_flickable_imports(path, flickable_pats, quick_good_pat, components_import_pat):
173+ found_bad_import = True
168174
169175except OSError as e:
170176 error("cannot create file list for \"" + dir + "\": " + e.strerror)
tests/qmltests/Dash/Previews/tst_PreviewRatingDisplayCreationRanges.qml+1
@@ -18,6 +18,7 @@ import QtQuick 2.4
1818import QtTest 1.0
1919import Ubuntu.Components 1.3
2020import "../../../../qml/Dash/Previews"
21+import "../../../../qml/Components"
2122import Unity.Test 0.1 as UT
2223
2324Flickable {