You've already forked v8-code-style
mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2025-07-15 12:14:21 +02:00
#266 Правки по замечаниям
This commit is contained in:
@ -39,6 +39,8 @@ public class FormListRefUseAlwaysFlagDisabledCheck
|
|||||||
|
|
||||||
private static final String CHECK_ID = "form-list-ref-use-always-flag-disabled"; //$NON-NLS-1$
|
private static final String CHECK_ID = "form-list-ref-use-always-flag-disabled"; //$NON-NLS-1$
|
||||||
private static final String REF_ABSTRACT_DATA_PATH = "/List/Ref"; //$NON-NLS-1$
|
private static final String REF_ABSTRACT_DATA_PATH = "/List/Ref"; //$NON-NLS-1$
|
||||||
|
private static final String REF_ABSTRACT_DATA_PATH_RU = "/List/Ссылка"; //$NON-NLS-1$
|
||||||
|
private static final String REF_ABSTRACT_DATA_PATH_RU_FULL = "/Список/Ссылка"; //$NON-NLS-1$
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCheckId()
|
public String getCheckId()
|
||||||
@ -73,7 +75,9 @@ public class FormListRefUseAlwaysFlagDisabledCheck
|
|||||||
FormAttribute formAttribute = (FormAttribute)object;
|
FormAttribute formAttribute = (FormAttribute)object;
|
||||||
if (formAttribute.getExtInfo() instanceof DynamicListExtInfo && formAttribute.getNotDefaultUseAlwaysAttributes()
|
if (formAttribute.getExtInfo() instanceof DynamicListExtInfo && formAttribute.getNotDefaultUseAlwaysAttributes()
|
||||||
.stream()
|
.stream()
|
||||||
.noneMatch(p -> p.toString().equals(REF_ABSTRACT_DATA_PATH)))
|
.noneMatch(
|
||||||
|
p -> p.toString().equals(REF_ABSTRACT_DATA_PATH) || p.toString().equals(REF_ABSTRACT_DATA_PATH_RU)
|
||||||
|
|| p.toString().equals(REF_ABSTRACT_DATA_PATH_RU_FULL)))
|
||||||
{
|
{
|
||||||
resultAceptor.addIssue(
|
resultAceptor.addIssue(
|
||||||
Messages.FormListRefUseAlwaysFlagDisabledCheck_UseAlways_flag_is_disabled_for_the_Ref_field,
|
Messages.FormListRefUseAlwaysFlagDisabledCheck_UseAlways_flag_is_disabled_for_the_Ref_field,
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.e1c.v8codestyle.form.check.itests;
|
package com.e1c.v8codestyle.form.check.itests;
|
||||||
|
|
||||||
|
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.CONFIGURATION;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
@ -29,6 +30,8 @@ import com._1c.g5.v8.dt.form.model.DataPath;
|
|||||||
import com._1c.g5.v8.dt.form.model.Form;
|
import com._1c.g5.v8.dt.form.model.Form;
|
||||||
import com._1c.g5.v8.dt.form.model.FormItem;
|
import com._1c.g5.v8.dt.form.model.FormItem;
|
||||||
import com._1c.g5.v8.dt.form.model.Table;
|
import com._1c.g5.v8.dt.form.model.Table;
|
||||||
|
import com._1c.g5.v8.dt.metadata.mdclass.Configuration;
|
||||||
|
import com._1c.g5.v8.dt.metadata.mdclass.ScriptVariant;
|
||||||
import com._1c.g5.v8.dt.validation.marker.Marker;
|
import com._1c.g5.v8.dt.validation.marker.Marker;
|
||||||
import com.e1c.g5.v8.dt.testing.check.CheckTestBase;
|
import com.e1c.g5.v8.dt.testing.check.CheckTestBase;
|
||||||
import com.e1c.v8codestyle.form.check.FormListRefUseAlwaysFlagDisabledCheck;
|
import com.e1c.v8codestyle.form.check.FormListRefUseAlwaysFlagDisabledCheck;
|
||||||
@ -45,8 +48,9 @@ public class FormListRefUseAlwaysFlagDisabledCheckTest
|
|||||||
private static final String PROJECT_NAME = "FormListRefUseAlwaysFlagDisabled";
|
private static final String PROJECT_NAME = "FormListRefUseAlwaysFlagDisabled";
|
||||||
private static final String FQN_FORM = "Catalog.TestCatalog.Form.TestListForm.Form";
|
private static final String FQN_FORM = "Catalog.TestCatalog.Form.TestListForm.Form";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Use Always flag is disabled for the Reference attribute in dynamic list.
|
* Test Use Always flag is disabled for the Reference attribute in dynamic list (En Script variant).
|
||||||
*
|
*
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
@ -64,7 +68,7 @@ public class FormListRefUseAlwaysFlagDisabledCheckTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Use Always flag is enabled for the Reference attribute in dynamic list.
|
* Test Use Always flag is enabled for the Reference attribute in dynamic list (En Script variant).
|
||||||
*
|
*
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
@ -96,4 +100,38 @@ public class FormListRefUseAlwaysFlagDisabledCheckTest
|
|||||||
Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject);
|
Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject);
|
||||||
assertNull(marker);
|
assertNull(marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test Use Always flag is disabled for the Reference attribute in dynamic list (Ru script variant).
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testUseAlwaysDisabledForRefRu() throws Exception
|
||||||
|
{
|
||||||
|
IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME);
|
||||||
|
assertNotNull(dtProject);
|
||||||
|
|
||||||
|
IBmModel model = bmModelManager.getModel(dtProject);
|
||||||
|
model.execute(new AbstractBmTask<Void>("change mode")
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void execute(IBmTransaction transaction, IProgressMonitor monitor)
|
||||||
|
{
|
||||||
|
IBmObject object = transaction.getTopObjectByFqn(CONFIGURATION.getName());
|
||||||
|
assertTrue(object instanceof Configuration);
|
||||||
|
Configuration config = (Configuration)object;
|
||||||
|
config.setScriptVariant(ScriptVariant.RUSSIAN);
|
||||||
|
assertTrue(config.getScriptVariant() == ScriptVariant.RUSSIAN);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
waitForDD(dtProject);
|
||||||
|
|
||||||
|
IBmObject object = getTopObjectByFqn(FQN_FORM, dtProject);
|
||||||
|
assertTrue(object instanceof Form);
|
||||||
|
|
||||||
|
Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject);
|
||||||
|
assertNotNull(marker);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user