当前位置: 首页>>代码示例>>Java>>正文


Java SdkSuppress类代码示例

本文整理汇总了Java中android.support.test.filters.SdkSuppress的典型用法代码示例。如果您正苦于以下问题:Java SdkSuppress类的具体用法?Java SdkSuppress怎么用?Java SdkSuppress使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SdkSuppress类属于android.support.test.filters包,在下文中一共展示了SdkSuppress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPointerIcon

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@UiThreadTest
@Test
@SmallTest
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.N)
@TargetApi(Build.VERSION_CODES.N)
public void testPointerIcon() throws Throwable {
  final Activity activity = activityTestRule.getActivity();
  final PointerIcon expectedIcon = PointerIcon.getSystemIcon(activity, PointerIcon.TYPE_HAND);
  final MotionEvent event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_HOVER_MOVE, 0, 0, 0);
  final Menu menu = mBottomNavigation.getMenu();
  for (int i = 0; i < menu.size(); i++) {
    final MenuItem item = menu.getItem(i);
    assertTrue(item.isEnabled());
    final View itemView = activity.findViewById(item.getItemId());
    assertEquals(expectedIcon, itemView.onResolvePointerIcon(event, 0));
    item.setEnabled(false);
    assertEquals(null, itemView.onResolvePointerIcon(event, 0));
    item.setEnabled(true);
    assertEquals(expectedIcon, itemView.onResolvePointerIcon(event, 0));
  }
}
 
开发者ID:material-components,项目名称:material-components-android,代码行数:22,代码来源:BottomNavigationViewTest.java

