Skip to content

Commit 98deecc

Browse files
author
Hristo Hristov
authored
Change image.android to use the new image.Cache class from widgets. (NativeScript#2832)
* Change image.android to use the new image.Cahce class from widgets. * fix npm scripts * npm tsc will compile all so no need for npm run dev-tsc-tests * fix tslint error * image-tests use memory only cache. * fix exception in image.android * Change image-tests so that Image won't be GC immediately. * Change cacheMode to enum
1 parent 3b99ed3 commit 98deecc

File tree

14 files changed

+336
-206
lines changed

14 files changed

+336
-206
lines changed

.vscode/launch.json

Lines changed: 68 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,70 @@
11
{
2-
"version": "0.2.0",
3-
"configurations": [
4-
{
5-
"name": "Launch on iOS Device",
6-
"type": "nativescript",
7-
"platform": "ios",
8-
"request": "launch",
9-
"appRoot": "${workspaceRoot}/tests",
10-
"sourceMaps": true,
11-
"diagnosticLogging": false,
12-
"emulator": false
13-
},
14-
{
15-
"name": "Attach on iOS Device",
16-
"type": "nativescript",
17-
"platform": "ios",
18-
"request": "attach",
19-
"appRoot": "${workspaceRoot}/tests",
20-
"sourceMaps": true,
21-
"diagnosticLogging": false,
22-
"emulator": false
23-
},
24-
{
25-
"name": "Launch on iOS Emulator",
26-
"type": "nativescript",
27-
"platform": "ios",
28-
"request": "launch",
29-
"appRoot": "${workspaceRoot}/tests",
30-
"sourceMaps": true,
31-
"diagnosticLogging": false,
32-
"emulator": true
33-
},
34-
{
35-
"name": "Attach on iOS Emulator",
36-
"type": "nativescript",
37-
"platform": "ios",
38-
"request": "attach",
39-
"appRoot": "${workspaceRoot}/tests",
40-
"sourceMaps": true,
41-
"diagnosticLogging": false,
42-
"emulator": true
43-
},
44-
{
45-
"name": "Launch on Android Device",
46-
"type": "nativescript",
47-
"platform": "android",
48-
"request": "launch",
49-
"appRoot": "${workspaceRoot}/tests",
50-
"sourceMaps": true,
51-
"diagnosticLogging": false,
52-
"emulator": false
53-
},
54-
{
55-
"name": "Launch on Android Emulator",
56-
"type": "nativescript",
57-
"platform": "android",
58-
"request": "launch",
59-
"appRoot": "${workspaceRoot}/tests",
60-
"sourceMaps": true,
61-
"diagnosticLogging": false,
62-
"emulator": true
63-
},
64-
{
65-
"name": "Attach on Android Device",
66-
"type": "nativescript",
67-
"platform": "android",
68-
"request": "attach",
69-
"appRoot": "${workspaceRoot}/tests",
70-
"sourceMaps": true,
71-
"diagnosticLogging": false,
72-
"emulator": false
73-
},
74-
{
75-
"name": "Attach on Android Emulator",
76-
"type": "nativescript",
77-
"platform": "android",
78-
"request": "attach",
79-
"appRoot": "${workspaceRoot}/tests",
80-
"sourceMaps": true,
81-
"diagnosticLogging": false,
82-
"emulator": true
83-
}
84-
]
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Sync on iOS",
6+
"type": "nativescript",
7+
"platform": "ios",
8+
"request": "launch",
9+
"appRoot": "${workspaceRoot}",
10+
"sourceMaps": true,
11+
"diagnosticLogging": false,
12+
"emulator": false,
13+
"rebuild": false,
14+
"syncAllFiles": false
15+
},
16+
{
17+
"name": "Launch on iOS",
18+
"type": "nativescript",
19+
"platform": "ios",
20+
"request": "launch",
21+
"appRoot": "${workspaceRoot}",
22+
"sourceMaps": true,
23+
"diagnosticLogging": false,
24+
"emulator": false,
25+
"rebuild": true
26+
},
27+
{
28+
"name": "Attach on iOS",
29+
"type": "nativescript",
30+
"platform": "ios",
31+
"request": "attach",
32+
"appRoot": "${workspaceRoot}",
33+
"sourceMaps": true,
34+
"diagnosticLogging": false,
35+
"emulator": false
36+
},
37+
{
38+
"name": "Sync on Android",
39+
"type": "nativescript",
40+
"platform": "android",
41+
"request": "launch",
42+
"appRoot": "${workspaceRoot}",
43+
"sourceMaps": true,
44+
"diagnosticLogging": false,
45+
"emulator": false,
46+
"rebuild": false
47+
},
48+
{
49+
"name": "Launch on Android",
50+
"type": "nativescript",
51+
"platform": "android",
52+
"request": "launch",
53+
"appRoot": "${workspaceRoot}",
54+
"sourceMaps": true,
55+
"diagnosticLogging": false,
56+
"emulator": false,
57+
"rebuild": true
58+
},
59+
{
60+
"name": "Attach on Android",
61+
"type": "nativescript",
62+
"platform": "android",
63+
"request": "attach",
64+
"appRoot": "${workspaceRoot}",
65+
"sourceMaps": true,
66+
"diagnosticLogging": false,
67+
"emulator": false
68+
}
69+
]
8570
}

apps/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"tns-core-modules": "2.1.0"
1717
},
1818
"devDependencies": {
19+
"tns-platform-declarations": "*",
1920
"babel-traverse": "6.10.4",
2021
"babel-types": "6.11.1",
2122
"babylon": "6.8.3",

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,16 @@
3636
"tsc": "tsc",
3737
"tsc-w": "tsc --skipLibCheck -w",
3838
"dev-tsc-tns-platform-declarations": "tsc -p tns-platform-declarations",
39-
"dev-tsc-tns-core-modules": "tsc -p tns-core-modules",
4039
"dev-tsc-tests": "tsc -p tests",
4140
"dev-tsc-apps": "tsc -p apps",
42-
"dev-tsc-all": "npm run dev-tsc-tns-platform-declarations && npm run dev-tsc-tns-core-modules && npm run dev-tsc-tests && npm run dev-tsc-apps",
41+
"dev-tsc-all": "npm run dev-tsc-tns-platform-declarations && npm run tsc && npm run dev-tsc-tests && npm run dev-tsc-apps",
4342
"dev-link-tns-platform-declarations": "cd tns-platform-declarations && npm link",
4443
"dev-link-tns-core-modules": "cd tns-core-modules && npm link",
4544
"dev-link-tests": "cd tests && npm link tns-platform-declarations && npm link tns-core-modules",
4645
"dev-link-apps": "cd apps && npm link tns-platform-declarations && npm link tns-core-modules",
4746
"dev-declarations": "npm run setup && rm -rf tns-platform-declarations/ios/objc* && TNS_TYPESCRIPT_DECLARATIONS_PATH=$PWD/tns-platform-declarations/ios/objc tns build ios --path tests",
4847
"test": "npm run test-android && npm run test-ios",
49-
"pretest": "npm run setup && npm run dev-tsc-tns-core-modules && npm run dev-tsc-tests",
48+
"pretest": "npm run setup && npm run tsc",
5049
"test-android": "tns run android --path tests --justlaunch",
5150
"test-ios": "tns run ios --path tests --justlaunch",
5251
"test-watch-android": "npm run pretest && concurrently --kill-others \"npm run tsc-tiw\" \"tns livesync android --path tests --watch\"",

tests/.vscode/tasks.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "0.1.0",
5+
"command": "tsc",
6+
"isShellCommand": true,
7+
"args": ["-p", "."],
8+
"showOutput": "silent",
9+
"problemMatcher": "$tsc"
10+
}

tests/app/TKUnit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,19 @@ export function assertNotEqual(actual: any, expected: any, message?: string) {
214214
}
215215
}
216216

217-
export function assertEqual(actual: any, expected: any, message?: string) {
217+
export function assertEqual<T extends { equals?(arg: T): boolean }>(actual: T, expected: T, message?: string) {
218218
if (!types.isNullOrUndefined(actual)
219219
&& !types.isNullOrUndefined(expected)
220220
&& types.getClass(actual) === types.getClass(expected)
221221
&& types.isFunction(actual.equals)) {
222222

223223
// Use the equals method
224224
if (!actual.equals(expected)) {
225-
throw new Error(`${message} Actual: <${actual}>(${typeof(actual)}). Expected: <${expected}>(${typeof(expected)})`);
225+
throw new Error(`${message} Actual: <${actual}>(${typeof (actual)}). Expected: <${expected}>(${typeof (expected)})`);
226226
}
227227
}
228228
else if (actual !== expected) {
229-
throw new Error(`${message} Actual: <${actual}>(${typeof(actual)}). Expected: <${expected}>(${typeof(expected)})`);
229+
throw new Error(`${message} Actual: <${actual}>(${typeof (actual)}). Expected: <${expected}>(${typeof (expected)})`);
230230
}
231231
};
232232

@@ -459,7 +459,7 @@ var doModalAndroid = function (quitLoop: () => boolean, timeoutSec: number) {
459459
} else {
460460
target.dispatchMessage(msg);
461461
}
462-
462+
463463
if (sdkVersion < 21) {//https://code.google.com/p/android-test-kit/issues/detail?id=84
464464
msg.recycle();
465465
}

tests/app/data/observable-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,11 @@ export function test_ObservableShouldEmitPropertyChangeWithSameObjectUsingWrappe
501501
export function test_CorrectEventArgsWhenWrappedValueIsUsed() {
502502
let testArray = [1];
503503
let testObservable = new observable.Observable({ "property1": testArray});
504-
let actualArgsValue = 0;
504+
let actualArgsValue;
505505
let propertyChangeHandler = function (args) {
506506
actualArgsValue = args.value;
507-
508507
}
508+
509509
testObservable.on(observable.Observable.propertyChangeEvent, propertyChangeHandler);
510510
testArray.push(2);
511511

0 commit comments

Comments
 (0)