QString Diff::diffStats() { QString stats; int totalAdditions = 0; int totalDeletions = 0; foreach (QString file, filesChangedList) { diffInfo *info = deltas[file]; totalAdditions += info->additions; totalDeletions += info->deletions; stats.append(" " + file + "\t| " + diffString(info->additions, info->deletions) + "\n"); }
void BidiTestRunner::runTest(const std::basic_string<UChar>& input, const std::vector<int>& expectedOrder, const std::vector<int>& expectedLevels, bidi_test::ParagraphDirection paragraphDirection, const std::string& line, size_t lineNumber) { if (!m_skippedCodePoints.empty()) { for (size_t i = 0; i < input.size(); i++) { if (m_skippedCodePoints.count(input[i])) { m_testsSkipped++; return; } } } m_testsRun++; TextRun textRun(input.data(), input.size()); switch (paragraphDirection) { case bidi_test::DirectionAutoLTR: textRun.setDirection(determineParagraphDirectionality(textRun)); break; case bidi_test::DirectionLTR: textRun.setDirection(LTR); break; case bidi_test::DirectionRTL: textRun.setDirection(RTL); break; } BidiResolver<TextRunIterator, BidiCharacterRun> resolver; resolver.setStatus(BidiStatus(textRun.direction(), textRun.directionalOverride())); resolver.setPositionIgnoringNestedIsolates(TextRunIterator(&textRun, 0)); BidiRunList<BidiCharacterRun>& runs = resolver.runs(); resolver.createBidiRunsForLine(TextRunIterator(&textRun, textRun.length())); std::ostringstream errorContext; errorContext << ", line " << lineNumber << " \"" << line << "\""; errorContext << " context: " << bidi_test::nameFromParagraphDirection(paragraphDirection); std::vector<int> actualOrder; std::vector<int> actualLevels; actualLevels.assign(input.size(), -1); BidiCharacterRun* run = runs.firstRun(); while (run) { // Blink's UBA just makes runs, the actual ordering of the display of characters // is handled later in our pipeline, so we fake it here: bool reversed = run->reversed(false); ASSERT(run->stop() >= run->start()); size_t length = run->stop() - run->start(); for (size_t i = 0; i < length; i++) { int inputIndex = reversed ? run->stop() - i - 1 : run->start() + i; if (!isNonRenderedCodePoint(input[inputIndex])) actualOrder.push_back(inputIndex); // BidiTest.txt gives expected level data in the order of the original input. actualLevels[inputIndex] = run->level(); } run = run->next(); } if (expectedOrder.size() != actualOrder.size()) { m_ignoredCharFailures++; EXPECT_EQ(expectedOrder.size(), actualOrder.size()) << errorContext.str(); } else if (expectedOrder != actualOrder) { m_orderFailures++; printf("ORDER %s%s\n", diffString(actualOrder, expectedOrder).c_str(), errorContext.str().c_str()); } if (expectedLevels.size() != actualLevels.size()) { m_ignoredCharFailures++; EXPECT_EQ(expectedLevels.size(), actualLevels.size()) << errorContext.str(); } else { for (size_t i = 0; i < expectedLevels.size(); i++) { // level == -1 means the level should be ignored. if (expectedLevels[i] == actualLevels[i] || expectedLevels[i] == -1) continue; printf("LEVELS %s%s\n", diffString(actualLevels, expectedLevels).c_str(), errorContext.str().c_str()); m_levelFailures++; break; } } runs.deleteRuns(); }