示例2: orientationChange_DuringEdit_ChangePersists

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@Test
@SdkSuppress(minSdkVersion = 21) // Blinking cursor after rotation breaks this in API 19
public void orientationChange_DuringEdit_ChangePersists() throws Throwable {
    // Add a completed task
    createTask(TITLE1, DESCRIPTION);

    // Open the task in details view
    onView(withText(TITLE1)).perform(click());

    // Click on the edit task button
    onView(withId(R.id.fab_edit_task)).perform(click());

    // Change task title (but don't save)
    onView(withId(R.id.add_task_title))
            .perform(replaceText(TITLE2), closeSoftKeyboard()); // Type new task title

    // Rotate the screen
    TestUtils.rotateOrientation(getCurrentActivity());

    // Verify task title is restored
    onView(withId(R.id.add_task_title)).check(matches(withText(TITLE2)));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:TasksScreenTest.java

示例3: createNotification_withBigTextStyle_withTitleAndBody

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@Test
@SdkSuppress(minSdkVersion = LOLLIPOP)
public void createNotification_withBigTextStyle_withTitleAndBody() {
    Map<String, String> input = new HashMap<>();
    input.put("title", TITLE);
    input.put("body", BODY);

    android.app.Notification result = MessagingServiceUtils.createNotification(context, input, disabledOreoConfig);

    assertEquals(TITLE, result.extras.getString(NotificationCompat.EXTRA_TITLE));
    assertEquals(TITLE, result.extras.getString(NotificationCompat.EXTRA_TITLE_BIG));
    assertEquals(BODY, result.extras.getString(NotificationCompat.EXTRA_TEXT));
    assertEquals(BODY, result.extras.getString(NotificationCompat.EXTRA_BIG_TEXT));

    assertNull(result.extras.getString(NotificationCompat.EXTRA_SUMMARY_TEXT));
}
 
开发者ID:emartech,项目名称:android-mobile-engage-sdk,代码行数:17,代码来源:MessagingServiceUtilsTest.java

示例4: createNotification_withBigTextStyle_withoutTitle_withBody

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@Test
@SdkSuppress(minSdkVersion = LOLLIPOP)
public void createNotification_withBigTextStyle_withoutTitle_withBody() {
    Map<String, String> input = new HashMap<>();
    input.put("body", BODY);

    android.app.Notification result = MessagingServiceUtils.createNotification(context, input, disabledOreoConfig);

    String expectedTitle = expectedBasedOnApiLevel(getApplicationName(), "");

    assertEquals(expectedTitle, result.extras.getString(NotificationCompat.EXTRA_TITLE));
    assertEquals(expectedTitle, result.extras.getString(NotificationCompat.EXTRA_TITLE_BIG));
    assertEquals(BODY, result.extras.getString(NotificationCompat.EXTRA_TEXT));
    assertEquals(BODY, result.extras.getString(NotificationCompat.EXTRA_BIG_TEXT));

    assertNull(result.extras.getString(NotificationCompat.EXTRA_SUMMARY_TEXT));
}
 
开发者ID:emartech,项目名称:android-mobile-engage-sdk,代码行数:18,代码来源:MessagingServiceUtilsTest.java

示例5: createNotification_withBigTextStyle_withoutTitle_withBody_withDefaultTitle

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@Test
@SdkSuppress(minSdkVersion = LOLLIPOP)
public void createNotification_withBigTextStyle_withoutTitle_withBody_withDefaultTitle() {
    Map<String, String> input = new HashMap<>();
    input.put("body", BODY);
    input.put("u", "{\"test_field\":\"\",\"ems_default_title\":\"" + DEFAULT_TITLE + "\",\"image\":\"https:\\/\\/media.giphy.com\\/media\\/ktvFa67wmjDEI\\/giphy.gif\",\"deep_link\":\"lifestylelabels.com\\/mobile\\/product\\/3245678\",\"sid\":\"sid_here\"}");

    android.app.Notification result = MessagingServiceUtils.createNotification(context, input, disabledOreoConfig);

    String expectedTitle = expectedBasedOnApiLevel(DEFAULT_TITLE, "");

    assertEquals(expectedTitle, result.extras.getString(NotificationCompat.EXTRA_TITLE));
    assertEquals(expectedTitle, result.extras.getString(NotificationCompat.EXTRA_TITLE_BIG));
    assertEquals(BODY, result.extras.getString(NotificationCompat.EXTRA_TEXT));
    assertEquals(BODY, result.extras.getString(NotificationCompat.EXTRA_BIG_TEXT));

    assertNull(result.extras.getString(NotificationCompat.EXTRA_SUMMARY_TEXT));
}
 
开发者ID:emartech,项目名称:android-mobile-engage-sdk,代码行数:19,代码来源:MessagingServiceUtilsTest.java

示例6: testCreateNotification_withBigPictureStyle_whenImageIsAvailable

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@Test
@SdkSuppress(minSdkVersion = LOLLIPOP)
public void testCreateNotification_withBigPictureStyle_whenImageIsAvailable() {
    Map<String, String> input = new HashMap<>();
    input.put("title", TITLE);
    input.put("body", BODY);
    input.put("image_url", "https://ems-denna.herokuapp.com/images/Emarsys.png");

    android.app.Notification result = MessagingServiceUtils.createNotification(context, input, disabledOreoConfig);

    assertEquals(TITLE, result.extras.getString(NotificationCompat.EXTRA_TITLE));
    assertEquals(TITLE, result.extras.getString(NotificationCompat.EXTRA_TITLE_BIG));
    assertEquals(BODY, result.extras.getString(NotificationCompat.EXTRA_SUMMARY_TEXT));

    assertNotNull(result.extras.get(NotificationCompat.EXTRA_PICTURE));
    assertNotNull(result.extras.get(NotificationCompat.EXTRA_LARGE_ICON));

    assertNull(result.extras.get(NotificationCompat.EXTRA_LARGE_ICON_BIG));
}
 
开发者ID:emartech,项目名称:android-mobile-engage-sdk,代码行数:20,代码来源:MessagingServiceUtilsTest.java

示例7: testCreateNotification_withBigTextStyle_whenImageCannotBeLoaded

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@Test
@SdkSuppress(minSdkVersion = LOLLIPOP)
public void testCreateNotification_withBigTextStyle_whenImageCannotBeLoaded() {
    Map<String, String> input = new HashMap<>();
    input.put("title", TITLE);
    input.put("body", BODY);
    input.put("image_url", "https://fa.il/img.jpg");

    android.app.Notification result = MessagingServiceUtils.createNotification(context, input, disabledOreoConfig);

    assertEquals(TITLE, result.extras.getString(NotificationCompat.EXTRA_TITLE));
    assertEquals(TITLE, result.extras.getString(NotificationCompat.EXTRA_TITLE_BIG));
    assertEquals(BODY, result.extras.getString(NotificationCompat.EXTRA_TEXT));
    assertEquals(BODY, result.extras.getString(NotificationCompat.EXTRA_BIG_TEXT));

    assertNull(result.extras.getString(NotificationCompat.EXTRA_SUMMARY_TEXT));
}
 
开发者ID:emartech,项目名称:android-mobile-engage-sdk,代码行数:18,代码来源:MessagingServiceUtilsTest.java

示例8: testCreateNotification_withChannelId

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@Test
@SdkSuppress(minSdkVersion = O)
public void testCreateNotification_withChannelId() {
    Map<String, String> input = new HashMap<>();
    input.put("title", TITLE);
    input.put("body", BODY);
    input.put("channel_id", CHANNEL_ID);

    android.app.Notification result = MessagingServiceUtils.createNotification(context, input, disabledOreoConfig);

    assertEquals(CHANNEL_ID, result.getChannelId());
}
 
开发者ID:emartech,项目名称:android-mobile-engage-sdk,代码行数:13,代码来源:MessagingServiceUtilsTest.java

示例9: testCreateChannel_overridesPrevious

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@Test
@SdkSuppress(minSdkVersion = O)
public void testCreateChannel_overridesPrevious(){
    NotificationManager manager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    manager.deleteNotificationChannel("ems_me_default");
    assertNull(manager.getNotificationChannel("ems_me_default"));
    MessagingServiceUtils.createDefaultChannel(context, enabledOreoConfig);
    NotificationChannel channel = manager.getNotificationChannel("ems_me_default");
    assertNotNull(channel);

    OreoConfig updatedConfig = new OreoConfig(true, "updatedName", "updatedDescription");
    MessagingServiceUtils.createDefaultChannel(context, updatedConfig);

    NotificationChannel updatedChannel = manager.getNotificationChannel("ems_me_default");
    assertEquals(updatedConfig.getDefaultChannelName(), updatedChannel.getName());
    assertEquals(updatedConfig.getDefaultChannelDescription(), updatedChannel.getDescription());
}
 
开发者ID:emartech,项目名称:android-mobile-engage-sdk,代码行数:18,代码来源:MessagingServiceUtilsTest.java

示例10: executeUpdateDeleteAndTrigger

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.HONEYCOMB)
@Test public void executeUpdateDeleteAndTrigger() {
  SQLiteStatement statement = real.compileStatement(
      "UPDATE " + TABLE_EMPLOYEE + " SET " + NAME + " = 'Zach'");

  db.createQuery(TABLE_EMPLOYEE, SELECT_EMPLOYEES).subscribe(o);
  o.assertCursor()
      .hasRow("alice", "Alice Allison")
      .hasRow("bob", "Bob Bobberson")
      .hasRow("eve", "Eve Evenson")
      .isExhausted();

  db.executeUpdateDelete(TABLE_EMPLOYEE, statement);
  o.assertCursor()
      .hasRow("alice", "Zach")
      .hasRow("bob", "Zach")
      .hasRow("eve", "Zach")
      .isExhausted();
}
 
