Browse Source
* commit 'd5388b0040c7c991e6a48e321d22d9bcdb8c5074': REPORT-29149 基础控件-复选下拉列表可不显示“全选”research/11.0
Hades
5 years ago
2 changed files with 51 additions and 5 deletions
@ -0,0 +1,41 @@
|
||||
package com.fr.design.gui.icombocheckbox; |
||||
|
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.TreeMap; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/4/3 |
||||
*/ |
||||
public class UICheckListPopupTest extends TestCase { |
||||
|
||||
@Test |
||||
public void testGetSelectedValues() { |
||||
Object[] values = new Object[]{"a", "b", "c"}; |
||||
Map<Object, Boolean> map = new TreeMap<>(); |
||||
map.put("a", true); |
||||
map.put("b", false); |
||||
map.put("c", true); |
||||
List<Object> list = new ArrayList<>(); |
||||
for (Map.Entry<Object, Boolean> entry : map.entrySet()) { |
||||
if (entry.getValue()) { |
||||
list.add(entry.getKey()); |
||||
} |
||||
} |
||||
Object[] selectValues = list.toArray(); |
||||
UICheckListPopup uiCheckListPopup1 = new UICheckListPopup(values); |
||||
uiCheckListPopup1.setSelectedValue(map); |
||||
Assert.assertArrayEquals(selectValues, uiCheckListPopup1.getSelectedValues()); |
||||
UICheckListPopup uiCheckListPopup2 = new UICheckListPopup(values, false); |
||||
uiCheckListPopup2.setSelectedValue(map); |
||||
Assert.assertArrayEquals(selectValues, uiCheckListPopup2.getSelectedValues()); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue