Skip to content

Commit

Permalink
Port Windows Tests to common suite (#9413)
Browse files Browse the repository at this point in the history
* Start moving Windows tests over to common suite to try against android/ios

* Fix typo in log message about maximum keys. Fix up string concat formatting in the area.

* Properly override apiName for Ti.App.iOS.SearchQuery

* Fix analytics test

* Limit Ti.Network.Socket.UDP tests to Windows, as right now it is a Windows-only API.

* clean up eslint issues in tcp test

* Remove android/runtime/v8/libs folder

* Fix up more tests

* Port more tests over

* Fix up tests, add translation strings

* Use underscores, not spaces for i18n key names to make Android happy

* Port Ti.UI.Label test

* Fix Ti.Blob.size in pixels test

* Set locale back to en-US after locale tests, explicitly do an if/else with a FIXME on a parity issue between Android and other platforms for return value of Ti.Locale.getString for a missing key

* Use format string to swap order of args to phrase i18n key

* Tweak Ti.Media tests a little, generate tests in loop for constants

* Fix up Ti.Media constant tests to not be run in loop which mysteriously makes them fail

* Don't test blob for size property on Android

* Mark String.format() test as broken on iOS - seems to ignore position

* Mark most tests broken on iOS and Android since we can't rely on the load event like on Windows

* Add filter for marking all platforms broken

* Skip test broken on iOS

* try to fix test broken on iOS

* Test for undefined _or_ null blob.text value for image blob. iOS returns undefined, contrary to docs which say null.

* Add contacts and geolocation tests cleaned up. Add filter for tests broken on Windows Emulator

* Mark blob constructed from image test as broken on iOS. Too many issues there.

* Port more tests over

* Port more tests. skip a couple on iOS

* Update tests
  • Loading branch information
sgtcoolguy committed Sep 12, 2017
1 parent a7e2ecf commit a2b1d72
Show file tree
Hide file tree
Showing 44 changed files with 9,059 additions and 10 deletions.
Expand Up @@ -100,7 +100,7 @@ public int featureEvent(String event, @Kroll.argument(optional = true) KrollDict
analytics.sendAppFeatureEvent(event, jsonData);
return SUCCESS;
} else {
Log.e(TAG, "Feature event "+ event +" not conforming to recommended usage.");
Log.e(TAG, "Feature event " + event + " not conforming to recommended usage.");
return JSON_VALIDATION_FAILED;
}
} else if (data != null) {
Expand All @@ -110,7 +110,7 @@ public int featureEvent(String event, @Kroll.argument(optional = true) KrollDict
analytics.sendAppFeatureEvent(event, jsonData);
return SUCCESS;
} else {
Log.e(TAG, "Feature event "+ event +" not conforming to recommended usage.");
Log.e(TAG, "Feature event " + event + " not conforming to recommended usage.");
return JSON_VALIDATION_FAILED;
}
} catch (JSONException e) {
Expand All @@ -130,18 +130,18 @@ public int featureEvent(String event, @Kroll.argument(optional = true) KrollDict
public static int validateJSON(JSONObject jsonObject, int level) {

if (level > MAX_LEVELS) {
Log.w(TAG, "Feature event cannot have more than "+ MAX_LEVELS + " nested JSONs");
Log.w(TAG, "Feature event cannot have more than " + MAX_LEVELS + " nested JSONs");
return JSON_VALIDATION_FAILED;
}
if (jsonObject == null) {
return JSON_VALIDATION_FAILED;
}
if ((level == 0) & (jsonObject.toString().getBytes().length > MAX_SERLENGTH)) {
Log.w(TAG, "Feature event cannot exceed more than "+ MAX_SERLENGTH + " total serialized bytes");
Log.w(TAG, "Feature event cannot exceed more than " + MAX_SERLENGTH + " total serialized bytes");
return JSON_VALIDATION_FAILED;
}
if (jsonObject.length() > MAX_KEYS) {
Log.w(TAG, "Feature event maxium keys should not exceed "+ MAX_KEYS);
Log.w(TAG, "Feature event maximum keys should not exceed " + MAX_KEYS);
return JSON_VALIDATION_FAILED;
}

Expand All @@ -150,7 +150,7 @@ public static int validateJSON(JSONObject jsonObject, int level) {
while(keys.hasNext()) {
String key = (String)keys.next();
if (key.length() > MAX_KEYLENGTH) {
Log.w(TAG, "Feature event key "+key+" length should not exceed "+MAX_KEYLENGTH+" characters");
Log.w(TAG, "Feature event key " + key + " length should not exceed " + MAX_KEYLENGTH + " characters");
return JSON_VALIDATION_FAILED;
}
try {
Expand Down
2 changes: 0 additions & 2 deletions android/runtime/v8/libs/armeabi-v7a/gdb.setup

This file was deleted.

Binary file removed android/runtime/v8/libs/armeabi-v7a/gdbserver
Binary file not shown.
Binary file not shown.
Binary file removed android/runtime/v8/libs/armeabi-v7a/libkroll-v8.so
Binary file not shown.
2 changes: 0 additions & 2 deletions android/runtime/v8/libs/x86/gdb.setup

This file was deleted.

Binary file removed android/runtime/v8/libs/x86/gdbserver
Binary file not shown.
Binary file removed android/runtime/v8/libs/x86/libc++_shared.so
Binary file not shown.
Binary file removed android/runtime/v8/libs/x86/libkroll-v8.so
Binary file not shown.
5 changes: 5 additions & 0 deletions iphone/Classes/TiAppiOSSearchQueryProxy.m
Expand Up @@ -21,6 +21,11 @@ - (void)dealloc
[super dealloc];
}

- (NSString *)apiName
{
return @"Ti.App.iOS.SearchQuery";
}

- (id)_initWithPageContext:(id<TiEvaluator>)context andArguments:(NSDictionary *)args
{
ENSURE_TYPE([args objectForKey:@"queryString"], NSString);
Expand Down
315 changes: 315 additions & 0 deletions tests/Resources/analytics/featureEventPayload.json
@@ -0,0 +1,315 @@
{
"largeInvalid": {
"a": {
"k1": {
"k": "v"
},
"k2": {
"k": "v"
},
"k3": {
"k": "v"
},
"k4": {
"k": "v"
},
"k5": {
"k": "v"
},
"k6": [
{"a":1}, {"b":2}, {"c": 3},
{"d":4}, {"e":5}, {"f": 6}
]
},

"b": {
"k1": {
"k": "v"
},
"k2": {
"k": "v"
},
"k3": {
"k": "v"
},
"k4": {
"k": "v"
},
"k5": {
"k": "v"
},
"k6": [
{"a":1}, {"b":2}, {"c": 3},
{"d":4}, {"e":5}, {"f": 6}
]
},

"c": {
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossSee": "markup"
}
}
}
}
},

"d": {
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossSee": "markup"
}
}
}
}
},

