TEST_F(OrientationIteratorTest, Empty) { String empty(emptyString16Bit()); OrientationIterator orientationIterator(empty.characters16(), empty.length(), FontOrientation::VerticalMixed); unsigned limit = 0; OrientationIterator::RenderOrientation orientation = OrientationIterator::OrientationInvalid; ASSERT(!orientationIterator.consume(&limit, &orientation)); ASSERT_EQ(limit, 0u); ASSERT_EQ(orientation, OrientationIterator::OrientationInvalid); }
void CheckRuns(const Vector<TestRun>& runs) { String text(emptyString16Bit()); Vector<ExpectedRun> expect; for (auto& run : runs) { text.append(String::fromUTF8(run.text.c_str())); expect.append(ExpectedRun(text.length(), run.code)); } OrientationIterator orientationIterator(text.characters16(), text.length(), FontOrientation::VerticalMixed); VerifyRuns(&orientationIterator, expect); }
String String::make16BitFrom8BitSource(const LChar* source, size_t length) { if (!length) return emptyString16Bit(); UChar* destination; String result = String::createUninitialized(length, destination); StringImpl::copyChars(destination, source, length); return result; }