1607 iView->FormatTextL(); |
1614 iView->FormatTextL(); |
1608 |
1615 |
1609 TPoint point1,point2; |
1616 TPoint point1,point2; |
1610 iLayout->DocPosToXyPosL(0,point1); |
1617 iLayout->DocPosToXyPosL(0,point1); |
1611 iLayout->DocPosToXyPosL(1,point2); |
1618 iLayout->DocPosToXyPosL(1,point2); |
1612 |
1619 |
1613 TInt wLTR = point2.iX - point1.iX; //It depends on platform. WINSCW/H4 w=5; H6 w=4 |
1620 TInt w = point2.iX - point1.iX; //It depends on platform. WINSCW/H4 w=5; H6 w=4 |
1614 |
1621 |
1615 iLayout->DocPosToXyPosL(5,point1); |
1622 // DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is LTR |
1616 iLayout->DocPosToXyPosL(4,point2); |
|
1617 TInt wRTL = point2.iX - point1.iX; //It depends on platform. WINSCW/H4 w=5; H6 w=4 |
|
1618 RDebug::Print(_L("wLTR %d,wRTL %d"), wLTR,wRTL); |
|
1619 |
|
1620 // DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is RTL |
|
1621 rect = iLayout->GetLineRectL(0,2); |
|
1622 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1623 test(rect.iTl.iX == 0 && rect.iBr.iX == 3*wLTR); |
|
1624 |
|
1625 // DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is RTL |
|
1626 rect = iLayout->GetLineRectL(0,4); |
|
1627 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1628 test(rect.iTl.iX == 0 && rect.iBr.iX == 3*wLTR + 2*wRTL); |
|
1629 |
|
1630 // DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is LTR |
|
1631 rect = iLayout->GetLineRectL(0,5); |
|
1632 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1633 test(rect.iTl.iX == 0 && rect.iBr.iX == 3*wLTR + wRTL); |
|
1634 |
|
1635 // DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is LTR |
|
1636 rect = iLayout->GetLineRectL(0,7); |
1623 rect = iLayout->GetLineRectL(0,7); |
1637 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1624 test(rect.iTl.iX == 0 && rect.iBr.iX == 8*w); |
1638 test(rect.iTl.iX == 0 && rect.iBr.iX == 3*wLTR + 3*wRTL + 2*wLTR); |
1625 |
1639 |
1626 // DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is RTL |
|
1627 rect = iLayout->GetLineRectL(0,2); |
|
1628 test(rect.iTl.iX == 0 && rect.iBr.iX == 3*w); |
|
1629 |
|
1630 // DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is LTR |
|
1631 rect = iLayout->GetLineRectL(0,5); |
|
1632 test(rect.iTl.iX == 0 && rect.iBr.iX == 4*w); |
|
1633 |
|
1634 // DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is RTL |
|
1635 rect = iLayout->GetLineRectL(0,4); |
|
1636 test(rect.iTl.iX == 0 && rect.iBr.iX == 5*w); |
|
1637 |
1640 // DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is LTR |
1638 // DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is LTR |
1641 rect = iLayout->GetLineRectL(2,7); |
1639 rect = iLayout->GetLineRectL(2,7); |
1642 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1640 test(rect.iTl.iX == 2*w && rect.iBr.iX == 8*w); |
1643 test(rect.iTl.iX == 2*wLTR && rect.iBr.iX == 3*wLTR + 3*wRTL + 2*wLTR); |
|
1644 |
1641 |
1645 // DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is RTL |
1642 // DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is RTL |
1646 rect = iLayout->GetLineRectL(2,8); |
1643 rect = iLayout->GetLineRectL(2,8); |
1647 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1644 test(rect.iTl.iX == 2*w && rect.iBr.iX == 9*w); |
1648 test(rect.iTl.iX == 2*wLTR && rect.iBr.iX == 3*wLTR + 3*wRTL + 3*wLTR); |
|
1649 |
1645 |
1650 // DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is LTR |
1646 // DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is LTR |
1651 rect = iLayout->GetLineRectL(2,5); |
1647 rect = iLayout->GetLineRectL(2,5); |
1652 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1648 test(rect.iTl.iX == 2*w && rect.iBr.iX == 4*w); |
1653 test(rect.iTl.iX == 2*wLTR && rect.iBr.iX == 3*wLTR + wRTL); |
|
1654 |
1649 |
1655 // DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is RTL |
1650 // DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is RTL |
1656 rect = iLayout->GetLineRectL(2,4); |
1651 rect = iLayout->GetLineRectL(2,4); |
1657 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1652 test(rect.iTl.iX == 2*w && rect.iBr.iX == 5*w); |
1658 test(rect.iTl.iX == 2*wLTR && rect.iBr.iX == 3*wLTR + 2*wRTL); |
|
1659 |
1653 |
1660 // Sample text for test |
1654 // Sample text for test |
1661 // Doc_Pos: | 9|10|11| 8| 7| 6| 3| 4| 5| 2| 1| 0| |
1655 // Doc_Pos: | 9|10|11| 8| 7| 6| 3| 4| 5| 2| 1| 0| |
1662 // X-Coords: |40|45|50|55|60|65|70|75|80|85|90|95|100| in case w=5 |
1656 // X-Coords: |40|45|50|55|60|65|70|75|80|85|90|95|100| in case w=5 |
1663 |
1657 |
1669 iEtext->InsertL(iEtext->DocumentLength(),KParaSep); |
1663 iEtext->InsertL(iEtext->DocumentLength(),KParaSep); |
1670 iView->FormatTextL(); |
1664 iView->FormatTextL(); |
1671 |
1665 |
1672 // DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is LTR |
1666 // DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is LTR |
1673 rect = iLayout->GetLineRectL(2,4); |
1667 rect = iLayout->GetLineRectL(2,4); |
1674 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1668 test(rect.iTl.iX == (75/5-20)*w+100 && rect.iBr.iX == (90/5-20)*w+100); |
1675 test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 2*wLTR && rect.iBr.iX == iWindowRect.Width() - 2*wRTL); |
|
1676 |
1669 |
1677 // DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is RTL |
1670 // DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is RTL |
1678 rect = iLayout->GetLineRectL(2,5); |
1671 rect = iLayout->GetLineRectL(2,5); |
1679 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1672 test(rect.iTl.iX == (80/5-20)*w+100 && rect.iBr.iX == (90/5-20)*w+100); |
1680 test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - wLTR && rect.iBr.iX == iWindowRect.Width() - 2*wRTL); |
|
1681 |
1673 |
1682 // DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is LTR |
1674 // DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is LTR |
1683 rect = iLayout->GetLineRectL(2,8); |
1675 rect = iLayout->GetLineRectL(2,8); |
1684 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1676 test(rect.iTl.iX == (55/5-20)*w+100 && rect.iBr.iX == (90/5-20)*w+100); |
1685 test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 3*wLTR - 3*wRTL && rect.iBr.iX == iWindowRect.Width() - 2*wRTL); |
|
1686 |
1677 |
1687 // DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is RTL |
1678 // DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is RTL |
1688 rect = iLayout->GetLineRectL(2,7); |
1679 rect = iLayout->GetLineRectL(2,7); |
1689 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1680 test(rect.iTl.iX == (60/5-20)*w+100 && rect.iBr.iX == (90/5-20)*w+100); |
1690 test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 3*wLTR - 2*wRTL && rect.iBr.iX == iWindowRect.Width() - 2*wRTL); |
|
1691 |
1681 |
1692 // DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is LTR |
1682 // DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is LTR |
1693 rect = iLayout->GetLineRectL(0,4); |
1683 rect = iLayout->GetLineRectL(0,4); |
1694 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1684 test(rect.iTl.iX == (75/5-20)*w+100 && rect.iBr.iX == 100); |
1695 test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 2*wLTR && rect.iBr.iX == 100); |
|
1696 |
1685 |
1697 // DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is RTL |
1686 // DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is RTL |
1698 rect = iLayout->GetLineRectL(0,5); |
1687 rect = iLayout->GetLineRectL(0,5); |
1699 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1688 test(rect.iTl.iX == (80/5-20)*w+100 && rect.iBr.iX == 100); |
1700 test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - wLTR && rect.iBr.iX == 100); |
|
1701 |
1689 |
1702 // DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is LTR |
1690 // DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is LTR |
1703 rect = iLayout->GetLineRectL(0,8); |
1691 rect = iLayout->GetLineRectL(0,8); |
1704 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1692 test(rect.iTl.iX == (55/5-20)*w+100 && rect.iBr.iX == 100); |
1705 test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 3*wLTR - 3*wRTL && rect.iBr.iX == 100); |
|
1706 |
1693 |
1707 // DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is RTL |
1694 // DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is RTL |
1708 rect = iLayout->GetLineRectL(0,7); |
1695 rect = iLayout->GetLineRectL(0,7); |
1709 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1696 test(rect.iTl.iX == (60/5-20)*w+100 && rect.iBr.iX == 100); |
1710 test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 3*wLTR - 2*wRTL && rect.iBr.iX == 100); |
1697 |
1711 |
1698 STestDataTInt4 DataEmH4[] = { |
1712 |
1699 {0,12,0,100 },{20,24,0,20},{0,0,0,5},{12,12,95,100},{7,7,35,40}, |
|
1700 {7,12,35,100},{13,20,95,100},{10,9,50,100}, |
|
1701 {3,19,15,100},{20,38,5,100},{19,19,95,100},{20,20,95,100},{19,20,95,100}, |
|
1702 }; |
|
1703 STestDataTInt4 DataH6[] = { |
|
1704 {0,15,0,100}, {25,30,0,20},{0,0,0,4},{15,15,96,100},{7,7,28,32}, |
|
1705 {7,15,28,100},{16,25,96,100},{10,9,40,100}, |
|
1706 {3,24,12,100},{25,48,4,100}, {24,24,96,100},{25,25,96,100},{24,25,96,100}, |
|
1707 }; |
|
1708 |
|
1709 test(sizeof(DataEmH4)/sizeof(STestDataTInt4) == sizeof(DataH6)/sizeof(STestDataTInt4)); |
|
1710 |
|
1711 STestDataTInt4 *testdata; |
|
1712 TPtrC pLtoRTextLong; |
|
1713 TPtrC pRtoLTextLong; |
|
1714 TPtrC pLtoRTextVeryLong; |
|
1715 TPtrC pRtoLTextVeryLong; |
|
1716 |
|
1717 if(w == 5)// for WINSCW(Em) and H4 |
|
1718 { |
|
1719 testdata = DataEmH4; |
|
1720 pLtoRTextLong.Set(KLtoRTextLong); |
|
1721 pRtoLTextLong.Set(KRtoLTextLong); |
|
1722 pLtoRTextVeryLong.Set(KLtoRTextVeryLong); |
|
1723 pRtoLTextVeryLong.Set(KRtoLTextVeryLong); |
|
1724 } |
|
1725 else if (w == 4) // for H6 |
|
1726 { |
|
1727 testdata = DataH6; |
|
1728 pLtoRTextLong.Set(KLtoRTextLong2); |
|
1729 pRtoLTextLong.Set(KRtoLTextLong2); |
|
1730 pLtoRTextVeryLong.Set(KLtoRTextVeryLong2); |
|
1731 pRtoLTextVeryLong.Set(KRtoLTextVeryLong2); |
|
1732 } |
|
1733 else |
|
1734 { |
|
1735 test(0); |
|
1736 Destroy(); |
|
1737 return; |
|
1738 } |
1713 |
1739 |
1714 // Edge case tests |
1740 // Edge case tests |
1715 // Sample text |
1741 // Sample text |
1716 // 1st Line: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|19|18|17|16|15|14|13|12| |
1742 // 1st Line: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|19|18|17|16|15|14|13|12| |
1717 // X-Coords: | 0| 5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100| in case w=5 |
1743 // X-Coords: | 0| 5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100| in case w=5 |
1721 // Sample text |
1747 // Sample text |
1722 // 1st Line: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|24|23|22|21|20|19|18|17|16|15| |
1748 // 1st Line: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|24|23|22|21|20|19|18|17|16|15| |
1723 // X-Coords: | 0| 4| 8|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96|100| w=4 |
1749 // X-Coords: | 0| 4| 8|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96|100| w=4 |
1724 // 2nd Line: |29|28|27|26|25|24|23|22|21|20| |
1750 // 2nd Line: |29|28|27|26|25|24|23|22|21|20| |
1725 |
1751 |
1726 TInt LtoRLength = (iWindowRect.Width() - 5*wRTL)/wLTR; |
|
1727 TInt RtoLLength = 10; |
|
1728 TInt RtoLinLine1= (iWindowRect.Width() - LtoRLength * wLTR)/wRTL; |
|
1729 TInt Line2Start = LtoRLength + RtoLinLine1; |
|
1730 |
|
1731 iEtext->Reset(); |
1752 iEtext->Reset(); |
1732 for(TInt i=0;i<LtoRLength;i++) |
1753 iEtext->InsertL(0,pLtoRTextLong); |
1733 { |
1754 iEtext->InsertL(iEtext->DocumentLength(),pRtoLTextLong); |
1734 iEtext->InsertL(iEtext->DocumentLength(),KLtoRChar); |
|
1735 } |
|
1736 |
|
1737 for(TInt i=0;i<RtoLLength;i++) |
|
1738 { |
|
1739 iEtext->InsertL(iEtext->DocumentLength(),KRtoLChar); |
|
1740 } |
|
1741 iEtext->InsertL(iEtext->DocumentLength(),KParaSep); |
1755 iEtext->InsertL(iEtext->DocumentLength(),KParaSep); |
1742 iView->FormatTextL(); |
1756 iView->FormatTextL(); |
1743 |
1757 |
1744 for(TInt i=0;i<LtoRLength + RtoLLength;i++) |
1758 for (TInt i = 0; i < 8;i++) |
1745 { |
1759 { |
1746 rect = iLayout->GetLineRectL(i,i+1); |
1760 // Test for whole line i=0 to 1 |
1747 RDebug::Print(_L("%d: iTl.iX %d,iY %d, iBr.iX %d,iY %d"), i,rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1761 // Test for one char i=2 to 4 |
1748 } |
1762 // Test for DocPos2 at the end of line i=5 |
1749 |
1763 // Test for DocPos2 at a different line i=6 |
1750 rect = iLayout->GetLineRectL(0,LtoRLength); |
1764 // Test for DocPos2 < DocPos1 i=7 |
1751 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1765 rect = iLayout->GetLineRectL(testdata[i].iDoc1,testdata[i].iDoc2); |
1752 test(rect.iTl.iX == 0 && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL ); //Line 1 |
1766 test.Printf(_L("GetLineRect edge test i=%d \n"),i); |
1753 |
1767 test(rect.iTl.iX == testdata[i].iPos1 && rect.iBr.iX == testdata[i].iPos2); //Line 1 |
1754 rect = iLayout->GetLineRectL(Line2Start, LtoRLength + RtoLLength); |
1768 } |
1755 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1769 |
1756 test(rect.iTl.iX == 0 && rect.iBr.iX == (RtoLLength - RtoLinLine1)*wRTL); //Line 2 |
|
1757 |
|
1758 rect = iLayout->GetLineRectL(0,0); |
|
1759 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1760 test(rect.iTl.iX == 0 && rect.iBr.iX == wLTR); //first char |
|
1761 |
|
1762 //firt char of RTL |
|
1763 rect = iLayout->GetLineRectL(LtoRLength,LtoRLength); |
|
1764 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1765 test(rect.iTl.iX == LtoRLength*wLTR + (RtoLinLine1-1)*wRTL && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL); //end of line 1 |
|
1766 |
|
1767 //middle of L to R |
|
1768 rect = iLayout->GetLineRectL(LtoRLength/2,LtoRLength/2); |
|
1769 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1770 test(rect.iTl.iX == LtoRLength/2 * wLTR && rect.iBr.iX == (LtoRLength/2+1) * wLTR); |
|
1771 |
|
1772 //middle of LTR to first of RTL |
|
1773 rect = iLayout->GetLineRectL(LtoRLength/2,LtoRLength); |
|
1774 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1775 test(rect.iTl.iX == LtoRLength/2 * wLTR && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL); |
|
1776 |
|
1777 //second of RTL to start of 2nd line ?? |
|
1778 rect = iLayout->GetLineRectL(LtoRLength+1,Line2Start); |
|
1779 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1780 test(rect.iTl.iX == LtoRLength*wLTR + (RtoLinLine1-1)*wRTL && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL); //end of line 1 |
|
1781 |
|
1782 //middle of L to R |
|
1783 rect = iLayout->GetLineRectL(LtoRLength/2,LtoRLength/2-1); |
|
1784 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1785 test(rect.iTl.iX == LtoRLength/2 * wLTR && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL); |
|
1786 |
|
1787 |
|
1788 // Test for edge cases while two lines are in different direction |
1770 // Test for edge cases while two lines are in different direction |
1789 // Sample text |
1771 // Sample text |
1790 // 1st Line: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19| |
1772 // 1st Line: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19| |
1791 // X-Coords: | 0| 5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100| in case w=5 |
1773 // X-Coords: | 0| 5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100| in case w=5 |
1792 // 2nd Line: |39|38|37|36|35|34|33|32|31|30|29|28|27|26|25|24|23|22|21|20| |
1774 // 2nd Line: |39|38|37|36|35|34|33|32|31|30|29|28|27|26|25|24|23|22|21|20| |
1794 // Test for edge cases while two lines are in different direction |
1776 // Test for edge cases while two lines are in different direction |
1795 // Sample text |
1777 // Sample text |
1796 // 1st Line: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24| |
1778 // 1st Line: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24| |
1797 // X-Coords: | 0| 4| 8| 12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96|100| w=4 |
1779 // X-Coords: | 0| 4| 8| 12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96|100| w=4 |
1798 // 2nd Line: |49|48|47|46|45|44|43|42|41|40|39|38|37|36|35|34|33|32|31|30|29|28|27|26|25| |
1780 // 2nd Line: |49|48|47|46|45|44|43|42|41|40|39|38|37|36|35|34|33|32|31|30|29|28|27|26|25| |
1799 |
1781 iEtext->Reset(); |
1800 LtoRLength = iWindowRect.Width()/wLTR; |
1782 iEtext->InsertL(0,pLtoRTextVeryLong); |
1801 RtoLLength = iWindowRect.Width()/wRTL; |
1783 iEtext->InsertL(iEtext->DocumentLength(),pRtoLTextVeryLong); |
1802 |
|
1803 iEtext->Reset(); |
|
1804 for(TInt i=0;i<LtoRLength;i++) |
|
1805 { |
|
1806 iEtext->InsertL(iEtext->DocumentLength(),KLtoRChar); |
|
1807 } |
|
1808 |
|
1809 for(TInt i=0;i<RtoLLength;i++) |
|
1810 { |
|
1811 iEtext->InsertL(iEtext->DocumentLength(),KRtoLChar); |
|
1812 } |
|
1813 iEtext->InsertL(iEtext->DocumentLength(),KParaSep); |
1784 iEtext->InsertL(iEtext->DocumentLength(),KParaSep); |
1814 iView->FormatTextL(); |
1785 iView->FormatTextL(); |
1815 |
1786 |
1816 for(TInt i=0;i<LtoRLength + RtoLLength;i++) |
1787 for (TInt i = 8; i < 13; i++) |
1817 { |
1788 { |
1818 rect = iLayout->GetLineRectL(i,i+1); |
1789 rect = iLayout->GetLineRectL(testdata[i].iDoc1,testdata[i].iDoc2); |
1819 RDebug::Print(_L("%d: iTl.iX %d,iY %d, iBr.iX %d,iY %d"), i,rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
1790 test.Printf(_L("GetLineRect edge test i=%d \n"),i); |
1820 } |
1791 test(rect.iTl.iX == testdata[i].iPos1 && rect.iBr.iX == testdata[i].iPos2); //Line 1 |
1821 |
1792 } |
1822 |
1793 Destroy(); |
1823 //1st line |
|
1824 rect = iLayout->GetLineRectL(3, LtoRLength-1); |
|
1825 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1826 test(rect.iTl.iX == 3*wLTR && rect.iBr.iX == LtoRLength*wLTR); //Line 2 |
|
1827 |
|
1828 //2nd line |
|
1829 rect = iLayout->GetLineRectL(LtoRLength,LtoRLength + RtoLLength -2); |
|
1830 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1831 test(rect.iTl.iX == wRTL && rect.iBr.iX == RtoLLength*wRTL); //Line 2 |
|
1832 |
|
1833 //end of 1st line |
|
1834 rect = iLayout->GetLineRectL(LtoRLength-1, LtoRLength-1); |
|
1835 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1836 test(rect.iTl.iX == (LtoRLength-1)*wLTR && rect.iBr.iX == LtoRLength*wLTR); //Line 2 |
|
1837 |
|
1838 //start of 2nd line |
|
1839 rect = iLayout->GetLineRectL(LtoRLength, LtoRLength); |
|
1840 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1841 test(rect.iTl.iX == (RtoLLength-1)*wRTL && rect.iBr.iX == RtoLLength*wRTL); //Line 2 |
|
1842 |
|
1843 //1st line to 2nd line |
|
1844 rect = iLayout->GetLineRectL(LtoRLength-1, LtoRLength); |
|
1845 RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY); |
|
1846 test(rect.iTl.iX == (LtoRLength-1)*wLTR && rect.iBr.iX == LtoRLength*wLTR); //Line 2 |
|
1847 |
|
1848 |
|
1849 } |
1794 } |
1850 |
1795 |
1851 /** |
1796 /** |
1852 @SYMTestCaseID SYSLIB-FORM-UT-4007 |
1797 @SYMTestCaseID SYSLIB-FORM-UT-4007 |
1853 @SYMTestCaseDesc Test for PDEF118443 |
1798 @SYMTestCaseDesc Test for PDEF118443 |