TEST_F(CachingWordShaperTest, LatinLeftToRightByWord) { TextRun textRun(reinterpret_cast<const LChar*>("ABC DEF."), 8); RefPtr<ShapeResult> result; CachingWordShapeIterator iterator(cache.get(), textRun, &font); ASSERT_TRUE(iterator.next(&result)); ASSERT_TRUE(testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(0u, startIndex); EXPECT_EQ(3u, numGlyphs); EXPECT_EQ(HB_SCRIPT_LATIN, script); ASSERT_TRUE(iterator.next(&result)); ASSERT_TRUE(testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(0u, startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_COMMON, script); ASSERT_TRUE(iterator.next(&result)); ASSERT_TRUE(testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(0u, startIndex); EXPECT_EQ(4u, numGlyphs); EXPECT_EQ(HB_SCRIPT_LATIN, script); ASSERT_FALSE(iterator.next(&result)); }
TEST_F(CachingWordShaperTest, CommonAccentLeftToRightByWord) { const UChar str[] = { 0x2F, 0x301, 0x2E, 0x20, 0x2E, 0x0 }; TextRun textRun(str, 5); unsigned offset = 0; RefPtr<ShapeResult> result; CachingWordShapeIterator iterator(cache.get(), textRun, &font); ASSERT_TRUE(iterator.next(&result)); ASSERT_TRUE(testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(0u, offset + startIndex); EXPECT_EQ(3u, numGlyphs); EXPECT_EQ(HB_SCRIPT_COMMON, script); offset += result->numCharacters(); ASSERT_TRUE(iterator.next(&result)); ASSERT_TRUE(testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(3u, offset + startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_COMMON, script); offset += result->numCharacters(); ASSERT_TRUE(iterator.next(&result)); ASSERT_TRUE(testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(4u, offset + startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_COMMON, script); offset += result->numCharacters(); ASSERT_EQ(5u, offset); ASSERT_FALSE(iterator.next(&result)); }
TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsArabicThaiHanLatin) { UChar mixedString[] = {0x628, 0x64A, 0x629, 0xE20, 0x65E5, 0x62}; TextRun mixed(mixedString, 6); HarfBuzzShaper shaper(&font, mixed); RefPtr<ShapeResult> result = shaper.shapeResult(); ASSERT_EQ(4u, testInfo(result)->numberOfRunsForTesting()); ASSERT_TRUE( testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(0u, startIndex); EXPECT_EQ(3u, numGlyphs); EXPECT_EQ(HB_SCRIPT_ARABIC, script); ASSERT_TRUE( testInfo(result)->runInfoForTesting(1, startIndex, numGlyphs, script)); EXPECT_EQ(3u, startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_THAI, script); ASSERT_TRUE( testInfo(result)->runInfoForTesting(2, startIndex, numGlyphs, script)); EXPECT_EQ(4u, startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_HAN, script); ASSERT_TRUE( testInfo(result)->runInfoForTesting(3, startIndex, numGlyphs, script)); EXPECT_EQ(5u, startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_LATIN, script); }
TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsDevanagariCommonLatinCommon) { UChar devanagariCommonLatinString[] = {0x915, 0x94d, 0x930, 0x20, 0x61, 0x62, 0x2E}; TextRun devanagariCommonLatin(devanagariCommonLatinString, 7); HarfBuzzShaper shaper(&font, devanagariCommonLatin); RefPtr<ShapeResult> result = shaper.shapeResult(); ASSERT_EQ(3u, testInfo(result)->numberOfRunsForTesting()); ASSERT_TRUE( testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(0u, startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_DEVANAGARI, script); ASSERT_TRUE( testInfo(result)->runInfoForTesting(1, startIndex, numGlyphs, script)); EXPECT_EQ(3u, startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_DEVANAGARI, script); ASSERT_TRUE( testInfo(result)->runInfoForTesting(2, startIndex, numGlyphs, script)); EXPECT_EQ(4u, startIndex); EXPECT_EQ(3u, numGlyphs); EXPECT_EQ(HB_SCRIPT_LATIN, script); }
TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsLeadingCommon) { TextRun leadingCommon(reinterpret_cast<const LChar*>("... test"), 8); HarfBuzzShaper shaper(&font, leadingCommon); RefPtr<ShapeResult> result = shaper.shapeResult(); ASSERT_EQ(1u, testInfo(result)->numberOfRunsForTesting()); ASSERT_TRUE( testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(0u, startIndex); EXPECT_EQ(8u, numGlyphs); EXPECT_EQ(HB_SCRIPT_LATIN, script); }
TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsArabic) { UChar arabicString[] = {0x628, 0x64A, 0x629}; TextRun arabic(arabicString, 3); HarfBuzzShaper shaper(&font, arabic); RefPtr<ShapeResult> result = shaper.shapeResult(); ASSERT_EQ(1u, testInfo(result)->numberOfRunsForTesting()); ASSERT_TRUE( testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(0u, startIndex); EXPECT_EQ(3u, numGlyphs); EXPECT_EQ(HB_SCRIPT_ARABIC, script); }
int main(int argc, const char * argv[]) { // insert code here... testInfo(); testSplitter(); return 0; }
GLDEF_C TInt E32Main() // // Display system information // { test.Title(); test.Start(_L("Test UserHal info APIs")); testInfo(); test.End(); return(KErrNone); }
void STMPETest::runTest() { QFile nameFile(ACCEL_PATH "name"); testInfo("Reading STMPE name"); if (!nameFile.open(QIODevice::ReadOnly)) { testError("Unable to open device name"); return; } /* We must trim whitespace, since toInt() will fail otherwise, and the value * contains a trailing \n character. */ QString name = nameFile.readAll().trimmed(); if (name != "stmpe811") testError(QString("Error: Expected name of 'stmpe811', got name of '%1'").arg(name)); else testInfo(QString("Got expected name of '%1'").arg(name)); }
TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsUnicodeVariants) { struct { const char* name; UChar string[4]; hb_script_t script; } testlist[] = { {"Standard Variants text style", {0x30, 0xFE0E}, HB_SCRIPT_COMMON}, {"Standard Variants emoji style", {0x203C, 0xFE0F}, HB_SCRIPT_COMMON}, {"Standard Variants of Ideograph", {0x4FAE, 0xFE00}, HB_SCRIPT_HAN}, {"Ideographic Variants", {0x3402, 0xDB40, 0xDD00}, HB_SCRIPT_HAN}, {"Not-defined Variants", {0x41, 0xDB40, 0xDDEF}, HB_SCRIPT_LATIN}, }; for (auto& test : testlist) { String str(test.string); TextRun run(str); HarfBuzzShaper shaper(&font, run); RefPtr<ShapeResult> result = shaper.shapeResult(); EXPECT_EQ(1u, testInfo(result)->numberOfRunsForTesting()) << test.name; ASSERT_TRUE( testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)) << test.name; EXPECT_EQ(0u, startIndex) << test.name; if (numGlyphs == 2) { // If the specified VS is not in the font, it's mapped to .notdef. // then hb_ot_hide_default_ignorables() swaps it to a space with zero-advance. // http://lists.freedesktop.org/archives/harfbuzz/2015-May/004888.html // OpenType recommends Glyph ID 3 for a space; not a hard requirement though. // https://www.microsoft.com/typography/otspec/recom.htm #if !OS(MACOSX) EXPECT_EQ(3u, testInfo(result)->glyphForTesting(0, 1)) << test.name; #endif EXPECT_EQ(0.f, testInfo(result)->advanceForTesting(0, 1)) << test.name; } else { EXPECT_EQ(1u, numGlyphs) << test.name; } EXPECT_EQ(test.script, script) << test.name; } }
void ProgramSenoko::runTest() { QProcess stm32flash; int tries; if (prepGPIO()) { testError("Unable to set up reset GPIO"); return; } testInfo("Please hold the \"Reflash\" button on Senoko"); /* Wait for the flashing process to start */ while (1) { bool foundBanner = false; /* This string is the last thing to appear before programming starts */ const char *searchString = "Serial Config: 115200 8E1"; testDebug("Trying to initiate upload..."); resetGPIO(); stm32flash.terminate(); stm32flash.setProcessChannelMode(QProcess::MergedChannels); stm32flash.start("/factory/stm32flash", QStringList() << "-b" << "115200" << "-w" << firmware << "/dev/ttymxc3"); stm32flash.waitForStarted(); tries = 0; while (!foundBanner && (tries++ < 10)) { if (!stm32flash.waitForReadyRead(1000)) { testDebug("Process wasn't ready for read in 1 second"); break; } QByteArray output = stm32flash.readLine(); testDebug(QString("Output string: ") + output); if (stm32flash.state() != QProcess::Running) { testDebug("Process no longer running"); break; } if (output.startsWith(searchString)) { testDebug("Found search string"); foundBanner = true; } else { testDebug(QString("Line doesn't contain string %1: %2").arg(searchString).arg((const char *)output)); } } if (!foundBanner) { testDebug("Didn't find banner"); continue; } if (!stm32flash.waitForReadyRead(1000)) { testDebug("Didn't find data after 1 second"); continue; } break; } testInfo("Upload started, release the \"Reflash\" button"); if (!stm32flash.waitForFinished(60000)) { testError("Flashing process took too long"); testError(stm32flash.readAllStandardOutput()); return; } testInfo("Senoko reflashed successfully"); resetGPIO(); testInfo("Attempting to rescan device bus"); QFile autoprobeFile("/sys/bus/platform/drivers_autoprobe"); if (!autoprobeFile.open(QIODevice::WriteOnly)) { testError(QString() + "Unable to open platform/drivers_autoprobe file: " + autoprobeFile.errorString()); return; } autoprobeFile.write("1\n"); autoprobeFile.close(); sleep(1); }