"f": {
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossSee": "markup"
}
}
}
}
},

"g": {
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossSee": "markup"
}
}
}
}
},

"h": {
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossSee": "markup"
}
}
}
}
},

"i": {
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossSee": "markup"
}
}
}
}
},

"j": {
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossSee": "markup"
}
}
}
}
},

"k": {
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossSee": "markup"
}
}
}
}
}
},
"complexInvalid": {
"foo": true,
"bar": {
"k1": {
"k": "v"
},
"k2": {
"k": "v"
},
"k3": {
"k": "v"
},
"k4": {
"k": "v"
},
"k5": {
"k": "v"
},
"k6": [
{"a":1}, {"b":2}, {"c": 3},
{"d":4}, {"e":5}, {"f": {"k1":{"k2":{"k3": [{"k4": {"k5": "v"}}] }}}}
]
}
},
"complexValid": {
"foo": true,
"bar": {
"k1": {
"k": "v"
},
"k2": {
"k": "v"
},
"k3": {
"k": "v"
},
"k4": {
"k": "v"
},
"k5": {
"k": "v"
},
"k6": [
{"a":1}, {"b":2}, {"c": 3},
{"d":4}, {"e":5}, {"f": 6}
]
}
},
"maxKeysInvalid": {
"key": [{
"_id": "569",
"index": 0,
"guid": "c55",
"isActive": true,
"balance": "na",
"picture": "na",
"age": 23,
"eye": "blue",
"name_first": "na",
"name_last": "na",
"company": "na",
"email": "na",
"phone": "+na",
"address": "na",
"about": "na",
"reg": "na",
"lat": "na",
"lon": "na",
"tags": "na",
"range": 0,
"friends": 0,
"greeting": "H",
"fruit": "na",
"twitter": "na",
"fb": "na",
"linkedin": "na",
"github": "na",
"seconlife": "na",
"sof": "na",
"machine": "mac",
"phone": "iphone",
"telco": "na",
"balance": 0,
"blog": "na",
"married" : true,
"sons" : 0,
"daughters": 1,
"spouse": "na",
"homecity":"na",
"car": "na",
"txno": "na",
"serno": "na",
"created_date" : "1998/12/15",
"created_time" : "17:54:44",
"eliminado": false,
"leido": false,
"contenidoPublico": false,
"idContenido": 2,
"link1": "na",
"link2": "na",
"link3": "na",
"link4": "na",
"link5": "na",
"link6": "na",
"link7": "na",
"link8": "na",
"link9": "na",
"link2": "na",
"link3": "na",
"link4": "na",
"link5": "na",
"link6": "na",
"link7": "na",
"link8": "na"
}]
}
}

0 comments on commit a2b1d72

Please sign in to comment.