Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
272,200 | void (int expected, JLabel label) { int actual = 0; for (PropertyChangeListener listener : label.getPropertyChangeListeners("font")) { if (listener instanceof RelativeFont) { actual++; } } assertEquals(expected, actual); } | checkInstallUninstall |
272,201 | void () { checkMonospaced(toMonospaced(new Font(Font.DIALOG, Font.PLAIN, 12), false)); } | testFamily |
272,202 | void (Font font) { assertSame(font, toMonospaced(font, true)); } | checkMonospaced |
272,203 | Font (Font font, boolean monospaced) { FontMetrics fm = new JLabel().getFontMetrics(font); assertEquals(monospaced, fm.charWidth('i') == fm.charWidth('m')); return MONOSPACED_FONT.derive(font); } | toMonospaced |
272,204 | void () { checkFontStyle(Font.PLAIN); } | testStylePlain |
272,205 | void () { checkFontStyle(Font.BOLD); } | testStyleBold |
272,206 | void () { checkFontStyle(Font.ITALIC); } | testStyleItalic |
272,207 | void () { checkFontStyle(Font.BOLD | Font.ITALIC); } | testStyleBoldItalic |
272,208 | void (int style) { Font font = new Font(Font.DIALOG, style, 12); assertSame(font, RelativeFont.NORMAL.derive(font)); assertEquals(Font.PLAIN, RelativeFont.PLAIN.derive(font).getStyle()); assertEquals(Font.BOLD, RelativeFont.BOLD.derive(font).getStyle()); assertEquals(Font.ITALIC, RelativeFont.ITALIC.derive(font).getStyle()); assertEquals(Font.BOLD | Font.ITALIC, BOLD_ITALIC_FONT.derive(font).getStyle()); } | checkFontStyle |
272,209 | void () { checkFontSize(12, 10, 11, 13, 14); } | testSize12 |
272,210 | void () { checkFontSize(16, 13, 15, 17, 19); } | testSize16 |
272,211 | void () { checkFontSize(24, 20, 22, 26, 29); } | testSize24 |
272,212 | void () { checkFontSize(32, 27, 29, 35, 38); } | testSize32 |
272,213 | void (int size, int tiny, int small, int large, int huge) { Font font = new Font(Font.DIALOG, Font.PLAIN, size); assertEquals(tiny, RelativeFont.TINY.derive(font).getSize()); assertEquals(small, RelativeFont.SMALL.derive(font).getSize()); assertEquals(large, RelativeFont.LARGE.derive(font).getSize()); assertEquals(huge, RelativeFont.HUGE.derive(font).getSize()); } | checkFontSize |
272,214 | void () { JLabel label = new JLabel(); label.setFont(new Font(Font.DIALOG, Font.PLAIN, 12)); MONOSPACED_FONT.install(label); checkAutoUpdate(label.getFont(), Font.PLAIN, 12); label.setFont(new Font(Font.DIALOG, Font.BOLD, 16)); checkAutoUpdate(label.getFont(), Font.BOLD, 16); } | testAutoUpdate |
272,215 | void () { JLabel label = new JLabel(); label.setFont(new Font(Font.DIALOG, Font.PLAIN, 12)); BOLD_ITALIC_FONT.install(label); MONOSPACED_FONT.install(label); // modifies bold-italic font checkAutoUpdate(label.getFont(), Font.BOLD | Font.ITALIC, 12); label.setFont(new Font(Font.DIALOG, Font.BOLD, 16)); checkAutoUpdate(label.getFont(), Font.BOLD, 16); } | testAutoUpdateClash |
272,216 | void (Font font, int style, int size) { checkMonospaced(font); assertEquals(style, font.getStyle()); assertEquals(size, font.getSize()); } | checkAutoUpdate |
272,217 | void () { myPolicy = FilePathSplittingPolicy.SPLIT_BY_LETTER; @NonNls String[] expectedStrings = { "t", "xt", "txt", ".txt", "e.txt", "le.txt", "ile.txt", "file.txt", ".file.txt", "..file.txt", "...file.txt", "c...file.txt", "c.../file.txt", "c:.../file.txt", "c:...4/file.txt", "c:/...4/file.txt", "c:/...r4/file.txt", "c:/d...r4/file.txt", "c:/d...ir4/file.txt", "c:/di...ir4/file.txt", "c:/di...dir4/file.txt", "c:/dir...dir4/file.txt", "c:/dir.../dir4/file.txt", "c:/dir1.../dir4/file.txt", "c:/dir1/...3/dir4/file.txt", "c:/dir1/...r3/dir4/file.txt", "c:/dir1/d...r3/dir4/file.txt", "c:/dir1/d...ir3/dir4/file.txt", "c:/dir1/di...ir3/dir4/file.txt", "c:/dir1/dir2/dir3/dir4/file.txt" }; for (String expectedString : expectedStrings) { doTest(expectedString, expectedString.length()); } } | testSplitByLetter |
272,218 | void () { myPolicy = FilePathSplittingPolicy.SPLIT_BY_SEPARATOR; @NonNls String[] expectedStrings = { "...", "...", "...", "...", "...", "...", "...", "file.txt", "file.txt", "file.txt", "...file.txt", "...file.txt", "c:...file.txt", "c:.../file.txt", "c:/.../file.txt", "c:/.../file.txt", "c:/.../file.txt", "c:/.../file.txt", "c:/...dir4/file.txt", "c:/...dir4/file.txt", "c:/...dir4/file.txt", "c:/...dir4/file.txt", "c:/dir1...dir4/file.txt", "c:/dir1.../dir4/file.txt", "c:/dir1/.../dir4/file.txt", "c:/dir1/.../dir4/file.txt", "c:/dir1/.../dir4/file.txt", "c:/dir1/.../dir4/file.txt", "c:/dir1/...dir3/dir4/file.txt", "c:/dir1/...dir3/dir4/file.txt", "c:/dir1/dir2/dir3/dir4/file.txt" }; for (int i = 0; i < expectedStrings.length; i++) { int count = i + 1; String expectedString = expectedStrings[i]; assertTrue(expectedString, expectedString.length() <= count || i < 3); doTest(expectedString, count); } } | testSplitByFileSeparator |
272,219 | void () { myPolicy = FilePathSplittingPolicy.SPLIT_BY_SEPARATOR; PlatformTestUtil.startPerformanceTest("FileNameSplitting", 70, () -> { for (int i = 0; i < 100; i++) { for (int j = 0; j < FILE.getPath().length(); j++) myPolicy.getPresentableName(FILE, j); } }).assertTiming(); } | testPerformance |
272,220 | void (String expected, int count) { assertEquals(expected.replace('/', File.separatorChar), myPolicy.getPresentableName(FILE, count)); } | doTest |
272,221 | void () { myModel.setAll(new String[]{"5", "0", "9"}); assertThat(myModel.getItems()).containsExactly("0", "5", "9"); assertEquals(1, myModel.add("3")); assertEquals(1, myModel.add("3")); assertThat(myModel.addAll(new String[]{"7", "4", "4", "1"})).containsExactly(7, 5, 4, 1); assertThat(myModel.getItems()).containsExactly("0", "1", "3", "3", "4", "4", "5", "7", "9"); } | testAdding |
272,222 | void () { myModel.setAll(new String[]{"1", "2", "3", "4"}); assertThat(ContainerUtil.collect(myModel.iterator())).isEqualTo(myModel.getItems()); } | testAccessingViaIterator |
272,223 | void () { myModel.setAll(new String[]{"1", "2", "3", "4"}); Iterator iterator = myModel.iterator(); final IntList removed = new IntArrayList(); myModel.addListDataListener(new ListDataListener() { @Override public void contentsChanged(ListDataEvent e) { throw new RuntimeException(); } @Override public void intervalAdded(ListDataEvent e) { throw new RuntimeException(); } @Override public void intervalRemoved(ListDataEvent e) { assertEquals(e.getIndex0(), e.getIndex1()); removed.add(e.getIndex0()); } }); iterator.next(); iterator.remove(); assertEquals(1, removed.size()); assertEquals(0, removed.getInt(0)); while (iterator.hasNext()) iterator.next(); assertFalse(iterator.hasNext()); iterator.remove(); assertEquals(2, removed.size()); assertEquals(2, removed.getInt(1)); assertThat(myModel.getItems()).containsExactly("2", "3"); } | testRemoveViaIterator |
272,224 | void (ListDataEvent e) { throw new RuntimeException(); } | contentsChanged |
272,225 | void (ListDataEvent e) { throw new RuntimeException(); } | intervalAdded |
272,226 | void (ListDataEvent e) { assertEquals(e.getIndex0(), e.getIndex1()); removed.add(e.getIndex0()); } | intervalRemoved |
272,227 | void () { CompositeAppearance appearance = new CompositeAppearance(); appearance.getEnding().addText("abc", ATTRIBUTES); assertEquals("abc", appearance.getText()); appearance.getEnding().addText("comment", ATTRIBUTES); assertEquals("abccomment", appearance.getText()); appearance.getEnding().addText("text", ATTRIBUTES); assertEquals("abccommenttext", appearance.getText()); appearance.getBeginning().addText("123", ATTRIBUTES); assertEquals("123abccommenttext", appearance.getText()); } | testGetText |
272,228 | void () { CompositeAppearance appearance1 = new CompositeAppearance(); CompositeAppearance appearance2 = new CompositeAppearance(); checkEquals(appearance1, appearance2); appearance1.getEnding().addText("abc", ATTRIBUTES); assertNotEquals(appearance1, appearance2); appearance2.getEnding().addText("abc", ATTRIBUTES); checkEquals(appearance1, appearance2); appearance1.getEnding().addText("123", new TextAttributes(null, null, null, null, Font.PLAIN)); assertNotEquals(appearance1, appearance2); appearance2.getEnding().addText("123", ATTRIBUTES); assertNotEquals(appearance1, appearance2); } | testEquals |
272,229 | void () { CompositeAppearance appearance = new CompositeAppearance(); appearance.getEnding().addText("a", ATTRIBUTES); appearance.getSuffix().addText("c", ATTRIBUTES); assertEquals("ac", appearance.getText()); appearance.getEnding().addText("b", ATTRIBUTES); assertEquals("abc", appearance.getText()); appearance.getBeginning().addText("0", ATTRIBUTES); assertEquals("0abc", appearance.getText()); } | testSuffix |
272,230 | void () { CompositeAppearance appearance = new CompositeAppearance(); appearance.getEnding().addText("c", ATTRIBUTES); appearance.getBeginning().addText("b", ATTRIBUTES); assertEquals("bc", appearance.getText()); appearance.getSuffix().addText("d", ATTRIBUTES); assertEquals("bcd", appearance.getText()); appearance.getBeginning().addText("a", ATTRIBUTES); assertEquals("abcd", appearance.getText()); } | testInsertTextAtStart |
272,231 | void () { CompositeAppearance appearance = new CompositeAppearance(); appearance.getEnding().addText(null, (TextAttributes)null); assertEquals(0, appearance.getText().length()); appearance.getEnding().addText(null, (TextAttributes)null); assertEquals(0, appearance.getText().length()); } | testAppendText |
272,232 | void (CompositeAppearance appearance1, CompositeAppearance appearance2) { assertEquals(appearance1, appearance2); assertEquals(appearance1.hashCode(), appearance2.hashCode()); } | checkEquals |
272,233 | boolean (Object node) { return getChildCount(node) == 0; } | isLeaf |
272,234 | void (TreePath path, Object newValue) { } | valueForPathChanged |
272,235 | void (TreeModelListener l) { } | addTreeModelListener |
272,236 | void (TreeModelListener l) { } | removeTreeModelListener |
272,237 | int (Object[] children, Object child) { return ArrayUtil.indexOfIdentity(children, child); } | getIndex |
272,238 | void () { final MyWidthCalculator calculator = new MyWidthCalculator(); testString("this is just a test", "this is just a test", calculator); testString("this is just a test", "this is just a ", calculator); testString("dark side of the moon", "dark side of th", calculator); testString("my width calculator", "my", calculator); } | testVariants |
272,239 | void (final String string, final String truncated, MyWidthCalculator calculator) { int width = calculator.stringWidth(truncated); final boolean equals = string.equals(truncated); if (equals) { width += calculator.stringWidth(SwingHelper.ERROR_STR); } else { width += calculator.stringWidth(SwingHelper.ELLIPSIS) + calculator.stringWidth(SwingHelper.ERROR_STR); } final String result = SwingHelper.truncateStringWithEllipsis(string, width, calculator); if (equals) Assert.assertEquals(truncated, result); else Assert.assertEquals(truncated + SwingHelper.ELLIPSIS, result); } | testString |
272,240 | int (String s) { int result = 0; for (int i = 0; i < s.length(); i++) { result += charWidth(s.charAt(i)); } return result; } | stringWidth |
272,241 | int (char c) { final Integer integer = myMap.get(c); return integer == null ? DEFAULT : integer; } | charWidth |
272,242 | void () { TestScaleHelper.setSystemProperty("idea.measure.icon.load.time", "true"); TestScaleHelper.setSystemProperty("idea.ui.icons.svg.disk.cache", "false"); } | setState |
272,243 | void () { TestScaleHelper.restoreSystemProperties(); TestScaleHelper.restoreRegistryProperties(); } | restoreState |
272,244 | void () { assertMerge(new String[]{"a", "b", "c", "d"}, 0, 0, "a"); } | testSelectionKeptSingleItem |
272,245 | void () { assertMerge(ArrayUtilRt.EMPTY_STRING_ARRAY, "a", "b", "c", "d"); } | testNoSelectionAfterReplacingAllItems |
272,246 | void () { assertMerge(new String[]{"a", "b", "c", "d"}, 0, -1 /* nothing */); } | testNoSelectionNoItems |
272,247 | void () { assertMerge(new String[]{"a", "b", "c", "d"}, 2, 2, "a", "b", "c", "d"); } | testSelectionKeptIdenticalItems |
272,248 | void () { assertMerge(new String[]{"a", "b", "c", "d"}, "d", "c", "b", "a"); } | testListModelMerge5 |
272,249 | void () { assertMerge(new String[]{"a", "b", "c", "d"}, 0, 3, "d", "c", "b", "a"); } | testListModelMerge5_1 |
272,250 | void () { assertMerge(new String[]{"a", "b", "c", "d"}, 3, 0, "d", "c", "b", "a"); } | testListModelMerge5_2 |
272,251 | void () { assertMerge(new String[]{"a", "b", "c", "d"}, 2, 1, "b", "c"); } | testSelectionItemKeptItemsLessAndMovedUp |
272,252 | void () { assertMerge(new String[]{"a", "b", "c", "d"}, 1, 0, "b", "c", "d", "e"); } | testSelectionItemKeptItemsMovedUp |
272,253 | void () { assertMerge(new String[]{"a", "a", "b", "b"}, "b", "a", "b", "a"); } | testListModelMerge8 |
272,254 | void () { assertMerge(new String[]{"a", "b"}, 1, 3, "e", "d", "a", "b"); } | testSelectionItemKeptItemsMovedDown |
272,255 | void () { assertMerge(new String[]{"a", "b"}, 0, -1, "c", "d"); } | testNoSelectionDisjointItems |
272,256 | void (String[] initialItems, String... itemsToMerge) { assertMerge(initialItems, -1, -1, itemsToMerge); } | assertMerge |
272,257 | void (String[] initialItems, int initialSelectionIdx, int selectionIndexAfterMerge, String... itemsToMerge) { final StringFinderRecursivePanel panel = createStringPanel(initialItems); disposeOnTearDown(panel); JBList<String> list = panel.getList(); CollectionListModel<String> model = panel.getListModel(); list.setSelectedIndex(initialSelectionIdx); ListSelectionListener selectionListener = new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (panel.isMergeListItemsRunning()) return; fail("selection changed"); } }; list.addListSelectionListener(selectionListener); panel.merge(model, list, Arrays.asList(itemsToMerge)); assertEquals(itemsToMerge.length, model.getSize()); for (int i = 0; i < itemsToMerge.length; i++) { assertEquals("idx:" + i + " " + toString(model.getItems(), ","), itemsToMerge[i], model.getElementAt(i)); } assertEquals(toString(model.getItems(), ","), selectionIndexAfterMerge, list.getSelectedIndex()); list.removeListSelectionListener(selectionListener); } | assertMerge |
272,258 | void (ListSelectionEvent e) { if (panel.isMergeListItemsRunning()) return; fail("selection changed"); } | valueChanged |
272,259 | StringFinderRecursivePanel (String[] initialItems) { StringFinderRecursivePanel panel = new StringFinderRecursivePanel(initialItems, getProject()); panel.initPanel(); return panel; } | createStringPanel |
272,260 | List<String> () { return Arrays.asList(myInitialItems); } | getListItems |
272,261 | String (@NotNull String s) { return ""; } | getItemText |
272,262 | boolean (@NotNull String s) { return false; } | hasChildren |
272,263 | JBList<String> () { return myList; } | getList |
272,264 | CollectionListModel<String> () { return myListModel; } | getListModel |
272,265 | JBList<String> () { myList = super.createList(); ((CollectionListModel<String>)myList.getModel()).replaceAll(getListItems()); return myList; } | createList |
272,266 | void (@NotNull CollectionListModel<String> listModel, @NotNull JList<String> list, @NotNull List<String> newItems) { mergeListItems(listModel, list, newItems); } | merge |
272,267 | void () { StringFinderRecursivePanel panel_0 = new StringFinderRecursivePanel(getProject()); disposeOnTearDown(panel_0); panel_0.setTestSelectedIndex(0); final StringFinderRecursivePanel panel_1 = new StringFinderRecursivePanel(panel_0); panel_1.setTestSelectedIndex(1); final StringFinderRecursivePanel panel_2 = new StringFinderRecursivePanel(panel_1); panel_2.setTestSelectedIndex(2); final StringFinderRecursivePanel panel_3 = new StringFinderRecursivePanel(panel_2); panel_3.setTestSelectedIndex(3); panel_0.updatePanel(); assertEquals("a", panel_0.getSelectedValue()); assertEquals("b", panel_1.getSelectedValue()); assertEquals("c", panel_2.getSelectedValue()); assertEquals("d", panel_3.getSelectedValue()); } | testUpdate |
272,268 | List<String> () { return Arrays.asList("a", "b", "c", "d"); } | getListItems |
272,269 | String (@NotNull String s) { return s; } | getItemText |
272,270 | boolean (@NotNull String s) { return true; } | hasChildren |
272,271 | JComponent (@NotNull String s) { return null; } | createRightComponent |
272,272 | JBList<String> () { myTestList = super.createList(); ((CollectionListModel<String>)myTestList.getModel()).replaceAll(getListItems()); return myTestList; } | createList |
272,273 | void (int index) { myTestList.setSelectedIndex(index); } | setTestSelectedIndex |
272,274 | boolean () { return true; } | isIconRequired |
272,275 | void () { VirtualFile file = getTempDir().createVirtualFile(".txt", "hkjh"); Icon icon = IconUtil.getIcon(file, Iconable.ICON_FLAG_VISIBILITY, getProject()); assertTrue(icon instanceof DeferredIcon); Graphics g = IconTestUtil.createMockGraphics(); // force to eval icon.paintIcon(new JLabel(), g, 0, 0); // give chance to evaluate TimeoutUtil.sleep(1000); Icon icon2 = IconUtil.getIcon(file, Iconable.ICON_FLAG_VISIBILITY, getProject()); assertThat(icon2).isNotInstanceOf(DeferredIcon.class); assertThat(icon).isNotSameAs(icon2); FileContentUtilCore.reparseFiles(file); Icon icon3 = IconUtil.getIcon(file, Iconable.ICON_FLAG_VISIBILITY, getProject()); assertThat(icon2).isNotSameAs(icon3); } | testIconDeferrerDoesNotDeferIconsAdInfinitum |
272,276 | void () { UISettings uiSettings = UISettings.getInstance(); String fontFace = uiSettings.getFontFace(); int fontSize = UISettings.getInstance().getFontSize(); LafManagerImpl lafManager = EdtTestUtil.runInEdtAndGet(() -> LafManagerImpl.Companion.getTestInstance()); try { String newFontName = "Arial"; int newFontSize = 17; uiSettings.setFontFace(newFontName); uiSettings.setFontSize(newFontSize); NotRoamableUiSettings.Companion.getInstance().setOverrideLafFonts(true); lafManager.updateUI(); Font font = UIManager.getFont("Label.font"); assertThat(font.getName()).describedAs("Font name is not changed").isEqualTo(newFontName); assertThat(font.getSize()).describedAs("Font size is not changed").isEqualTo(newFontSize); } finally { NotRoamableUiSettings.Companion.getInstance().setOverrideLafFonts(false); uiSettings.setFontFace(fontFace); uiSettings.setFontSize(fontSize); lafManager.updateUI(); } } | customFont |
272,277 | void (String[] args) { final JFrame frame = new JFrame("Custom Dialog Test"); frame.setLocation(0, 0); frame.setSize(800, 600); frame.setVisible(true); final JDialog dialog = new JDialog(frame, true); dialog.setSize(400, 200); dialog.setUndecorated(true); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new BorderLayout()); JButton button = new JButton("Minimize"); button.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialog.setVisible(false); frame.setExtendedState(JFrame.ICONIFIED); } } ); contentPane.add(button, BorderLayout.CENTER); dialog.setVisible(true); frame.addWindowStateListener( new WindowStateListener() { @Override public void windowStateChanged(WindowEvent e) { if (e.getOldState() == JFrame.ICONIFIED && (e.getNewState() == JFrame.NORMAL || e.getNewState() == JFrame.MAXIMIZED_BOTH)) { dialog.setVisible(true); } } } ); } | main |
272,278 | void (ActionEvent e) { dialog.setVisible(false); frame.setExtendedState(JFrame.ICONIFIED); } | actionPerformed |
272,279 | void (WindowEvent e) { if (e.getOldState() == JFrame.ICONIFIED && (e.getNewState() == JFrame.NORMAL || e.getNewState() == JFrame.MAXIMIZED_BOTH)) { dialog.setVisible(true); } } | windowStateChanged |
272,280 | JTree (@NotNull TreeModel model) { @SuppressWarnings("UndesirableClassUsage") JTree tree = new JTree(model); TreeTestUtil.assertTreeUI(tree); tree.setRootVisible(true); return tree; } | createTree |
272,281 | void () { myTree.expandPath(myChildAPath); myTree.expandPath(myChild2Path); checkExpanded(myChild2Path); myTree.setSelectionPath(myChild2Path); TreeExpandCollapse.collapse(myTree); checkCollapsed(myChild2Path); checkExpanded(myChildAPath); } | testCollapse |
272,282 | void () { myTree.clearSelection(); TreeExpandCollapse.collapse(myTree); } | testCollapseWithoutSelection |
272,283 | void () { myTree.clearSelection(); TreeExpandCollapse.expand(myTree); } | testExpandWithoutSelection |
272,284 | void () { TreePath rootPath = collapseRoot(); myTree.setSelectionPath(rootPath); TreeExpandCollapse.expand(myTree); checkExpanded(rootPath); checkCollapsed(myChildAPath); } | testExpand |
272,285 | void () { TreePath rootPath = collapseRoot(); myTree.setSelectionPath(rootPath); TreeExpandCollapse.expandAll(myTree); checkExpanded(rootPath); checkExpanded(myChildAPath); checkExpanded(myChild2Path); } | testTotalFiniteExpand |
272,286 | void () { InfiniteTreeModel model = new InfiniteTreeModel(); myTree = createTree(model); TreePath rootPath = new TreePath(model.getRoot()); myTree.setSelectionPath(rootPath); myTree.collapsePath(rootPath); TreeExpandCollapse.expandAll(myTree); checkExpanded(rootPath); TreeExpandCollapse.expandAll(myTree); } | testInfiniteExpand |
272,287 | void () { InfiniteTreeModel model = new InfiniteTreeModel(); myTree = createTree(model); TreeExpandCollapse.expandAll(myTree); TreePath path = new TreePath(model.getRoot()); while (myTree.isExpanded(path)) path = path.pathByAddingChild(model.getChild(path.getLastPathComponent(), 0)); checkCollapsed(path); TreeExpandCollapse.expandAll(myTree); checkExpanded(path); } | testSubsequentExpand |
272,288 | void () { collapseRoot(); myTree.clearSelection(); TreeExpandCollapse.expand(myTree); checkCollapsed(new TreePath(myRoot)); checkCollapsed(myChildAPath); checkCollapsed(myChildBPath); } | testTotalExpandWithoutSelection |
272,289 | void () { myTree.expandPath(new TreePath(myRoot)); myTree.collapsePath(myChildAPath); myTree.collapsePath(myChildBPath); myTree.setSelectionPath(myChildAPath); TreeExpandCollapse.expandAll(myTree); checkExpanded(myChildAPath); checkCollapsed(myChildBPath); } | testTotalExpandWithSelection |
272,290 | void () { collapseRoot(); addChildren(500, myChild2); addChildren(500, myChildA); addChildren(500, myChildB); myTree.setSelectionPath(new TreePath(myRoot)); TreeExpandCollapse.expandAll(myTree); checkExpanded(new TreePath(myRoot)); checkExpanded(myChildAPath); checkExpanded(myChildBPath); checkExpanded(myChild2Path); } | testExpandAllWithManyLeafs |
272,291 | void () { collapseRoot(); TreePath[] treePaths = new TreePath[20]; for (int i = 0; i < treePaths.length; i++) { DefaultMutableTreeNode child = new DefaultMutableTreeNode(); myTreeModel.insertNodeInto(child, myChild2, 0); addChildren(20, child); treePaths[i] = myChild2Path.pathByAddingChild(child); } TreeExpandCollapse.expandAll(myTree); for (TreePath treePath : treePaths) { checkExpanded(treePath); } } | testExpandManyNotLeafs |
272,292 | void (int childCount, DefaultMutableTreeNode node) { for (int i = 0; i < childCount; i++) { myTreeModel.insertNodeInto(new DefaultMutableTreeNode(), node, 0); } } | addChildren |
272,293 | TreePath () { TreePath rootPath = new TreePath(myRoot); myTree.collapsePath(rootPath); myTree.setSelectionPath(rootPath); checkCollapsed(rootPath); return rootPath; } | collapseRoot |
272,294 | void (TreePath path) { assertFalse(myTree.isExpanded(path)); } | checkCollapsed |
272,295 | void (TreePath path) { assertTrue(myTree.isExpanded(path)); } | checkExpanded |
272,296 | Object () {return new Integer(1); } | getRoot |
272,297 | Object (Object parent, int index) { return new Integer(intValueOf(parent) + index + 1); } | getChild |
272,298 | int (Object parent) { Integer i = (Integer) parent; int intValue = i.intValue(); return intValue; } | intValueOf |
272,299 | int (Object parent) {return Math.min(3, intValueOf(parent)); } | getChildCount |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.