Skip to content

Package: TableTestUtil

TableTestUtil

nameinstructionbranchcomplexitylinemethod
createInitializedTableWithoutTableColumns()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
createInitializedTableWithoutTableColumns(EReference)
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
createTableColumn(EStructuralFeature)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
createTableControl()
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
createUninitializedTableWithoutColumns()
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2019 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Lucas Koehler - initial API and implementation
13: * Christian W. Damus - bug 527686
14: ******************************************************************************/
15: package org.eclipse.emf.ecp.view.table.test.common;
16:
17: import org.eclipse.emf.ecore.EReference;
18: import org.eclipse.emf.ecore.EStructuralFeature;
19: import org.eclipse.emf.ecore.EcorePackage;
20: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference;
21: import org.eclipse.emf.ecp.view.spi.model.VFeaturePathDomainModelReference;
22: import org.eclipse.emf.ecp.view.spi.model.VViewFactory;
23: import org.eclipse.emf.ecp.view.spi.table.model.VTableControl;
24: import org.eclipse.emf.ecp.view.spi.table.model.VTableFactory;
25:
26: /**
27: * Utility methods for table related test cases.
28: *
29: * @author Lucas Koehler
30: *
31: */
32: public final class TableTestUtil {
33:
34:         /**
35:          * Hide constructor for utility class.
36:          */
37:         private TableTestUtil() {
38:                 // do nothing
39:         }
40:
41:         /**
42:          * Creates a table column DMR for the given {@link EStructuralFeature}.
43:          *
44:          * @param feature The target feature that the column DMR references
45:          * @return The created DMR
46:          */
47:         public static VDomainModelReference createTableColumn(EStructuralFeature feature) {
48:                 final VFeaturePathDomainModelReference reference = VViewFactory.eINSTANCE
49:                         .createFeaturePathDomainModelReference();
50:                 reference.setDomainModelEFeature(feature);
51:                 return reference;
52:         }
53:
54:         /**
55:          * Create a {@link TableControlHandle} which contains an initialized table control.
56:          *
57:          * @return The initialized {@link TableControlHandle}
58:          */
59:         public static TableControlHandle createInitializedTableWithoutTableColumns() {
60:                 return createInitializedTableWithoutTableColumns(EcorePackage.Literals.ECLASS__ESUPER_TYPES);
61:         }
62:
63:         /**
64:          * Create a {@link TableControlHandle} which contains an initialized table control.
65:          *
66:          * @param reference the reference from which to get the rows of the table
67:          * @return The initialized {@link TableControlHandle}
68:          */
69:         public static TableControlHandle createInitializedTableWithoutTableColumns(EReference reference) {
70:                 final TableControlHandle tableControlHandle = createUninitializedTableWithoutColumns();
71:                 final VFeaturePathDomainModelReference domainModelReference = VTableFactory.eINSTANCE
72:                         .createTableDomainModelReference();
73:                 domainModelReference.setDomainModelEFeature(reference);
74:                 tableControlHandle.getTableControl().setDomainModelReference(domainModelReference);
75:
76:                 return tableControlHandle;
77:         }
78:
79:         /**
80:          * Create a {@link TableControlHandle} whose table control is not initialized
81:          *
82:          * @return The uninitialized {@link TableControlHandle}
83:          */
84:         public static TableControlHandle createUninitializedTableWithoutColumns() {
85:                 final VTableControl tableControl = createTableControl();
86:                 return new TableControlHandle(tableControl);
87:         }
88:
89:         /**
90:          * Create a {@link VTableControl} with an empty table DMR.
91:          *
92:          * @return The {@link VTableControl}
93:          */
94:         public static VTableControl createTableControl() {
95:                 final VTableControl tc = VTableFactory.eINSTANCE.createTableControl();
96:                 tc.setDomainModelReference(VTableFactory.eINSTANCE.createTableDomainModelReference());
97:                 tc.setUuid("UUID"); //$NON-NLS-1$
98:                 return tc;
99:         }
100: }