Skip to content

Commit

Permalink
screenshots test #39
Browse files Browse the repository at this point in the history
  • Loading branch information
UriahShaulMandel committed Aug 13, 2019
1 parent 44ee1f0 commit ff2cd19
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ before_script:
- chmod +x gradlew
- mkdir -p /home/travis/sdcard/
- mksdcard -l baldphonesdcard 128M /home/travis/sdcard/sdcard.img
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a --skin 1080x1920 -dpi-device 480
- emulator -avd test -no-audio -skin pixel_silver -no-window -camera-back none -camera-front none -no-boot-anim -sdcard /home/travis/sdcard/sdcard.img -no-snapshot-save &
- android-wait-for-emulator
- adb shell settings put global window_animation_scale 0 &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;

public abstract class BaseScreenshotTakerTest<T extends Activity> {
private static final Locale[] locales = new Locale[]{Locale.ENGLISH, Locale.FRENCH, Locale.forLanguageTag("iw-IL")};
private static int localeIndex = 0;
protected static final Locale[] locales = new Locale[]{Locale.ENGLISH, Locale.FRENCH, Locale.GERMAN, Locale.forLanguageTag("iw-IL")};
protected static int localeIndex = 0;
private final LocaleRule mLocaleRule = new LocaleRule(locales);
public ActivityTestRule<T> mActivityTestRule = new ActivityTestRule<T>(activity(), true, false);
@Rule
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package com.bald.uriah.baldphone.screenshots;

import android.content.Intent;

import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;

import com.bald.uriah.baldphone.activities.contacts.ContactsActivity;

import org.junit.runner.RunWith;

@LargeTest
@RunWith(AndroidJUnit4.class)
public class ContactsActivityScreenshot extends BaseScreenshotTakerTest<ContactsActivity> {

public void test() {
// final Context context = getInstrumentation().getTargetContext();
//
// Resources resources = context.getResources();
// Locale.setDefault(locales[localeIndex]);
// Configuration config = resources.getConfiguration();
// config.setLocale(locales[localeIndex]);
// DisplayMetrics displayMetrics = resources.getDisplayMetrics();
// resources.updateConfiguration(config, displayMetrics);
//
//
// final String[] names = resources.getStringArray(R.array.names_for_screenshots);
// for (final String name : names) {
// new ContactsSaverBuilder(context).saveContact(ContactDataFactory.createEmpty().setCompositeName(name));
// }

mActivityTestRule.launchActivity(new Intent());

}

@Override
protected Class<ContactsActivity> activity() {
return ContactsActivity.class;
}
}
9 changes: 9 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,15 @@
<string name="everywhere">Überall</string>
<string name="share_photo">Foto weiterleiten</string>

<string-array name="names_for_screenshots">
<item>Bismarck</item>
<item>Bach</item>
<item>Mozart</item>
<item>Einstein</item>
<item>Karl Marx</item>
<item>Beethoven</item>
</string-array>

<bool name="is_right_to_left">false</bool>


Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,15 @@
<string name="your_phone_doesnt_have_assistant_installed">Vous devez installer l\'application Google Assistant pour utiliser cette fonctionnalité.</string>
<string name="share_photo">Partager Photo</string>

<string-array name="names_for_screenshots">
<item>Napoleon Bonaparte</item>
<item>Marie Antoinette</item>
<item>Louis Vitton</item>
<item>Georges Clemenceau</item>
<item>King Henry VIII</item>
<item>Gustave Eiffel</item>
</string-array>

<bool name="is_right_to_left">false</bool>

</resources>
9 changes: 9 additions & 0 deletions app/src/main/res/values-iw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,15 @@

<string name="share_photo">שיתוף תמונה</string>

<string-array name="names_for_screenshots">
<item>יונה הנביא</item>
<item>בנימין זאב הרצל</item>
<item>נורית שלם</item>
<item>עומר אדם</item>
<item>בוב הבנאי</item>
<item>יובל קוגוס</item>
</string-array>

<bool name="is_right_to_left">true</bool>

</resources>
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,12 @@


<string-array name="names_for_screenshots">
<item>Frank Jones</item>
<item>Bruce Oliver</item>
<item>Grady Mason</item>
<item>Bradley Dalton</item>
<item>Abraham Jones</item>
<item>Maurice Wilson</item>
<item>The Godfather</item>
<item>Abraham Lincoln</item>
<item>Paul McCartney</item>
<item>Tyrion Lannister</item>
<item>The Rock</item>
<item>Robert Downey Jr.</item>
</string-array>

<bool name="is_right_to_left">false</bool>
Expand Down

0 comments on commit ff2cd19

Please sign in to comment.