开发者ID:jiechic,项目名称:sqlbrite-sqlcipher,代码行数:21,代码来源:BriteDatabaseTest.java

示例11: executeUpdateDeleteAndDontTrigger

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.HONEYCOMB)
@Test public void executeUpdateDeleteAndDontTrigger() {
  SQLiteStatement statement = real.compileStatement(""
      + "UPDATE " + TABLE_EMPLOYEE
      + " SET " + NAME + " = 'Zach'"
      + " WHERE " + NAME + " = 'Rob'");

  db.createQuery(TABLE_EMPLOYEE, SELECT_EMPLOYEES).subscribe(o);
  o.assertCursor()
      .hasRow("alice", "Alice Allison")
      .hasRow("bob", "Bob Bobberson")
      .hasRow("eve", "Eve Evenson")
      .isExhausted();

  db.executeUpdateDelete(TABLE_EMPLOYEE, statement);
  o.assertNoMoreEvents();
}
 
开发者ID:jiechic,项目名称:sqlbrite-sqlcipher,代码行数:19,代码来源:BriteDatabaseTest.java

示例12: executeUpdateDeleteAndTriggerWithNoTables

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.HONEYCOMB)
@Test public void executeUpdateDeleteAndTriggerWithNoTables() {
  SQLiteStatement statement = real.compileStatement(
      "UPDATE " + TABLE_EMPLOYEE + " SET " + NAME + " = 'Zach'");

  db.createQuery(TABLE_EMPLOYEE, SELECT_EMPLOYEES).subscribe(o);
  o.assertCursor()
      .hasRow("alice", "Alice Allison")
      .hasRow("bob", "Bob Bobberson")
      .hasRow("eve", "Eve Evenson")
      .isExhausted();

  db.executeUpdateDelete(Collections.<String>emptySet(), statement);

  o.assertNoMoreEvents();
}
 
