@@ -563,6 +563,80 @@ var mytests = function() {
563
563
} ) ;
564
564
} , MYTIMEOUT ) ;
565
565
566
+ it ( suiteName + "INLINE UNICODE \\u2013 test" , function ( done ) {
567
+ var db = openDatabase ( "String-u2013-test.db" , "1.0" , "Demo" , DEFAULT_SIZE ) ;
568
+ expect ( db ) . toBeDefined ( ) ;
569
+
570
+ db . transaction ( function ( tx ) {
571
+ expect ( tx ) . toBeDefined ( ) ;
572
+
573
+ tx . executeSql ( "SELECT UPPER('First\u2013Second') AS uppertext" , [ ] , function ( tx_ignored , rs1 ) {
574
+ // Check INLINE string result:
575
+ expect ( rs1 ) . toBeDefined ( ) ;
576
+ expect ( rs1 . rows ) . toBeDefined ( ) ;
577
+ expect ( rs1 . rows . length ) . toBe ( 1 ) ;
578
+ expect ( rs1 . rows . item ( 0 ) . uppertext ) . toBe ( 'FIRST\u2013SECOND' ) ;
579
+
580
+ // Check value binding & HEX result:
581
+ tx . executeSql ( "SELECT HEX('1\u2013') AS myResult" , null , function ( tx_ignored , rs2 ) {
582
+ expect ( rs2 ) . toBeDefined ( ) ;
583
+ expect ( rs2 . rows ) . toBeDefined ( ) ;
584
+ expect ( rs2 . rows . length ) . toBe ( 1 ) ;
585
+ if ( isWindows )
586
+ expect ( rs2 . rows . item ( 0 ) . myResult ) . toBe ( '410008003100' ) ; // (UTF-16le)
587
+ else
588
+ expect ( rs2 . rows . item ( 0 ) . myResult ) . toBe ( '31E28093' ) ;
589
+
590
+ // Close (plugin only) & finish:
591
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
592
+ } ) ;
593
+ } ) ;
594
+ } , function ( error ) {
595
+ // NOT EXPECTED:
596
+ expect ( false ) . toBe ( true ) ;
597
+ expect ( error . message ) . toBe ( '--' ) ;
598
+ // Close (plugin only) & finish:
599
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
600
+ } ) ;
601
+ } , MYTIMEOUT ) ;
602
+
603
+ it ( suiteName + "INLINE UNICODE \\u2019 test" , function ( done ) {
604
+ var db = openDatabase ( "String-u2019-test.db" , "1.0" , "Demo" , DEFAULT_SIZE ) ;
605
+ expect ( db ) . toBeDefined ( ) ;
606
+
607
+ db . transaction ( function ( tx ) {
608
+ expect ( tx ) . toBeDefined ( ) ;
609
+
610
+ tx . executeSql ( "SELECT UPPER('First\u2019Second') AS uppertext" , [ ] , function ( tx_ignored , rs1 ) {
611
+ // Check INLINE string result:
612
+ expect ( rs1 ) . toBeDefined ( ) ;
613
+ expect ( rs1 . rows ) . toBeDefined ( ) ;
614
+ expect ( rs1 . rows . length ) . toBe ( 1 ) ;
615
+ expect ( rs1 . rows . item ( 0 ) . uppertext ) . toBe ( 'FIRST\u2019SECOND' ) ;
616
+
617
+ // Check value binding & HEX result:
618
+ tx . executeSql ( "SELECT HEX('1\u2019') AS myResult" , null , function ( tx_ignored , rs2 ) {
619
+ expect ( rs2 ) . toBeDefined ( ) ;
620
+ expect ( rs2 . rows ) . toBeDefined ( ) ;
621
+ expect ( rs2 . rows . length ) . toBe ( 1 ) ;
622
+ if ( isWindows )
623
+ expect ( rs2 . rows . item ( 0 ) . myResult ) . toBe ( '410008003100' ) ; // (UTF-16le)
624
+ else
625
+ expect ( rs2 . rows . item ( 0 ) . myResult ) . toBe ( '31E28099' ) ;
626
+
627
+ // Close (plugin only) & finish:
628
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
629
+ } ) ;
630
+ } ) ;
631
+ } , function ( error ) {
632
+ // NOT EXPECTED:
633
+ expect ( false ) . toBe ( true ) ;
634
+ expect ( error . message ) . toBe ( '--' ) ;
635
+ // Close (plugin only) & finish:
636
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
637
+ } ) ;
638
+ } , MYTIMEOUT ) ;
639
+
566
640
} ) ;
567
641
568
642
describe ( suiteName + 'UTF-8 multiple octet character string binding/manipulation tests [default sqlite encoding: UTF-16le on Windows, UTF-8 encoding on others]' , function ( ) {
@@ -901,6 +975,190 @@ var mytests = function() {
901
975
} ) ;
902
976
} , MYTIMEOUT ) ;
903
977
978
+ // NOTE: the next 3 tests repeat the above for UNICODE \u2029 paragraph separator
979
+ // on iOS/macOS/Android:
980
+ // XXX XXX
981
+
982
+ it ( suiteName + "UNICODE \\u2013 xxx string length" , function ( done ) {
983
+ if ( isWP8 ) pending ( 'BROKEN on WP(8)' ) ; // [BUG #202] Certain UNICODE characters not working with WP(8)
984
+
985
+ // NOTE: this test verifies that the UNICODE xxx (\u2013)
986
+ // is seen by the sqlite implementation OK:
987
+ var db = openDatabase ( "UNICODE-paragraph-separator-string-length.db" , "1.0" , "Demo" , DEFAULT_SIZE ) ;
988
+
989
+ expect ( db ) . toBeDefined ( ) ;
990
+
991
+ db . transaction ( function ( tx ) {
992
+ expect ( tx ) . toBeDefined ( ) ;
993
+
994
+ var text = 'Abcd\u20191234' ;
995
+ tx . executeSql ( "select length(?) AS stringlength" , [ 'First\u2013Second' ] , function ( tx_ignored , rs ) {
996
+ expect ( rs . rows . item ( 0 ) . stringlength ) . toBe ( 12 ) ;
997
+
998
+ // Close (plugin only) & finish:
999
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1000
+ } ) ;
1001
+ } , function ( error ) {
1002
+ // NOT EXPECTED:
1003
+ expect ( false ) . toBe ( true ) ;
1004
+ expect ( error . message ) . toBe ( '--' ) ;
1005
+ // Close (plugin only) & finish:
1006
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1007
+ } ) ;
1008
+ } , MYTIMEOUT ) ;
1009
+
1010
+ it ( suiteName + 'HEX value of string with UNICODE \\u2013 xxx' , function ( done ) {
1011
+ // NOTE: this test verifies that the UNICODE xxx (\u2013)
1012
+ // is seen by the sqlite implementation OK:
1013
+ var db = openDatabase ( "UNICODE-u2013-hex-value-test.db" , "1.0" , "Demo" , DEFAULT_SIZE ) ;
1014
+
1015
+ expect ( db ) . toBeDefined ( ) ;
1016
+
1017
+ db . transaction ( function ( tx ) {
1018
+ expect ( tx ) . toBeDefined ( ) ;
1019
+
1020
+ tx . executeSql ( 'SELECT HEX(?) AS myresult' , [ '1\u2013' ] , function ( tx_ignored , rs ) {
1021
+ if ( isWindows )
1022
+ expect ( rs . rows . item ( 0 ) . myresult ) . toBe ( '31002920' ) ; // (UTF-16le)
1023
+ else
1024
+ expect ( rs . rows . item ( 0 ) . myresult ) . toBe ( '31E28093' ) ; // (UTF-8)
1025
+
1026
+ // Close (plugin only) & finish:
1027
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1028
+ } ) ;
1029
+ } , function ( error ) {
1030
+ // NOT EXPECTED:
1031
+ expect ( false ) . toBe ( true ) ;
1032
+ expect ( error . message ) . toBe ( '--' ) ;
1033
+ // Close (plugin only) & finish:
1034
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1035
+ } ) ;
1036
+ } , MYTIMEOUT ) ;
1037
+
1038
+ it ( suiteName + ' handles UNICODE \\u2013 xxx correctly [string test]' , function ( done ) {
1039
+ if ( isWP8 ) pending ( 'BROKEN on WP(8)' ) ; // [BUG #202] UNICODE characters not working with WP(8)
1040
+ //if (!isWebSql && !isWindows && isAndroid) pending('SKIP for Android plugin (cordova-android 6.x BUG: cordova/cordova-discuss#57)');
1041
+ //if (!isWebSql && !isWindows && !isAndroid && !isWP8) pending('SKIP for iOS/macOS plugin (Cordova BUG: CB-9435)');
1042
+
1043
+ // NOTE: since the above test shows the UNICODE xxx (\u2013)
1044
+ // is seen by the sqlite implementation OK, it is now concluded that
1045
+ // the failure is caused by the native JSON result encoding.
1046
+ var db = openDatabase ( "UNICODE-paragraph-separator-string-lowertext.db" , "1.0" , "Demo" , DEFAULT_SIZE ) ;
1047
+
1048
+ expect ( db ) . toBeDefined ( ) ;
1049
+
1050
+ db . transaction ( function ( tx ) {
1051
+ expect ( tx ) . toBeDefined ( ) ;
1052
+
1053
+ tx . executeSql ( "SELECT LOWER(?) AS lowertext" , [ 'First\u2013Second' ] , function ( tx_ignored , rs ) {
1054
+ expect ( rs ) . toBeDefined ( ) ;
1055
+ expect ( rs . rows . item ( 0 ) . lowertext ) . toBe ( "first\u2013second" ) ;
1056
+
1057
+ // Close (plugin only) & finish:
1058
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1059
+ } ) ;
1060
+ } , function ( error ) {
1061
+ // NOT EXPECTED:
1062
+ expect ( false ) . toBe ( true ) ;
1063
+ expect ( error . message ) . toBe ( '--' ) ;
1064
+ // Close (plugin only) & finish:
1065
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1066
+ } ) ;
1067
+ } , MYTIMEOUT ) ;
1068
+
1069
+ // NOTE: the next 3 tests show that for iOS/macOS/Android:
1070
+ // XXX XXX
1071
+
1072
+ it ( suiteName + "UNICODE \\u2019 xxx string length" , function ( done ) {
1073
+ if ( isWP8 ) pending ( 'BROKEN on WP(8)' ) ; // [BUG #202] Certain UNICODE characters not working with WP(8)
1074
+
1075
+ // NOTE: this test verifies that the UNICODE xxx (\u2019)
1076
+ // is seen by the sqlite implementation OK:
1077
+ var db = openDatabase ( "UNICODE-line-separator-string-length.db" , "1.0" , "Demo" , DEFAULT_SIZE ) ;
1078
+
1079
+ expect ( db ) . toBeDefined ( ) ;
1080
+
1081
+ db . transaction ( function ( tx ) {
1082
+ expect ( tx ) . toBeDefined ( ) ;
1083
+
1084
+ tx . executeSql ( "select length(?) AS stringlength" , [ 'First\u2019Second' ] , function ( tx_ignored , rs ) {
1085
+ expect ( rs ) . toBeDefined ( ) ;
1086
+ expect ( rs . rows ) . toBeDefined ( ) ;
1087
+ expect ( rs . rows . length ) . toBe ( 1 ) ;
1088
+ expect ( rs . rows . item ( 0 ) . stringlength ) . toBe ( 12 ) ;
1089
+
1090
+ // Close (plugin only) & finish:
1091
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1092
+ } ) ;
1093
+ } , function ( error ) {
1094
+ // NOT EXPECTED:
1095
+ expect ( false ) . toBe ( true ) ;
1096
+ expect ( error . message ) . toBe ( '--' ) ;
1097
+ // Close (plugin only) & finish:
1098
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1099
+ } ) ;
1100
+ } , MYTIMEOUT ) ;
1101
+
1102
+ it ( suiteName + 'HEX value of string with UNICODE \\u2019 xxx' , function ( done ) {
1103
+ // NOTE: this test verifies that the UNICODE xxx (\u2019)
1104
+ // is seen by the sqlite implementation OK:
1105
+ var db = openDatabase ( "UNICODE-line-separator-hex-value-test.db" , "1.0" , "Demo" , DEFAULT_SIZE ) ;
1106
+
1107
+ expect ( db ) . toBeDefined ( ) ;
1108
+
1109
+ db . transaction ( function ( tx ) {
1110
+ expect ( tx ) . toBeDefined ( ) ;
1111
+
1112
+ tx . executeSql ( 'SELECT HEX(?) AS myresult' , [ '1\u2019' ] , function ( tx_ignored , rs ) {
1113
+ if ( isWindows )
1114
+ expect ( rs . rows . item ( 0 ) . myresult ) . toBe ( '31002820' ) ; // (UTF-16le)
1115
+ else
1116
+ expect ( rs . rows . item ( 0 ) . myresult ) . toBe ( '31E28099' ) ; // (UTF-8)
1117
+
1118
+ // Close (plugin only) & finish:
1119
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1120
+ } ) ;
1121
+ } , function ( error ) {
1122
+ // NOT EXPECTED:
1123
+ expect ( false ) . toBe ( true ) ;
1124
+ expect ( error . message ) . toBe ( '--' ) ;
1125
+ // Close (plugin only) & finish:
1126
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1127
+ } ) ;
1128
+ } , MYTIMEOUT ) ;
1129
+
1130
+ it ( suiteName + ' handles UNICODE \\u2019 xxx correctly [string test]' , function ( done ) {
1131
+ if ( isWP8 ) pending ( 'BROKEN on WP(8)' ) ; // [BUG #202] UNICODE characters not working with WP(8)
1132
+ //if (!isWebSql && !isWindows && isAndroid) pending('SKIP for Android plugin (cordova-android 6.x BUG: cordova/cordova-discuss#57)');
1133
+ //if (!isWebSql && !isWindows && !isAndroid && !isWP8) pending('SKIP for iOS/macOS plugin (Cordova BUG: CB-9435)');
1134
+ //if (isWebSql && !isWindows && isAndroid) pending('SKIP for Android Web SQL'); // TBD SKIP for Android Web for now
1135
+
1136
+ // NOTE: since the above test shows the UNICODE xxx (\u2019)
1137
+ // is seen by the sqlite implementation OK, it is now concluded that
1138
+ // the failure is caused by the native JSON result encoding.
1139
+ var db = openDatabase ( "UNICODE-line-separator-string-lowertext.db" , "1.0" , "Demo" , DEFAULT_SIZE ) ;
1140
+
1141
+ expect ( db ) . toBeDefined ( ) ;
1142
+
1143
+ db . transaction ( function ( tx ) {
1144
+ expect ( tx ) . toBeDefined ( ) ;
1145
+
1146
+ tx . executeSql ( "SELECT LOWER(?) AS lowertext" , [ 'First\u2019Second' ] , function ( tx_ignored , rs ) {
1147
+ expect ( rs ) . toBeDefined ( ) ;
1148
+ expect ( rs . rows . item ( 0 ) . lowertext ) . toBe ( "first\u2019second" ) ;
1149
+
1150
+ // Close (plugin only) & finish:
1151
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1152
+ } ) ;
1153
+ } , function ( error ) {
1154
+ // NOT EXPECTED:
1155
+ expect ( false ) . toBe ( true ) ;
1156
+ expect ( error . message ) . toBe ( '--' ) ;
1157
+ // Close (plugin only) & finish:
1158
+ ( isWebSql ) ? done ( ) : db . close ( done , done ) ;
1159
+ } ) ;
1160
+ } , MYTIMEOUT ) ;
1161
+
904
1162
// NOTE: the next 3 tests repeat the above for UNICODE \u2029 paragraph separator
905
1163
// on iOS/macOS/Android:
906
1164
// - UNICODE \u2029 paragraph separator from JavaScript to native (Objective-C/Java) is working OK
0 commit comments