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

Commit 067d8cdf authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Fix unit test breakage

Change-Id: I538288054a58eb2c81ce3cbe5c9bef900fb653a5
parent a2b4bfb0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -16,9 +16,13 @@

package com.android.inputmethod.latin.common;

import com.android.inputmethod.annotations.UsedForTesting;

import java.util.Random;

// Utility methods related with code points used for tests.
// TODO: Figure out where this class should be.
@UsedForTesting
public class CodePointUtils {
    private CodePointUtils() {
        // This utility class is not publicly instantiable.
@@ -60,6 +64,7 @@ public class CodePointUtils {
        0x00FF /* LATIN SMALL LETTER Y WITH DIAERESIS */
    };

    @UsedForTesting
    public static int[] generateCodePointSet(final int codePointSetSize, final Random random) {
        final int[] codePointSet = new int[codePointSetSize];
        for (int i = codePointSet.length - 1; i >= 0; ) {
@@ -80,6 +85,7 @@ public class CodePointUtils {
    /**
     * Generates a random word.
     */
    @UsedForTesting
    public static String generateWord(final Random random, final int[] codePointSet) {
        StringBuilder builder = new StringBuilder();
        // 8 * 4 = 32 chars max, but we do it the following way so as to bias the random toward
+1 −1
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ public final class Constants {

    /**
     * Screen metrics (a.k.a. Device form factor) constants of
     * {@link R.integer#config_screen_metrics}.
     * {@link com.android.inputmethod.latin.R.integer#config_screen_metrics}.
     */
    public static final int SCREEN_METRICS_SMALL_PHONE = 0;
    public static final int SCREEN_METRICS_LARGE_PHONE = 1;
+7 −7
Original line number Diff line number Diff line
@@ -218,17 +218,17 @@ public class DeadKeyCombiner implements Combiner {
    @Nonnull
    private static Event createEventChainFromSequence(final @Nonnull CharSequence text,
            @Nonnull final Event originalEvent) {
        if (text.length() <= 0) {
        int index = text.length();
        if (index <= 0) {
            return originalEvent;
        }
        Event lastEvent = null;
        int codePoint = 0;
        for (int i = text.length(); i > 0; i -= Character.charCount(codePoint)) {
            codePoint = Character.codePointBefore(text, i);
            final Event thisEvent = Event.createHardwareKeypressEvent(codePoint,
        do {
            final int codePoint = Character.codePointBefore(text, index);
            lastEvent = Event.createHardwareKeypressEvent(codePoint,
                    originalEvent.mKeyCode, lastEvent, false /* isKeyRepeat */);
            lastEvent = thisEvent;
        }
            index -= Character.charCount(codePoint);
        } while (index > 0);
        return lastEvent;
    }

+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.ArrayList;

/**
 * Class grouping utilities for offline dictionary making.