<commit_before>package org.wikipedia.feed.view;

import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.view.View;

import org.junit.Test;
import org.junit.experimental.theories.Theory;
import org.junit.experimental.theories.suppliers.TestedOn;
import org.wikipedia.R;
import org.wikipedia.test.ViewTest;
import org.wikipedia.theme.Theme;

import static android.view.View.OnClickListener;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

public class CardLargeHeaderViewTest extends ViewTest {
    private CardLargeHeaderView subject;

    @Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
                                  float fontScale,
                                  @TestedOn(ints = {0, R.drawable.checkerboard}) int image,
                                  @TestedOn(ints = {0, R.string.reading_list_name_sample,
                                          R.string.gallery_save_image_write_permission_rationale}) int title) {
        setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, image, title);
        snap(subject, image == 0 ? "no_image" : "image", len(title) + "title");
    }

    @Theory public void testLayoutDirection(LayoutDirection direction) {
        setUp(WIDTH_DP_L, direction, 1, Theme.LIGHT, R.drawable.wmf_logo,
                R.string.reading_list_name_sample);
        snap(subject);
    }

    @Theory public void testTheme(Theme theme) {
        setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, theme, 0, R.string.reading_list_name_sample);
        snap(subject);
    }

    @Theory public void testFocus(Theme theme) {
        setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, theme, 0, R.string.reading_list_name_sample);
        runOnMainSync(new Runnable() {
            @Override public void run() {
                subject.requestFocus();
            }
        });
        snap(subject);
    }

    @Test public void testOnClickListener() {
        setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, Theme.LIGHT, R.drawable.checkerboard,
                R.string.reading_list_name_sample);
<commit_msg>Add missing tests to CardLargeHeaderViewTest<commit_after>package org.wikipedia.feed.view;

import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.view.View;
import android.widget.TextView;

import org.junit.Test;
import org.junit.experimental.theories.Theory;
import org.junit.experimental.theories.suppliers.TestedOn;
import org.wikipedia.R;
import org.wikipedia.test.ViewTest;
import org.wikipedia.theme.Theme;

import static android.view.View.OnClickListener;
import static butterknife.ButterKnife.findById;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.wikipedia.util.StringUtil.emptyIfNull;

public class CardLargeHeaderViewTest extends ViewTest {
    private CardLargeHeaderView subject;

    @Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
                                  float fontScale,
                                  @TestedOn(ints = {0, R.drawable.checkerboard}) int image,
                                  @TestedOn(ints = {0, R.string.reading_list_name_sample,
                                          R.string.gallery_save_image_write_permission_rationale}) int title) {
        setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, image, title);
        snap(subject, image == 0 ? "no_image" : "image", len(title) + "title");
    }

    @Theory public void testLayoutDirection(LayoutDirection direction) {
        setUp(WIDTH_DP_L, direction, 1, Theme.LIGHT, R.drawable.wmf_logo,
                R.string.reading_list_name_sample);
        snap(subject);
    }

    @Theory public void testTheme(Theme theme) {
        setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, theme, 0, R.string.reading_list_name_sample);
        snap(subject);
    }

    @Theory public void testFocus(Theme theme) {
        setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, theme, 0, R.string.reading_list_name_sample);
        runOnMainSync(new Runnable() {
            @Override public void run() {
                subject.requestFocus();
            }
        });
        snap(subject);
    }

    @Theory public void testSetImage(@TestedOn(ints = {0, R.drawable.checkerboard}) int image) {
        setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, Theme.LIGHT, image, 0);
        View imageView = findById(subject, R.id.view_card_header_large_image);
        assertThat(imageView.getVisibility(), is(image == 0 ? View.GONE : View.VISIBLE));
    }

    @Theory public void testSetTitle(@TestedOn(ints = {0,
            R.string.reading_list_name_sample}) int title) {
        setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, Theme.LIGHT, 0, title);
        TextView text = findById(subject, R.id.view_card_header_large_title);
        assertThat(text.getText().toString(), is(emptyIfNull(str(title))));
    }

    @Test public void testOnClickListener() {
        setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, Theme.LIGHT, R.drawable.checkerboard,
                R.string.reading_list_name_sample);

{'fraction_non_alphanumeric': 0.10204841713221602, 'fraction_numerical': 0.004655493482309125, 'mean_word_length': 3.075113808801214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3405659', 'n_tokens_mistral': 1654, 'n_tokens_neox': 1573, 'n_words': 313}