Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9702a37 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Add a test for auto-correction."

parents f9521c6f 0bfe359e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -53,6 +53,13 @@ public class ComposingStateManager {
        }
    }

    public synchronized boolean isComposing() {
        // TODO: use the composing flag in WordComposer instead of maintaining it
        // here separately. Even better, do away with this class and manage the auto
        // correction indicator in the same place as the suggestions.
        return mIsComposing;
    }

    public synchronized boolean isAutoCorrectionIndicatorOn() {
        return mAutoCorrectionIndicatorOn;
    }
+2 −3
Original line number Diff line number Diff line
@@ -1702,10 +1702,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
                if (DEBUG) {
                    Log.d(TAG, "Flip the indicator. " + oldAutoCorrectionIndicator
                            + " -> " + newAutoCorrectionIndicator);
                    if (newAutoCorrectionIndicator
                    if (mComposingStateManager.isComposing() && newAutoCorrectionIndicator
                            != mComposingStateManager.isAutoCorrectionIndicatorOn()) {
                        throw new RuntimeException("Couldn't flip the indicator! We are not "
                                + "composing a word right now.");
                        throw new RuntimeException("Couldn't flip the indicator!");
                    }
                }
                final CharSequence textWithUnderline =
+2 −1
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@ import com.android.inputmethod.keyboard.ProximityInfo;
import java.util.TreeMap;

public class SpellCheckerProximityInfo {
    final private static int NUL = KeyDetector.NOT_A_CODE;
    /* public for test */
    final public static int NUL = KeyDetector.NOT_A_CODE;

    // This must be the same as MAX_PROXIMITY_CHARS_SIZE else it will not work inside
    // native code - this value is passed at creation of the binary object and reused
+1 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ static void prof_out(void) {
#define NOT_VALID_WORD -99
#define NOT_A_CHARACTER -1
#define NOT_A_DISTANCE -1
#define NOT_A_COORDINATE -1
#define EQUIVALENT_CHAR_WITHOUT_DISTANCE_INFO -2
#define PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO -3
#define NOT_A_INDEX -1
+3 −0
Original line number Diff line number Diff line
@@ -165,6 +165,9 @@ float ProximityInfo::calculateNormalizedSquaredDistance(
    if (!hasSweetSpotData(keyIndex)) {
        return NOT_A_DISTANCE_FLOAT;
    }
    if (NOT_A_COORDINATE == mInputXCoordinates[inputIndex]) {
        return NOT_A_DISTANCE_FLOAT;
    }
    const float squaredDistance = calculateSquaredDistanceFromSweetSpotCenter(keyIndex, inputIndex);
    const float squaredRadius = square(mSweetSpotRadii[keyIndex]);
    return squaredDistance / squaredRadius;
Loading