mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-05 06:45:39 +00:00
Fix the shared object name for API 8 compatibility, with tests.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.reecedunn.espeak.test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -24,6 +25,10 @@ import java.util.Set;
|
||||
import com.reecedunn.espeak.SpeechSynthesis;
|
||||
import com.reecedunn.espeak.SpeechSynthesis.Voice;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.media.AudioFormat;
|
||||
import android.speech.tts.TextToSpeech;
|
||||
import android.test.AndroidTestCase;
|
||||
@@ -157,6 +162,32 @@ public class SpeechSynthesisTest extends AndroidTestCase
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests that the location of the espeak TTS shared object matches
|
||||
* the location that Android 2.2 looks for it in.
|
||||
*/
|
||||
public void testSharedObjectLocation()
|
||||
{
|
||||
Intent intent = new Intent("android.intent.action.START_TTS_ENGINE");
|
||||
intent.setPackage("com.reecedunn.espeak");
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, 0);
|
||||
assertThat(resolveInfos, is(notNullValue()));
|
||||
assertThat(resolveInfos.isEmpty(), is(false));
|
||||
|
||||
ResolveInfo[] enginesArray = resolveInfos.toArray(new ResolveInfo[0]);
|
||||
ActivityInfo aInfo = enginesArray[0].activityInfo;
|
||||
String soFilename = aInfo.name.replace(aInfo.packageName + ".", "") + ".so";
|
||||
soFilename = soFilename.toLowerCase();
|
||||
assertThat(soFilename, is("espeak.so"));
|
||||
|
||||
soFilename = "/data/data/" + aInfo.packageName + "/lib/libtts" + soFilename;
|
||||
assertThat(soFilename, is("/data/data/com.reecedunn.espeak/lib/libttsespeak.so"));
|
||||
|
||||
File f = new File(soFilename);
|
||||
assertThat(f.exists(), is(true));
|
||||
}
|
||||
|
||||
public void testConstruction()
|
||||
{
|
||||
final SpeechSynthesis synth = new SpeechSynthesis(getContext(), mCallback);
|
||||
|
||||
@@ -42,7 +42,7 @@ LOCAL_LDLIBS := \
|
||||
|
||||
# Common
|
||||
|
||||
LOCAL_MODULE := libespeak
|
||||
LOCAL_MODULE := libttsespeak
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SpeechSynthesis {
|
||||
public static final int GENDER_FEMALE = 2;
|
||||
|
||||
static {
|
||||
System.loadLibrary("espeak");
|
||||
System.loadLibrary("ttsespeak");
|
||||
|
||||
nativeClassInit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user