开发者ID:jiechic,项目名称:sqlbrite-sqlcipher,代码行数:18,代码来源:BriteDatabaseTest.java

示例13: executeUpdateDeleteThrowsAndDoesNotTrigger

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.HONEYCOMB)
@Test public void executeUpdateDeleteThrowsAndDoesNotTrigger() {
  SQLiteStatement statement = real.compileStatement(
      "UPDATE " + TABLE_EMPLOYEE + " SET " + USERNAME + " = 'alice'");

  db.createQuery(TABLE_EMPLOYEE, SELECT_EMPLOYEES)
      .skip(1) // Skip initial
      .subscribe(o);

  try {
    db.executeUpdateDelete(TABLE_EMPLOYEE, statement);
    fail();
  } catch (SQLException ignored) {
  }
  o.assertNoMoreEvents();
}
 
开发者ID:jiechic,项目名称:sqlbrite-sqlcipher,代码行数:18,代码来源:BriteDatabaseTest.java

示例14: executeUpdateDeleteWithArgsAndTrigger

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.HONEYCOMB)
@Test public void executeUpdateDeleteWithArgsAndTrigger() {
  SQLiteStatement statement = real.compileStatement(
      "UPDATE " + TABLE_EMPLOYEE + " SET " + NAME + " = ?");
  statement.bindString(1, "Zach");

  db.createQuery(TABLE_EMPLOYEE, SELECT_EMPLOYEES).subscribe(o);
  o.assertCursor()
      .hasRow("alice", "Alice Allison")
      .hasRow("bob", "Bob Bobberson")
      .hasRow("eve", "Eve Evenson")
      .isExhausted();

  db.executeUpdateDelete(TABLE_EMPLOYEE, statement);
  o.assertCursor()
      .hasRow("alice", "Zach")
      .hasRow("bob", "Zach")
      .hasRow("eve", "Zach")
      .isExhausted();
}
 
开发者ID:jiechic,项目名称:sqlbrite-sqlcipher,代码行数:22,代码来源:BriteDatabaseTest.java

示例15: executeUpdateDeleteWithArgsThrowsAndDoesNotTrigger

import android.support.test.filters.SdkSuppress; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.HONEYCOMB)
@Test public void executeUpdateDeleteWithArgsThrowsAndDoesNotTrigger() {
  SQLiteStatement statement = real.compileStatement(
      "UPDATE " + TABLE_EMPLOYEE + " SET " + USERNAME + " = ?");
  statement.bindString(1, "alice");

  db.createQuery(TABLE_EMPLOYEE, SELECT_EMPLOYEES)
      .skip(1) // Skip initial
      .subscribe(o);

  try {
    db.executeUpdateDelete(TABLE_EMPLOYEE, statement);
    fail();
  } catch (SQLException ignored) {
  }
  o.assertNoMoreEvents();
}
 
开发者ID:jiechic,项目名称:sqlbrite-sqlcipher,代码行数:19,代码来源:BriteDatabaseTest.java


注:本文中的android.support.test.filters.SdkSuppress类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。