summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2017-01-23 11:47:51 -0800
committerTony Wickham <twickham@google.com>2017-01-25 11:21:47 -0800
commit540913eadf39f1e8632d2b6f0bc33aa635214198 (patch)
treed21e8d2212cdd053c2cca3e8f6236fb73cbe5e1e /tests
parent43a2f4297893a70ea776f306d3527f05d36c66bd (diff)
downloadandroid_packages_apps_Trebuchet-540913eadf39f1e8632d2b6f0bc33aa635214198.tar.gz
android_packages_apps_Trebuchet-540913eadf39f1e8632d2b6f0bc33aa635214198.tar.bz2
android_packages_apps_Trebuchet-540913eadf39f1e8632d2b6f0bc33aa635214198.zip
Refactor DeepShortcutsContainer to PopupContainerWithArrow
- Also added PopupItemView, which takes animation logic from DeepShortcutView, and which DeepShortcutView now extends. - Renamed ShortcutFilter to PopupPopulator, which has support for new item types (not yet used). Also moved populating logic (e.g. UpdateShortcutChild Runnable) to PopupPopulator. Bug: 32410600 Change-Id: Ib6e444ac7ca99c80ba438801c26e62d9542e0ad9
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/launcher3/popup/PopupPopulatorTest.java (renamed from tests/src/com/android/launcher3/shortcuts/ShortcutFilterTest.java)31
1 files changed, 17 insertions, 14 deletions
diff --git a/tests/src/com/android/launcher3/shortcuts/ShortcutFilterTest.java b/tests/src/com/android/launcher3/popup/PopupPopulatorTest.java
index 05d0ffb8c..0843d9b59 100644
--- a/tests/src/com/android/launcher3/shortcuts/ShortcutFilterTest.java
+++ b/tests/src/com/android/launcher3/popup/PopupPopulatorTest.java
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-package com.android.launcher3.shortcuts;
+package com.android.launcher3.popup;
import android.content.pm.ShortcutInfo;
import android.support.test.runner.AndroidJUnit4;
+import com.android.launcher3.shortcuts.ShortcutInfoCompat;
+
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -26,40 +28,41 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import static com.android.launcher3.shortcuts.ShortcutFilter.MAX_SHORTCUTS;
-import static com.android.launcher3.shortcuts.ShortcutFilter.NUM_DYNAMIC;
+import static com.android.launcher3.popup.PopupPopulator.MAX_ITEMS;
+import static com.android.launcher3.popup.PopupPopulator.NUM_DYNAMIC;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
- * Tests the sorting and filtering of shortcuts in {@link ShortcutFilter}.
+ * Tests the sorting and filtering of shortcuts in {@link PopupPopulator}.
*/
@RunWith(AndroidJUnit4.class)
-public class ShortcutFilterTest {
+public class PopupPopulatorTest {
@Test
public void testSortAndFilterShortcuts() {
filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(3, 0), 3, 0);
filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(0, 3), 0, 3);
- filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(5, 0), MAX_SHORTCUTS, 0);
- filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(0, 5), 0, MAX_SHORTCUTS);
+ filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(5, 0), MAX_ITEMS, 0);
+ filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(0, 5), 0, MAX_ITEMS);
filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(3, 3),
- MAX_SHORTCUTS - NUM_DYNAMIC, NUM_DYNAMIC);
+ MAX_ITEMS - NUM_DYNAMIC, NUM_DYNAMIC);
filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(5, 5),
- MAX_SHORTCUTS - NUM_DYNAMIC, NUM_DYNAMIC);
- filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(5, 1), MAX_SHORTCUTS - 1, 1);
- filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(1, 5), 1, MAX_SHORTCUTS - 1);
+ MAX_ITEMS - NUM_DYNAMIC, NUM_DYNAMIC);
+ filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(5, 1), MAX_ITEMS - 1, 1);
+ filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(1, 5), 1, MAX_ITEMS - 1);
filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(5, 3),
- MAX_SHORTCUTS - NUM_DYNAMIC, NUM_DYNAMIC);
+ MAX_ITEMS - NUM_DYNAMIC, NUM_DYNAMIC);
filterShortcutsAndAssertNumStaticAndDynamic(createShortcutsList(3, 5),
- MAX_SHORTCUTS - NUM_DYNAMIC, NUM_DYNAMIC);
+ MAX_ITEMS - NUM_DYNAMIC, NUM_DYNAMIC);
}
private void filterShortcutsAndAssertNumStaticAndDynamic(
List<ShortcutInfoCompat> shortcuts, int expectedStatic, int expectedDynamic) {
Collections.shuffle(shortcuts);
- List<ShortcutInfoCompat> filteredShortcuts = ShortcutFilter.sortAndFilterShortcuts(shortcuts);
+ List<ShortcutInfoCompat> filteredShortcuts = PopupPopulator.sortAndFilterShortcuts(
+ shortcuts);
assertIsSorted(filteredShortcuts);
int numStatic = 0;