TEST_F(SmallCapsIteratorTest, Empty)
{
    String empty(String::make16BitFrom8BitSource(0, 0));
    SmallCapsIterator smallCapsIterator(empty.characters16(), empty.length());
    unsigned limit = 0;
    SmallCapsIterator::SmallCapsBehavior smallCapsBehavior = SmallCapsIterator::SmallCapsInvalid;
    ASSERT(!smallCapsIterator.consume(&limit, &smallCapsBehavior));
    ASSERT_EQ(limit, 0u);
    ASSERT_EQ(smallCapsBehavior, SmallCapsIterator::SmallCapsInvalid);
}
 void CheckRuns(const Vector<TestRun>& runs)
 {
     String text(String::make16BitFrom8BitSource(0, 0));
     Vector<ExpectedRun> expect;
     for (auto& run : runs) {
         text.append(String::fromUTF8(run.text.c_str()));
         expect.append(ExpectedRun(text.length(), run.code));
     }
     SmallCapsIterator smallCapsIterator(text.characters16(), text.length());
     VerifyRuns(&smallCapsIterator, expect);
 }
Beispiel #3
0
void HarfBuzzShaper::splitUntilNextCaseChange(HolesQueueItem& currentQueueItem, SmallCapsIterator::SmallCapsBehavior& smallCapsBehavior)
{
    unsigned numCharactersUntilCaseChange = 0;
    SmallCapsIterator smallCapsIterator(
        m_normalizedBuffer.get() + currentQueueItem.m_startIndex,
        currentQueueItem.m_numCharacters);
    smallCapsIterator.consume(&numCharactersUntilCaseChange, &smallCapsBehavior);
    if (numCharactersUntilCaseChange > 0 && numCharactersUntilCaseChange < currentQueueItem.m_numCharacters) {
        prependHolesQueue(HolesQueueRange,
            currentQueueItem.m_startIndex + numCharactersUntilCaseChange,
            currentQueueItem.m_numCharacters - numCharactersUntilCaseChange);
        currentQueueItem.m_numCharacters = numCharactersUntilCaseChange;
    }
}