diff options
Diffstat (limited to 'tests/src/org/cyanogenmod')
3 files changed, 49 insertions, 0 deletions
diff --git a/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java b/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java index 20c9809..38ddca8 100644 --- a/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java +++ b/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java @@ -148,6 +148,21 @@ public class CMStatusBarTest extends TestActivity { } }, + new Test("test publish tile with long press") { + public void run() { + CustomTile customTile = new CustomTile.Builder(CMStatusBarTest.this) + .setLabel("Test Long press From SDK") + .setIcon(R.drawable.ic_launcher) + .setOnLongClickIntent(PendingIntent.getActivity(CMStatusBarTest.this, 0, + new Intent(CMStatusBarTest.this,DummySettings.class) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0)) + .setContentDescription("Content description") + .build(); + CMStatusBarManager.getInstance(CMStatusBarTest.this) + .publishTile(CUSTOM_TILE_SETTINGS_ID, customTile); + } + }, + new Test("test publish tile with delete intent") { public void run() { Intent intent = new Intent(CMStatusBarTest.this, DummySettings.class); diff --git a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java index 128ef77..5d20136 100644 --- a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java +++ b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java @@ -58,6 +58,17 @@ public class CustomTileBuilderTest extends AndroidTestCase { } @SmallTest + public void testCustomTileBuilderOnLongClickIntent() { + Intent intent = new Intent(Intent.ACTION_DIAL); + PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0); + CustomTile customTile = new CustomTile.Builder(mContext) + .setOnLongClickIntent(pendingIntent) + .build(); + assertNotNull(customTile.onLongClick); + assertEquals(pendingIntent, customTile.onLongClick); + } + + @SmallTest public void testCustomTileBuilderOnSettingsClickIntent() { Intent intent = new Intent(mContext, DummySettings.class); CustomTile customTile = new CustomTile.Builder(mContext) diff --git a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileTest.java b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileTest.java index b724550..ca04f56 100644 --- a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileTest.java +++ b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileTest.java @@ -65,6 +65,29 @@ public class CustomTileTest extends AndroidTestCase { } @SmallTest + public void testCustomTileOnLongiClickIntentUnravelFromParcel() { + Intent intent = new Intent(Intent.ACTION_DIAL); + PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0); + CustomTile expectedCustomTile = new CustomTile.Builder(mContext) + .setOnLongClickIntent(pendingIntent) + .build(); + + // Write to parcel + Parcel parcel = Parcel.obtain(); + expectedCustomTile.writeToParcel(parcel, 0); + + // Rewind + parcel.setDataPosition(0); + + // Verify data when unraveling + CustomTile fromParcel = CustomTile.CREATOR.createFromParcel(parcel); + + assertNotNull(fromParcel.onLongClick); + assertEquals(expectedCustomTile.onLongClick.getIntent().toString(), + fromParcel.onLongClick.getIntent().toString()); + } + + @SmallTest public void testCustomTileOnSettingsClickIntentUnravelFromParcel() { Intent intent = new Intent(mContext, DummySettings.class); CustomTile expectedCustomTile = new CustomTile.Builder(mContext) |