2165 && param.iOutputGlyphs == 1 |
2165 && param.iOutputGlyphs == 1 |
2166 && param.iOutput[0].iCode == 44); |
2166 && param.iOutput[0].iCode == 44); |
2167 } |
2167 } |
2168 |
2168 |
2169 /** |
2169 /** |
|
2170 @SYMTestCaseID GRAPHICS-SYSLIB-GDI-CT-0221 |
|
2171 @SYMTestCaseDesc Test support for Vietnamese characters. |
|
2172 @SYMTestPriority High |
|
2173 @SYMTestActions Attempt to compose various valid and invalid Vietnamese glyph clusters. |
|
2174 @SYMTestExpectedResults The test must not fail. |
|
2175 @SYMPREQ 402: GDI for Bravo. |
|
2176 */ |
|
2177 void CTGlyphSelection::TestVietnameseChars() |
|
2178 { |
|
2179 /** |
|
2180 This method is a test case to test GetCharacterPosition() correctly |
|
2181 processes Vietnamese characters. |
|
2182 */ |
|
2183 TBool r; |
|
2184 TBuf<41> testText(0); |
|
2185 CFont::TPositionParam param; |
|
2186 param.iDirection = CFont::EHorizontal; |
|
2187 param.iFlags = CFont::TPositionParam::EFLogicalOrder; |
|
2188 |
|
2189 testText.SetLength(41); |
|
2190 |
|
2191 testText[0] = 0x0055; // capital U |
|
2192 testText[1] = 0x031B; // combining horn - expect 0x01AF (succeed) |
|
2193 |
|
2194 testText[2] = 0x0055; // capital U |
|
2195 testText[3] = 0x0027; // apostrophe - expect 0x0055 (fail) |
|
2196 |
|
2197 testText[4] = 0x0055; // capital U |
|
2198 testText[5] = 0x02B9; // modifier prime - expect 0x0055 (fail) |
|
2199 |
|
2200 testText[6] = 0x0055; // capital U |
|
2201 testText[7] = 0x02BC; // modifier apostrophe - expect 0x0055 (fail) |
|
2202 |
|
2203 testText[8] = 0x0055; // capital U |
|
2204 testText[9] = 0x0315; // combining comma above right - expect 0x0055, 0x0315 (fail) |
|
2205 |
|
2206 testText[10] = 0x0055; // capital U |
|
2207 testText[11] = 0x2019; // right single quote mark - expect 0x0055 (fail) |
|
2208 |
|
2209 testText[12] = 0x01AF; // capital U with horn |
|
2210 testText[13] = 0x0020; // space - expect 0x01AF (succeed) |
|
2211 |
|
2212 testText[14] = 0x0045; // capital E |
|
2213 testText[15] = 0x031B; // combining horn - expect 0x0045, 0x031B (fail) |
|
2214 |
|
2215 testText[16] = 0x0041; // capital A |
|
2216 testText[17] = 0x0306; // combining breve |
|
2217 testText[18] = 0x0301; // combining acute - expect 0x1EAE (succeed) |
|
2218 |
|
2219 testText[19] = 0x0102; // capital A with breve |
|
2220 testText[20] = 0x0301; // combining acute - expect 0x1EAE (succeed) |
|
2221 |
|
2222 testText[21] = 0x0041; // capital A |
|
2223 testText[22] = 0x0301; // combining acute |
|
2224 testText[23] = 0x0306; // combining breve - expect 0x0041, 0x0301, 0x0306 (fail) |
|
2225 |
|
2226 testText[24] = 0x0041; // capital A |
|
2227 testText[25] = 0x0323; // combining dot below |
|
2228 testText[26] = 0x0306; // combining breve - expect 0x1EB6 (succeed) |
|
2229 |
|
2230 testText[27] = 0x1EA0; // capital A with dot below |
|
2231 testText[28] = 0x0306; // combining breve - expect 0x1EB6 (succeed) |
|
2232 |
|
2233 testText[29] = 0x0102; // capital A with breve |
|
2234 testText[30] = 0x0323; // combining dot below - expect 0x0102, 0x0323 (fail) |
|
2235 |
|
2236 testText[31] = 0x0045; // capital A |
|
2237 testText[32] = 0x0302; // combining circumflex |
|
2238 testText[33] = 0x0301; // combining acute - expect 0x1EBE (succeed) |
|
2239 |
|
2240 testText[34] = 0x00CA; // capital A with circumflex |
|
2241 testText[35] = 0x0301; // combining acute - expect 0x1EBE (succeed) |
|
2242 |
|
2243 testText[36] = 0x004F; // capital O |
|
2244 testText[37] = 0x031B; // combining horn |
|
2245 testText[38] = 0x0309; // combining hook above - expect 0x1EDE (succeed) |
|
2246 |
|
2247 testText[39] = 0x01A0; // capital O with horn |
|
2248 testText[40] = 0x0309; // combining hook above - expect 0x1EDE (succeed) |
|
2249 |
|
2250 param.iText.Set(testText); |
|
2251 |
|
2252 // 1: Capital U with combining horn |
|
2253 param.iPosInText = 0; |
|
2254 param.iPen.iX = param.iPen.iY = 0; |
|
2255 r = iTestFont->GetCharacterPosition(param); |
|
2256 TEST(r && param.iPosInText == 2 |
|
2257 && param.iPen.iX == 10 |
|
2258 && param.iOutputGlyphs == 1 |
|
2259 && param.iOutput[0].iCode == 0x01AF); |
|
2260 |
|
2261 // 2: Capital U with apostrophe |
|
2262 param.iPosInText = 2; |
|
2263 param.iPen.iX = param.iPen.iY = 0; |
|
2264 r = iTestFont->GetCharacterPosition(param); |
|
2265 TEST(r && param.iPosInText == 3 |
|
2266 && param.iPen.iX == 10 |
|
2267 && param.iOutputGlyphs == 1 |
|
2268 && param.iOutput[0].iCode == 0x0055); |
|
2269 |
|
2270 // 3: Capital U with modifier prime |
|
2271 param.iPosInText = 4; |
|
2272 param.iPen.iX = param.iPen.iY = 0; |
|
2273 r = iTestFont->GetCharacterPosition(param); |
|
2274 TEST(r && param.iPosInText == 5 |
|
2275 && param.iPen.iX == 10 |
|
2276 && param.iOutputGlyphs == 1 |
|
2277 && param.iOutput[0].iCode == 0x0055); |
|
2278 |
|
2279 // 4: Capital U with modifier apostrophe |
|
2280 param.iPosInText = 6; |
|
2281 param.iPen.iX = param.iPen.iY = 0; |
|
2282 r = iTestFont->GetCharacterPosition(param); |
|
2283 TEST(r && param.iPosInText == 7 |
|
2284 && param.iPen.iX == 10 |
|
2285 && param.iOutputGlyphs == 1 |
|
2286 && param.iOutput[0].iCode == 0x0055); |
|
2287 |
|
2288 // 5: Capital U with combining comma above right |
|
2289 param.iPosInText = 8; |
|
2290 param.iPen.iX = param.iPen.iY = 0; |
|
2291 r = iTestFont->GetCharacterPosition(param); |
|
2292 TEST(r && param.iPosInText == 10 |
|
2293 && param.iPen.iX == 10 |
|
2294 && param.iOutputGlyphs == 2 |
|
2295 && param.iOutput[0].iCode == 0x0055 |
|
2296 && param.iOutput[1].iCode == 0x0315); |
|
2297 |
|
2298 // 6: Capital U with right single quote |
|
2299 param.iPosInText = 10; |
|
2300 param.iPen.iX = param.iPen.iY = 0; |
|
2301 r = iTestFont->GetCharacterPosition(param); |
|
2302 TEST(r && param.iPosInText == 11 |
|
2303 && param.iPen.iX == 10 |
|
2304 && param.iOutputGlyphs == 1 |
|
2305 && param.iOutput[0].iCode == 0x0055); |
|
2306 |
|
2307 // 7: Capital U with horn plus space |
|
2308 param.iPosInText = 12; |
|
2309 param.iPen.iX = param.iPen.iY = 0; |
|
2310 r = iTestFont->GetCharacterPosition(param); |
|
2311 TEST(r && param.iPosInText == 13 |
|
2312 && param.iPen.iX == 10 |
|
2313 && param.iOutputGlyphs == 1 |
|
2314 && param.iOutput[0].iCode == 0x01AF); |
|
2315 |
|
2316 // 8: Capital E with combining horn |
|
2317 param.iPosInText = 14; |
|
2318 param.iPen.iX = param.iPen.iY = 0; |
|
2319 r = iTestFont->GetCharacterPosition(param); |
|
2320 TEST(r && param.iPosInText == 16 |
|
2321 && param.iPen.iX == 10 |
|
2322 && param.iOutputGlyphs == 2 |
|
2323 && param.iOutput[0].iCode == 0x0045 |
|
2324 && param.iOutput[1].iCode == 0x031B); |
|
2325 |
|
2326 // 9: Capital A with combining breve with combining acute |
|
2327 param.iPosInText = 16; |
|
2328 param.iPen.iX = param.iPen.iY = 0; |
|
2329 r = iTestFont->GetCharacterPosition(param); |
|
2330 TEST(r && param.iPosInText == 19 |
|
2331 && param.iPen.iX == 10 |
|
2332 && param.iOutputGlyphs == 1 |
|
2333 && param.iOutput[0].iCode == 0x1EAE); |
|
2334 |
|
2335 // 10: Capital A with breve with combining acute |
|
2336 param.iPosInText = 19; |
|
2337 param.iPen.iX = param.iPen.iY = 0; |
|
2338 r = iTestFont->GetCharacterPosition(param); |
|
2339 TEST(r && param.iPosInText == 21 |
|
2340 && param.iPen.iX == 10 |
|
2341 && param.iOutputGlyphs == 1 |
|
2342 && param.iOutput[0].iCode == 0x1EAE); |
|
2343 |
|
2344 // 11: Capital A with combining acute with combining breve |
|
2345 param.iPosInText = 21; |
|
2346 param.iPen.iX = param.iPen.iY = 0; |
|
2347 r = iTestFont->GetCharacterPosition(param); |
|
2348 TEST(r && param.iPosInText == 24 |
|
2349 && param.iPen.iX == 10 |
|
2350 && param.iOutputGlyphs == 3 |
|
2351 && param.iOutput[0].iCode == 0x0041 |
|
2352 && param.iOutput[1].iCode == 0x0301 |
|
2353 && param.iOutput[2].iCode == 0x0306); |
|
2354 |
|
2355 // 12: Capital A with combining dot below with combining breve |
|
2356 param.iPosInText = 24; |
|
2357 param.iPen.iX = param.iPen.iY = 0; |
|
2358 r = iTestFont->GetCharacterPosition(param); |
|
2359 TEST(r && param.iPosInText == 27 |
|
2360 && param.iPen.iX == 10 |
|
2361 && param.iOutputGlyphs == 1 |
|
2362 && param.iOutput[0].iCode == 0x1EB6); |
|
2363 |
|
2364 // 13: Capital A with dot below with combining breve |
|
2365 param.iPosInText = 27; |
|
2366 param.iPen.iX = param.iPen.iY = 0; |
|
2367 r = iTestFont->GetCharacterPosition(param); |
|
2368 TEST(r && param.iPosInText == 29 |
|
2369 && param.iPen.iX == 10 |
|
2370 && param.iOutputGlyphs == 1 |
|
2371 && param.iOutput[0].iCode == 0x1EB6); |
|
2372 |
|
2373 // 14: Capital A with breve with combining dot below |
|
2374 param.iPosInText = 29; |
|
2375 param.iPen.iX = param.iPen.iY = 0; |
|
2376 r = iTestFont->GetCharacterPosition(param); |
|
2377 TEST(r && param.iPosInText == 31 |
|
2378 && param.iPen.iX == 10 |
|
2379 && param.iOutputGlyphs == 2 |
|
2380 && param.iOutput[0].iCode == 0x0102 |
|
2381 && param.iOutput[1].iCode == 0x0323); |
|
2382 |
|
2383 // 15: Capital A with combining circumflex with combining acute |
|
2384 param.iPosInText = 31; |
|
2385 param.iPen.iX = param.iPen.iY = 0; |
|
2386 r = iTestFont->GetCharacterPosition(param); |
|
2387 TEST(r && param.iPosInText == 34 |
|
2388 && param.iPen.iX == 10 |
|
2389 && param.iOutputGlyphs == 1 |
|
2390 && param.iOutput[0].iCode == 0x1EBE); |
|
2391 |
|
2392 // 16: Capital A with circumflex with combining acute |
|
2393 param.iPosInText = 34; |
|
2394 param.iPen.iX = param.iPen.iY = 0; |
|
2395 r = iTestFont->GetCharacterPosition(param); |
|
2396 TEST(r && param.iPosInText == 36 |
|
2397 && param.iPen.iX == 10 |
|
2398 && param.iOutputGlyphs == 1 |
|
2399 && param.iOutput[0].iCode == 0x1EBE); |
|
2400 |
|
2401 // 17: Capital O with combining horn with combing hook above |
|
2402 param.iPosInText = 36; |
|
2403 param.iPen.iX = param.iPen.iY = 0; |
|
2404 r = iTestFont->GetCharacterPosition(param); |
|
2405 TEST(r && param.iPosInText == 39 |
|
2406 && param.iPen.iX == 10 |
|
2407 && param.iOutputGlyphs == 1 |
|
2408 && param.iOutput[0].iCode == 0x1EDE); |
|
2409 |
|
2410 // 18: Capital O with horn with combing hook above |
|
2411 param.iPosInText = 39; |
|
2412 param.iPen.iX = param.iPen.iY = 0; |
|
2413 r = iTestFont->GetCharacterPosition(param); |
|
2414 TEST(r && param.iPosInText == 41 |
|
2415 && param.iPen.iX == 10 |
|
2416 && param.iOutputGlyphs == 1 |
|
2417 && param.iOutput[0].iCode == 0x1EDE); |
|
2418 } |
|
2419 |
|
2420 |
|
2421 void CTGlyphSelection::TestNonBmpCharsL() |
|
2422 { |
|
2423 // create a font store for testing |
|
2424 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
2425 |
|
2426 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
2427 LoadOpenFontLibraries(fontStore); |
|
2428 // test font preparation |
|
2429 fontStore->iKPixelWidthInTwips = 11860; //This value is default |
|
2430 |
|
2431 //add any required font files |
|
2432 TUid err = fontStore->AddFileL(KTestGB18030FontFile); |
|
2433 |
|
2434 TFontSpec testGB18030FontSpec(KTestGB18030FontFaceName,200); |
|
2435 |
|
2436 CFbsBitmap* bmp = new(ELeave) CFbsBitmap; |
|
2437 |
|
2438 TInt ret = bmp->Create(TSize(100,100),EGray2); |
|
2439 if (ret == KErrNotSupported) |
|
2440 return; |
|
2441 else |
|
2442 User::LeaveIfError(ret); |
|
2443 |
|
2444 CFbsBitmapDevice* device = NULL; |
|
2445 TRAPD(err2,device = CFbsBitmapDevice::NewL(bmp)); |
|
2446 TEST(err2 == KErrNone); |
|
2447 |
|
2448 CFbsBitGc* gc = NULL; |
|
2449 User::LeaveIfError(device->CreateContext(gc)); |
|
2450 // Font file Creation |
|
2451 CFbsFont* gb18030Font = NULL; |
|
2452 User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(gb18030Font,testGB18030FontSpec)); |
|
2453 gc->UseFont(gb18030Font); |
|
2454 CleanupStack::PushL(gb18030Font); |
|
2455 |
|
2456 //Testcode for GB18030 |
|
2457 ((CTGlyphSelectionStep*)iStep)->RecordTestResultL(); |
|
2458 ((CTGlyphSelectionStep*)iStep)->SetTestStepID(_L("TI18N-GDI-CIT-4077")); |
|
2459 TestNonBmpCharsInGB18030(gb18030Font); |
|
2460 ((CTGlyphSelectionStep*)iStep)->RecordTestResultL(); |
|
2461 |
|
2462 CleanupStack::Pop(gb18030Font); |
|
2463 |
|
2464 //Cleaning the memory |
|
2465 delete bmp; |
|
2466 delete device; |
|
2467 delete gc; |
|
2468 fontStore->RemoveFile(err); |
|
2469 delete fontStore; |
|
2470 REComSession::FinalClose(); |
|
2471 } |
|
2472 |
|
2473 |
|
2474 void CTGlyphSelection::TestTextDirection() |
|
2475 /** |
|
2476 This method is a test case to test GetCharacterPosition() correctly |
|
2477 produces glyph bounding boxes and utilizes various pen offsets in |
|
2478 a horizontal and vertical context. |
|
2479 */ |
|
2480 { |
|
2481 TBool r; |
|
2482 TBuf<20> testText(0); |
|
2483 CFont::TPositionParam param; |
|
2484 param.iFlags = CFont::TPositionParam::EFLogicalOrder; |
|
2485 |
|
2486 testText.SetLength(5); |
|
2487 testText[0] = 'a'; |
|
2488 testText[1] = 'B'; |
|
2489 testText[2] = 'c'; |
|
2490 testText[3] = ' '; |
|
2491 testText[4] = '1'; |
|
2492 param.iText.Set(testText); |
|
2493 |
|
2494 // 1: Test horizontal text pen advancement & bounds |
|
2495 param.iDirection = CFont::EHorizontal; |
|
2496 param.iPosInText = 0; |
|
2497 param.iPen.iX = param.iPen.iY = 0; |
|
2498 r = iTestFont->GetCharacterPosition(param); |
|
2499 TEST(r && param.iPosInText == 1 |
|
2500 && param.iPen == TPoint(10,0) |
|
2501 && param.iOutputGlyphs == 1 |
|
2502 && param.iOutput[0].iCode == 'a' |
|
2503 && param.iOutput[0].iBounds.iTl == TPoint(0,-10) |
|
2504 && param.iOutput[0].iBounds.iBr == TPoint(10,2)); |
|
2505 // add check for bounds |
|
2506 |
|
2507 // 2: Test horizontal text pen advancement with +ve pen offset |
|
2508 param.iPosInText = 4; |
|
2509 param.iPen.iX = 20; |
|
2510 param.iPen.iY = 12; |
|
2511 r = iTestFont->GetCharacterPosition(param); |
|
2512 TEST(r && param.iPosInText == 5 |
|
2513 && param.iPen == TPoint(30,12) |
|
2514 && param.iOutputGlyphs == 1 |
|
2515 && param.iOutput[0].iCode == '1' |
|
2516 && param.iOutput[0].iBounds.iTl == TPoint(20,2) |
|
2517 && param.iOutput[0].iBounds.iBr == TPoint(30,14)); |
|
2518 |
|
2519 // 3: Test horizontal text pen advancement with -ve pen offset |
|
2520 param.iPosInText = 4; |
|
2521 param.iPen.iX = -10; |
|
2522 param.iPen.iY = -24; |
|
2523 r = iTestFont->GetCharacterPosition(param); |
|
2524 TEST(r && param.iPosInText == 5 |
|
2525 && param.iPen == TPoint(0,-24) |
|
2526 && param.iOutputGlyphs == 1 |
|
2527 && param.iOutput[0].iCode == '1' |
|
2528 && param.iOutput[0].iBounds.iTl == TPoint(-10,-34) |
|
2529 && param.iOutput[0].iBounds.iBr == TPoint(0,-22)); |
|
2530 |
|
2531 // 4: Test vertical text pen advancement & bounds |
|
2532 param.iDirection = CFont::EVertical; |
|
2533 param.iPosInText = 1; |
|
2534 param.iPen.iX = param.iPen.iY = 0; |
|
2535 r = iTestFont->GetCharacterPosition(param); |
|
2536 TEST(r && param.iPosInText == 2 |
|
2537 && param.iPen == TPoint(0,12) |
|
2538 && param.iOutputGlyphs == 1 |
|
2539 && param.iOutput[0].iCode == 'B' |
|
2540 && param.iOutput[0].iBounds.iTl == TPoint(0,0) |
|
2541 && param.iOutput[0].iBounds.iBr == TPoint(10,12)); |
|
2542 |
|
2543 // 5: Test vertical text pen advancement with +ve pen offset |
|
2544 param.iPosInText = 4; |
|
2545 param.iPen.iX = 20; |
|
2546 param.iPen.iY = 12; |
|
2547 r = iTestFont->GetCharacterPosition(param); |
|
2548 TEST(r && param.iPosInText == 5 |
|
2549 && param.iPen == TPoint(20,24) |
|
2550 && param.iOutputGlyphs == 1 |
|
2551 && param.iOutput[0].iCode == '1' |
|
2552 && param.iOutput[0].iBounds.iTl == TPoint(20,12) |
|
2553 && param.iOutput[0].iBounds.iBr == TPoint(30,24)); |
|
2554 |
|
2555 // 6: Test vertical text pen advancement with -ve pen offset |
|
2556 param.iPosInText = 4; |
|
2557 param.iPen.iX = -10; |
|
2558 param.iPen.iY = -24; |
|
2559 r = iTestFont->GetCharacterPosition(param); |
|
2560 TEST(r && param.iPosInText == 5 |
|
2561 && param.iPen == TPoint(-10,-12) |
|
2562 && param.iOutputGlyphs == 1 |
|
2563 && param.iOutput[0].iCode == '1' |
|
2564 && param.iOutput[0].iBounds.iTl == TPoint(-10,-24) |
|
2565 && param.iOutput[0].iBounds.iBr == TPoint(0,-12)); |
|
2566 } |
|
2567 |
|
2568 void CTGlyphSelection::TestAllUnicodeChars() |
|
2569 /** |
|
2570 This method is a test case to test GetCharacterPosition() correctly |
|
2571 processes all the characters in the Unicode code space 0x0000 to |
|
2572 0xffff. |
|
2573 */ |
|
2574 { |
|
2575 TBool r; |
|
2576 TBuf<8> testText(0); |
|
2577 CFont::TPositionParam param; |
|
2578 param.iFlags = CFont::TPositionParam::EFLogicalOrder; |
|
2579 |
|
2580 TInt errors = 0; |
|
2581 testText.SetLength(1); |
|
2582 for (TUint i = 0xd802; i <= 0xffff; i++) |
|
2583 { |
|
2584 testText[0] = (TText16) i; |
|
2585 if (i==0x1b) continue; // Skip as CTestFont designed to fail here r==0. |
|
2586 param.iText.Set(testText); |
|
2587 param.iDirection = CFont::EHorizontal; |
|
2588 param.iPosInText = 0; |
|
2589 param.iPen.iX = param.iPen.iY = 0; |
|
2590 r = iTestFont->GetCharacterPosition(param); |
|
2591 if (!r || param.iPosInText != 1) |
|
2592 { |
|
2593 errors++; |
|
2594 //RDebug::Print(_L("%04x(%d,%d,%d), "), i, r, param.iPosInText, param.iOutputGlyphs ); |
|
2595 //if (errors%8 == 0) |
|
2596 // RDebug::Print(_L("\n")); |
|
2597 } |
|
2598 } |
|
2599 |
|
2600 TEST (errors == 0); |
|
2601 } |
|
2602 |
|
2603 #ifdef TEST |
|
2604 #undef TEST |
|
2605 #define TEST(a) (void)(a) |
|
2606 #endif |
|
2607 |
|
2608 /** |
2170 @SYMTestCaseID GRAPHICS-SYSLIB-GDI-CIT-1580 |
2609 @SYMTestCaseID GRAPHICS-SYSLIB-GDI-CIT-1580 |
2171 @SYMTestCaseDesc Automated GDI testing for Hindi |
2610 @SYMTestCaseDesc Automated GDI testing for Hindi |
2172 @SYMTestPriority High |
2611 @SYMTestPriority High |
2173 @SYMTestActions Attempt to compose various valid and invalid Hindi glyph clusters. |
2612 @SYMTestActions Attempt to compose various valid and invalid Hindi glyph clusters. |
2174 @SYMTestExpectedResults The expected glyph clusters for given Unicode charactors must be returned |
2613 @SYMTestExpectedResults The expected glyph clusters for given Unicode charactors must be returned |
7070 delete fontStore; |
7509 delete fontStore; |
7071 REComSession::FinalClose(); |
7510 REComSession::FinalClose(); |
7072 } |
7511 } |
7073 |
7512 |
7074 |
7513 |
7075 /** |
|
7076 @SYMTestCaseID GRAPHICS-SYSLIB-GDI-CT-0221 |
|
7077 @SYMTestCaseDesc Test support for Vietnamese characters. |
|
7078 @SYMTestPriority High |
|
7079 @SYMTestActions Attempt to compose various valid and invalid Vietnamese glyph clusters. |
|
7080 @SYMTestExpectedResults The test must not fail. |
|
7081 @SYMPREQ 402: GDI for Bravo. |
|
7082 */ |
|
7083 void CTGlyphSelection::TestVietnameseChars() |
|
7084 { |
|
7085 /** |
|
7086 This method is a test case to test GetCharacterPosition() correctly |
|
7087 processes Vietnamese characters. |
|
7088 */ |
|
7089 TBool r; |
|
7090 TBuf<41> testText(0); |
|
7091 CFont::TPositionParam param; |
|
7092 param.iDirection = CFont::EHorizontal; |
|
7093 param.iFlags = CFont::TPositionParam::EFLogicalOrder; |
|
7094 |
|
7095 testText.SetLength(41); |
|
7096 |
|
7097 testText[0] = 0x0055; // capital U |
|
7098 testText[1] = 0x031B; // combining horn - expect 0x01AF (succeed) |
|
7099 |
|
7100 testText[2] = 0x0055; // capital U |
|
7101 testText[3] = 0x0027; // apostrophe - expect 0x0055 (fail) |
|
7102 |
|
7103 testText[4] = 0x0055; // capital U |
|
7104 testText[5] = 0x02B9; // modifier prime - expect 0x0055 (fail) |
|
7105 |
|
7106 testText[6] = 0x0055; // capital U |
|
7107 testText[7] = 0x02BC; // modifier apostrophe - expect 0x0055 (fail) |
|
7108 |
|
7109 testText[8] = 0x0055; // capital U |
|
7110 testText[9] = 0x0315; // combining comma above right - expect 0x0055, 0x0315 (fail) |
|
7111 |
|
7112 testText[10] = 0x0055; // capital U |
|
7113 testText[11] = 0x2019; // right single quote mark - expect 0x0055 (fail) |
|
7114 |
|
7115 testText[12] = 0x01AF; // capital U with horn |
|
7116 testText[13] = 0x0020; // space - expect 0x01AF (succeed) |
|
7117 |
|
7118 testText[14] = 0x0045; // capital E |
|
7119 testText[15] = 0x031B; // combining horn - expect 0x0045, 0x031B (fail) |
|
7120 |
|
7121 testText[16] = 0x0041; // capital A |
|
7122 testText[17] = 0x0306; // combining breve |
|
7123 testText[18] = 0x0301; // combining acute - expect 0x1EAE (succeed) |
|
7124 |
|
7125 testText[19] = 0x0102; // capital A with breve |
|
7126 testText[20] = 0x0301; // combining acute - expect 0x1EAE (succeed) |
|
7127 |
|
7128 testText[21] = 0x0041; // capital A |
|
7129 testText[22] = 0x0301; // combining acute |
|
7130 testText[23] = 0x0306; // combining breve - expect 0x0041, 0x0301, 0x0306 (fail) |
|
7131 |
|
7132 testText[24] = 0x0041; // capital A |
|
7133 testText[25] = 0x0323; // combining dot below |
|
7134 testText[26] = 0x0306; // combining breve - expect 0x1EB6 (succeed) |
|
7135 |
|
7136 testText[27] = 0x1EA0; // capital A with dot below |
|
7137 testText[28] = 0x0306; // combining breve - expect 0x1EB6 (succeed) |
|
7138 |
|
7139 testText[29] = 0x0102; // capital A with breve |
|
7140 testText[30] = 0x0323; // combining dot below - expect 0x0102, 0x0323 (fail) |
|
7141 |
|
7142 testText[31] = 0x0045; // capital A |
|
7143 testText[32] = 0x0302; // combining circumflex |
|
7144 testText[33] = 0x0301; // combining acute - expect 0x1EBE (succeed) |
|
7145 |
|
7146 testText[34] = 0x00CA; // capital A with circumflex |
|
7147 testText[35] = 0x0301; // combining acute - expect 0x1EBE (succeed) |
|
7148 |
|
7149 testText[36] = 0x004F; // capital O |
|
7150 testText[37] = 0x031B; // combining horn |
|
7151 testText[38] = 0x0309; // combining hook above - expect 0x1EDE (succeed) |
|
7152 |
|
7153 testText[39] = 0x01A0; // capital O with horn |
|
7154 testText[40] = 0x0309; // combining hook above - expect 0x1EDE (succeed) |
|
7155 |
|
7156 param.iText.Set(testText); |
|
7157 |
|
7158 // 1: Capital U with combining horn |
|
7159 param.iPosInText = 0; |
|
7160 param.iPen.iX = param.iPen.iY = 0; |
|
7161 r = iTestFont->GetCharacterPosition(param); |
|
7162 TEST(r && param.iPosInText == 2 |
|
7163 && param.iPen.iX == 10 |
|
7164 && param.iOutputGlyphs == 1 |
|
7165 && param.iOutput[0].iCode == 0x01AF); |
|
7166 |
|
7167 // 2: Capital U with apostrophe |
|
7168 param.iPosInText = 2; |
|
7169 param.iPen.iX = param.iPen.iY = 0; |
|
7170 r = iTestFont->GetCharacterPosition(param); |
|
7171 TEST(r && param.iPosInText == 3 |
|
7172 && param.iPen.iX == 10 |
|
7173 && param.iOutputGlyphs == 1 |
|
7174 && param.iOutput[0].iCode == 0x0055); |
|
7175 |
|
7176 // 3: Capital U with modifier prime |
|
7177 param.iPosInText = 4; |
|
7178 param.iPen.iX = param.iPen.iY = 0; |
|
7179 r = iTestFont->GetCharacterPosition(param); |
|
7180 TEST(r && param.iPosInText == 5 |
|
7181 && param.iPen.iX == 10 |
|
7182 && param.iOutputGlyphs == 1 |
|
7183 && param.iOutput[0].iCode == 0x0055); |
|
7184 |
|
7185 // 4: Capital U with modifier apostrophe |
|
7186 param.iPosInText = 6; |
|
7187 param.iPen.iX = param.iPen.iY = 0; |
|
7188 r = iTestFont->GetCharacterPosition(param); |
|
7189 TEST(r && param.iPosInText == 7 |
|
7190 && param.iPen.iX == 10 |
|
7191 && param.iOutputGlyphs == 1 |
|
7192 && param.iOutput[0].iCode == 0x0055); |
|
7193 |
|
7194 // 5: Capital U with combining comma above right |
|
7195 param.iPosInText = 8; |
|
7196 param.iPen.iX = param.iPen.iY = 0; |
|
7197 r = iTestFont->GetCharacterPosition(param); |
|
7198 TEST(r && param.iPosInText == 10 |
|
7199 && param.iPen.iX == 10 |
|
7200 && param.iOutputGlyphs == 2 |
|
7201 && param.iOutput[0].iCode == 0x0055 |
|
7202 && param.iOutput[1].iCode == 0x0315); |
|
7203 |
|
7204 // 6: Capital U with right single quote |
|
7205 param.iPosInText = 10; |
|
7206 param.iPen.iX = param.iPen.iY = 0; |
|
7207 r = iTestFont->GetCharacterPosition(param); |
|
7208 TEST(r && param.iPosInText == 11 |
|
7209 && param.iPen.iX == 10 |
|
7210 && param.iOutputGlyphs == 1 |
|
7211 && param.iOutput[0].iCode == 0x0055); |
|
7212 |
|
7213 // 7: Capital U with horn plus space |
|
7214 param.iPosInText = 12; |
|
7215 param.iPen.iX = param.iPen.iY = 0; |
|
7216 r = iTestFont->GetCharacterPosition(param); |
|
7217 TEST(r && param.iPosInText == 13 |
|
7218 && param.iPen.iX == 10 |
|
7219 && param.iOutputGlyphs == 1 |
|
7220 && param.iOutput[0].iCode == 0x01AF); |
|
7221 |
|
7222 // 8: Capital E with combining horn |
|
7223 param.iPosInText = 14; |
|
7224 param.iPen.iX = param.iPen.iY = 0; |
|
7225 r = iTestFont->GetCharacterPosition(param); |
|
7226 TEST(r && param.iPosInText == 16 |
|
7227 && param.iPen.iX == 10 |
|
7228 && param.iOutputGlyphs == 2 |
|
7229 && param.iOutput[0].iCode == 0x0045 |
|
7230 && param.iOutput[1].iCode == 0x031B); |
|
7231 |
|
7232 // 9: Capital A with combining breve with combining acute |
|
7233 param.iPosInText = 16; |
|
7234 param.iPen.iX = param.iPen.iY = 0; |
|
7235 r = iTestFont->GetCharacterPosition(param); |
|
7236 TEST(r && param.iPosInText == 19 |
|
7237 && param.iPen.iX == 10 |
|
7238 && param.iOutputGlyphs == 1 |
|
7239 && param.iOutput[0].iCode == 0x1EAE); |
|
7240 |
|
7241 // 10: Capital A with breve with combining acute |
|
7242 param.iPosInText = 19; |
|
7243 param.iPen.iX = param.iPen.iY = 0; |
|
7244 r = iTestFont->GetCharacterPosition(param); |
|
7245 TEST(r && param.iPosInText == 21 |
|
7246 && param.iPen.iX == 10 |
|
7247 && param.iOutputGlyphs == 1 |
|
7248 && param.iOutput[0].iCode == 0x1EAE); |
|
7249 |
|
7250 // 11: Capital A with combining acute with combining breve |
|
7251 param.iPosInText = 21; |
|
7252 param.iPen.iX = param.iPen.iY = 0; |
|
7253 r = iTestFont->GetCharacterPosition(param); |
|
7254 TEST(r && param.iPosInText == 24 |
|
7255 && param.iPen.iX == 10 |
|
7256 && param.iOutputGlyphs == 3 |
|
7257 && param.iOutput[0].iCode == 0x0041 |
|
7258 && param.iOutput[1].iCode == 0x0301 |
|
7259 && param.iOutput[2].iCode == 0x0306); |
|
7260 |
|
7261 // 12: Capital A with combining dot below with combining breve |
|
7262 param.iPosInText = 24; |
|
7263 param.iPen.iX = param.iPen.iY = 0; |
|
7264 r = iTestFont->GetCharacterPosition(param); |
|
7265 TEST(r && param.iPosInText == 27 |
|
7266 && param.iPen.iX == 10 |
|
7267 && param.iOutputGlyphs == 1 |
|
7268 && param.iOutput[0].iCode == 0x1EB6); |
|
7269 |
|
7270 // 13: Capital A with dot below with combining breve |
|
7271 param.iPosInText = 27; |
|
7272 param.iPen.iX = param.iPen.iY = 0; |
|
7273 r = iTestFont->GetCharacterPosition(param); |
|
7274 TEST(r && param.iPosInText == 29 |
|
7275 && param.iPen.iX == 10 |
|
7276 && param.iOutputGlyphs == 1 |
|
7277 && param.iOutput[0].iCode == 0x1EB6); |
|
7278 |
|
7279 // 14: Capital A with breve with combining dot below |
|
7280 param.iPosInText = 29; |
|
7281 param.iPen.iX = param.iPen.iY = 0; |
|
7282 r = iTestFont->GetCharacterPosition(param); |
|
7283 TEST(r && param.iPosInText == 31 |
|
7284 && param.iPen.iX == 10 |
|
7285 && param.iOutputGlyphs == 2 |
|
7286 && param.iOutput[0].iCode == 0x0102 |
|
7287 && param.iOutput[1].iCode == 0x0323); |
|
7288 |
|
7289 // 15: Capital A with combining circumflex with combining acute |
|
7290 param.iPosInText = 31; |
|
7291 param.iPen.iX = param.iPen.iY = 0; |
|
7292 r = iTestFont->GetCharacterPosition(param); |
|
7293 TEST(r && param.iPosInText == 34 |
|
7294 && param.iPen.iX == 10 |
|
7295 && param.iOutputGlyphs == 1 |
|
7296 && param.iOutput[0].iCode == 0x1EBE); |
|
7297 |
|
7298 // 16: Capital A with circumflex with combining acute |
|
7299 param.iPosInText = 34; |
|
7300 param.iPen.iX = param.iPen.iY = 0; |
|
7301 r = iTestFont->GetCharacterPosition(param); |
|
7302 TEST(r && param.iPosInText == 36 |
|
7303 && param.iPen.iX == 10 |
|
7304 && param.iOutputGlyphs == 1 |
|
7305 && param.iOutput[0].iCode == 0x1EBE); |
|
7306 |
|
7307 // 17: Capital O with combining horn with combing hook above |
|
7308 param.iPosInText = 36; |
|
7309 param.iPen.iX = param.iPen.iY = 0; |
|
7310 r = iTestFont->GetCharacterPosition(param); |
|
7311 TEST(r && param.iPosInText == 39 |
|
7312 && param.iPen.iX == 10 |
|
7313 && param.iOutputGlyphs == 1 |
|
7314 && param.iOutput[0].iCode == 0x1EDE); |
|
7315 |
|
7316 // 18: Capital O with horn with combing hook above |
|
7317 param.iPosInText = 39; |
|
7318 param.iPen.iX = param.iPen.iY = 0; |
|
7319 r = iTestFont->GetCharacterPosition(param); |
|
7320 TEST(r && param.iPosInText == 41 |
|
7321 && param.iPen.iX == 10 |
|
7322 && param.iOutputGlyphs == 1 |
|
7323 && param.iOutput[0].iCode == 0x1EDE); |
|
7324 } |
|
7325 |
|
7326 |
|
7327 void CTGlyphSelection::TestNonBmpCharsL() |
|
7328 { |
|
7329 // create a font store for testing |
|
7330 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
7331 |
|
7332 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
7333 LoadOpenFontLibraries(fontStore); |
|
7334 // test font preparation |
|
7335 fontStore->iKPixelWidthInTwips = 11860; //This value is default |
|
7336 |
|
7337 //add any required font files |
|
7338 TUid err = fontStore->AddFileL(KTestGB18030FontFile); |
|
7339 |
|
7340 TFontSpec testGB18030FontSpec(KTestGB18030FontFaceName,200); |
|
7341 |
|
7342 CFbsBitmap* bmp = new(ELeave) CFbsBitmap; |
|
7343 |
|
7344 TInt ret = bmp->Create(TSize(100,100),EGray2); |
|
7345 if (ret == KErrNotSupported) |
|
7346 return; |
|
7347 else |
|
7348 User::LeaveIfError(ret); |
|
7349 |
|
7350 CFbsBitmapDevice* device = NULL; |
|
7351 TRAPD(err2,device = CFbsBitmapDevice::NewL(bmp)); |
|
7352 TEST(err2 == KErrNone); |
|
7353 |
|
7354 CFbsBitGc* gc = NULL; |
|
7355 User::LeaveIfError(device->CreateContext(gc)); |
|
7356 // Font file Creation |
|
7357 CFbsFont* gb18030Font = NULL; |
|
7358 User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(gb18030Font,testGB18030FontSpec)); |
|
7359 gc->UseFont(gb18030Font); |
|
7360 CleanupStack::PushL(gb18030Font); |
|
7361 |
|
7362 //Testcode for GB18030 |
|
7363 ((CTGlyphSelectionStep*)iStep)->RecordTestResultL(); |
|
7364 ((CTGlyphSelectionStep*)iStep)->SetTestStepID(_L("TI18N-GDI-CIT-4077")); |
|
7365 TestNonBmpCharsInGB18030(gb18030Font); |
|
7366 ((CTGlyphSelectionStep*)iStep)->RecordTestResultL(); |
|
7367 |
|
7368 CleanupStack::Pop(gb18030Font); |
|
7369 |
|
7370 //Cleaning the memory |
|
7371 delete bmp; |
|
7372 delete device; |
|
7373 delete gc; |
|
7374 fontStore->RemoveFile(err); |
|
7375 delete fontStore; |
|
7376 REComSession::FinalClose(); |
|
7377 } |
|
7378 |
|
7379 |
|
7380 void CTGlyphSelection::TestTextDirection() |
|
7381 /** |
|
7382 This method is a test case to test GetCharacterPosition() correctly |
|
7383 produces glyph bounding boxes and utilizes various pen offsets in |
|
7384 a horizontal and vertical context. |
|
7385 */ |
|
7386 { |
|
7387 TBool r; |
|
7388 TBuf<20> testText(0); |
|
7389 CFont::TPositionParam param; |
|
7390 param.iFlags = CFont::TPositionParam::EFLogicalOrder; |
|
7391 |
|
7392 testText.SetLength(5); |
|
7393 testText[0] = 'a'; |
|
7394 testText[1] = 'B'; |
|
7395 testText[2] = 'c'; |
|
7396 testText[3] = ' '; |
|
7397 testText[4] = '1'; |
|
7398 param.iText.Set(testText); |
|
7399 |
|
7400 // 1: Test horizontal text pen advancement & bounds |
|
7401 param.iDirection = CFont::EHorizontal; |
|
7402 param.iPosInText = 0; |
|
7403 param.iPen.iX = param.iPen.iY = 0; |
|
7404 r = iTestFont->GetCharacterPosition(param); |
|
7405 TEST(r && param.iPosInText == 1 |
|
7406 && param.iPen == TPoint(10,0) |
|
7407 && param.iOutputGlyphs == 1 |
|
7408 && param.iOutput[0].iCode == 'a' |
|
7409 && param.iOutput[0].iBounds.iTl == TPoint(0,-10) |
|
7410 && param.iOutput[0].iBounds.iBr == TPoint(10,2)); |
|
7411 // add check for bounds |
|
7412 |
|
7413 // 2: Test horizontal text pen advancement with +ve pen offset |
|
7414 param.iPosInText = 4; |
|
7415 param.iPen.iX = 20; |
|
7416 param.iPen.iY = 12; |
|
7417 r = iTestFont->GetCharacterPosition(param); |
|
7418 TEST(r && param.iPosInText == 5 |
|
7419 && param.iPen == TPoint(30,12) |
|
7420 && param.iOutputGlyphs == 1 |
|
7421 && param.iOutput[0].iCode == '1' |
|
7422 && param.iOutput[0].iBounds.iTl == TPoint(20,2) |
|
7423 && param.iOutput[0].iBounds.iBr == TPoint(30,14)); |
|
7424 |
|
7425 // 3: Test horizontal text pen advancement with -ve pen offset |
|
7426 param.iPosInText = 4; |
|
7427 param.iPen.iX = -10; |
|
7428 param.iPen.iY = -24; |
|
7429 r = iTestFont->GetCharacterPosition(param); |
|
7430 TEST(r && param.iPosInText == 5 |
|
7431 && param.iPen == TPoint(0,-24) |
|
7432 && param.iOutputGlyphs == 1 |
|
7433 && param.iOutput[0].iCode == '1' |
|
7434 && param.iOutput[0].iBounds.iTl == TPoint(-10,-34) |
|
7435 && param.iOutput[0].iBounds.iBr == TPoint(0,-22)); |
|
7436 |
|
7437 // 4: Test vertical text pen advancement & bounds |
|
7438 param.iDirection = CFont::EVertical; |
|
7439 param.iPosInText = 1; |
|
7440 param.iPen.iX = param.iPen.iY = 0; |
|
7441 r = iTestFont->GetCharacterPosition(param); |
|
7442 TEST(r && param.iPosInText == 2 |
|
7443 && param.iPen == TPoint(0,12) |
|
7444 && param.iOutputGlyphs == 1 |
|
7445 && param.iOutput[0].iCode == 'B' |
|
7446 && param.iOutput[0].iBounds.iTl == TPoint(0,0) |
|
7447 && param.iOutput[0].iBounds.iBr == TPoint(10,12)); |
|
7448 |
|
7449 // 5: Test vertical text pen advancement with +ve pen offset |
|
7450 param.iPosInText = 4; |
|
7451 param.iPen.iX = 20; |
|
7452 param.iPen.iY = 12; |
|
7453 r = iTestFont->GetCharacterPosition(param); |
|
7454 TEST(r && param.iPosInText == 5 |
|
7455 && param.iPen == TPoint(20,24) |
|
7456 && param.iOutputGlyphs == 1 |
|
7457 && param.iOutput[0].iCode == '1' |
|
7458 && param.iOutput[0].iBounds.iTl == TPoint(20,12) |
|
7459 && param.iOutput[0].iBounds.iBr == TPoint(30,24)); |
|
7460 |
|
7461 // 6: Test vertical text pen advancement with -ve pen offset |
|
7462 param.iPosInText = 4; |
|
7463 param.iPen.iX = -10; |
|
7464 param.iPen.iY = -24; |
|
7465 r = iTestFont->GetCharacterPosition(param); |
|
7466 TEST(r && param.iPosInText == 5 |
|
7467 && param.iPen == TPoint(-10,-12) |
|
7468 && param.iOutputGlyphs == 1 |
|
7469 && param.iOutput[0].iCode == '1' |
|
7470 && param.iOutput[0].iBounds.iTl == TPoint(-10,-24) |
|
7471 && param.iOutput[0].iBounds.iBr == TPoint(0,-12)); |
|
7472 } |
|
7473 |
|
7474 void CTGlyphSelection::TestAllUnicodeChars() |
|
7475 /** |
|
7476 This method is a test case to test GetCharacterPosition() correctly |
|
7477 processes all the characters in the Unicode code space 0x0000 to |
|
7478 0xffff. |
|
7479 */ |
|
7480 { |
|
7481 TBool r; |
|
7482 TBuf<8> testText(0); |
|
7483 CFont::TPositionParam param; |
|
7484 param.iFlags = CFont::TPositionParam::EFLogicalOrder; |
|
7485 |
|
7486 TInt errors = 0; |
|
7487 testText.SetLength(1); |
|
7488 for (TUint i = 0xd802; i <= 0xffff; i++) |
|
7489 { |
|
7490 testText[0] = (TText16) i; |
|
7491 if (i==0x1b) continue; // Skip as CTestFont designed to fail here r==0. |
|
7492 param.iText.Set(testText); |
|
7493 param.iDirection = CFont::EHorizontal; |
|
7494 param.iPosInText = 0; |
|
7495 param.iPen.iX = param.iPen.iY = 0; |
|
7496 r = iTestFont->GetCharacterPosition(param); |
|
7497 if (!r || param.iPosInText != 1) |
|
7498 { |
|
7499 errors++; |
|
7500 //RDebug::Print(_L("%04x(%d,%d,%d), "), i, r, param.iPosInText, param.iOutputGlyphs ); |
|
7501 //if (errors%8 == 0) |
|
7502 // RDebug::Print(_L("\n")); |
|
7503 } |
|
7504 } |
|
7505 |
|
7506 TEST (errors == 0); |
|
7507 } |
|
7508 |
7514 |
7509 /** Tests that ligatures (presently just Lam-Alef in Arabic) work correctly |
7515 /** Tests that ligatures (presently just Lam-Alef in Arabic) work correctly |
7510 when diacritics are required on one, both or neither character comprising the |
7516 when diacritics are required on one, both or neither character comprising the |
7511 ligature. */ |
7517 ligature. */ |
7512 void CTGlyphSelection::TestLigaturesWithDiacritics() |
7518 void CTGlyphSelection::TestLigaturesWithDiacritics() |