@@ -1169,7 +1169,20 @@ test_api(pappl_system_t *system) // I - System
1169
1169
size_t get_size , // Size for "get" call
1170
1170
set_size ; // Size for ", set" call
1171
1171
pappl_printer_t * printer ; // Current printer
1172
+ pappl_loc_t * loc ; // Current localization
1172
1173
_pappl_testprinter_t pdata ; // Printer test data
1174
+ const char * key = "A printer with that name already exists." ,
1175
+ // Key string
1176
+ * text ; // Localized text
1177
+ static const char * const languages [] =
1178
+ {
1179
+ "de" ,
1180
+ "en" ,
1181
+ "es" ,
1182
+ "fr" ,
1183
+ "it" ,
1184
+ "ja"
1185
+ };
1173
1186
static const char * const set_locations [10 ][2 ] =
1174
1187
{
1175
1188
// Some wonders of the ancient world (all north-eastern portion of globe...)
@@ -1197,6 +1210,54 @@ test_api(pappl_system_t *system) // I - System
1197
1210
};
1198
1211
1199
1212
1213
+ for (i = 0 ; i < (int )(sizeof (languages ) / sizeof (languages [0 ])); i ++ )
1214
+ {
1215
+ // papplSystemFindLoc
1216
+ testBegin ("api: papplSystemFindLoc('%s')" , languages [i ]);
1217
+ if ((loc = papplSystemFindLoc (system , languages [i ])) == NULL )
1218
+ {
1219
+ testEnd (false);
1220
+ pass = false;
1221
+ }
1222
+ else
1223
+ testEnd (true);
1224
+
1225
+ // papplLocGetString
1226
+ testBegin ("api: papplLocGetString('%s')" , key );
1227
+ if ((text = papplLocGetString (loc , key )) == NULL || text == key )
1228
+ {
1229
+ testEndMessage (false, "got %p" , text );
1230
+ pass = false;
1231
+ }
1232
+ else if (!strcmp (key , text ) && strcmp (languages [i ], "en" ))
1233
+ {
1234
+ testEndMessage (false, "not localized" );
1235
+ pass = false;
1236
+ }
1237
+ else
1238
+ testEndMessage (true, "got '%s'" , text );
1239
+ }
1240
+
1241
+ // papplSystemFindLoc
1242
+ testBegin ("api: papplSystemFindLoc('zz')" );
1243
+ if ((loc = papplSystemFindLoc (system , "zz" )) != NULL )
1244
+ {
1245
+ testEndMessage (false, "got %p" );
1246
+ pass = false;
1247
+ }
1248
+ else
1249
+ testEndMessage (true, "got NULL" );
1250
+
1251
+ // papplLocGetString
1252
+ testBegin ("api: papplLocGetString('%s')" , key );
1253
+ if ((text = papplLocGetString (loc , key )) != key )
1254
+ {
1255
+ testEndMessage (false, "got %p" , text );
1256
+ pass = false;
1257
+ }
1258
+ else
1259
+ testEndMessage (true, "got key string" );
1260
+
1200
1261
// papplSystemGet/SetAdminGroup
1201
1262
testBegin ("api: papplSystemGetAdminGroup" );
1202
1263
if (papplSystemGetAdminGroup (system , get_str , sizeof (get_str )))
0 commit comments