Browse Source

Merge remote-tracking branch 'origin/release/11.0' into release/11.0

newui
obo 2 years ago
parent
commit
bb5cd7e6ef
  1. 2
      designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java
  2. 6
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractDefaultValueAdjustProvider.java
  3. 6
      designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java
  4. 18
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java
  5. 17
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/FileSearchManagerTest.java
  6. 2
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManagerTest.java
  7. 18
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java

2
designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java

@ -14,7 +14,7 @@ import java.awt.Font;
*/
public interface DefaultValueAdjustProvider extends Selectable {
String MARK_STRING = "DefaultValueAdjustProvider";
int CURRENT_LEVEL = 1;
int CURRENT_LEVEL = 2;
/**
* 调整单元格对象默认值

6
designer-base/src/main/java/com/fr/design/fun/impl/AbstractDefaultValueAdjustProvider.java

@ -9,9 +9,13 @@ import com.fr.stable.fun.mark.API;
@API(level = DefaultValueAdjustProvider.CURRENT_LEVEL)
public abstract class AbstractDefaultValueAdjustProvider extends AbstractProvider implements DefaultValueAdjustProvider {
//1.16及之前发布版本插件里面没有实现currentAPILevel方法,运行时候会走到主jar,拿到-2。
//1.16.1及之后发布版本插件实现currentAPILevel方法,编译插件的时候,会把DefaultValueAdjustProvider.CURRENT_LEVEL的值编译给插件,比如1.16.1会拿到2。
private static final int OLD_CURRENT_LEVEL = -2;
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
return OLD_CURRENT_LEVEL;
}
public String mark4Provider() {

6
designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java

@ -446,12 +446,14 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
Style oldStyle = cellElement == null ? Style.DEFAULT_STYLE : cellElement.getStyle();
Style style = formatPane.update(oldStyle);
for (TemplateCellElement cellElement : allCellElements) {
Format elementFormat = cellElement.getStyle().getFormat();
Style cellElementStyle = cellElement.getStyle();
Format elementFormat = cellElementStyle.getFormat();
Format paneFormat = style.getFormat();
if (!Objects.equals(paneFormat, elementFormat)) {
// 点击单元格,但未设置格式时,不将单元格设置为编辑状态,防止将所选的每个单元格都设置为编辑状态
editingElementCase.addCellElement(cellElement);
cellElement.setStyle(style);
Style newStyle = cellElementStyle.deriveFormat(paneFormat);
cellElement.setStyle(newStyle);
updateStyle = true;
}
}

18
designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java

@ -1,13 +1,31 @@
package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.actions.help.alphafine.AlphaFineCloudConstants;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest(Toolkit.class)
@PowerMockIgnore("javax.swing.*")
public class ModelTest {
@Before
public void setUp() {
PowerMockito.mockStatic(Toolkit.class);
PowerMockito.when(Toolkit.i18nText(Mockito.anyString())).thenReturn("test");
}
@Test
public void documentModelTest() {
DocumentModel documentModel = new DocumentModel("name", "content", 1);

17
designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/FileSearchManagerTest.java

@ -1,7 +1,5 @@
package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
@ -9,9 +7,6 @@ import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.file.filetree.FileNode;
import com.fr.invoke.Reflect;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.core.SessionPoolManager;
import com.fr.web.utils.WebUtils;
import org.easymock.EasyMock;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -23,7 +18,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
/**
* @author Yyming
@ -43,8 +38,8 @@ public class FileSearchManagerTest {
FileNode fileNode2 = EasyMock.createMock(FileNode.class);
EasyMock.expect(fileNode1.getName()).andReturn("workbook").anyTimes();
EasyMock.expect(fileNode2.getName()).andReturn("work book").anyTimes();
EasyMock.expect(fileNode1.getEnvPath()).andReturn("").anyTimes();
EasyMock.expect(fileNode2.getEnvPath()).andReturn("").anyTimes();
EasyMock.expect(fileNode1.getEnvPath()).andReturn("t1").anyTimes();
EasyMock.expect(fileNode2.getEnvPath()).andReturn("t2").anyTimes();
EasyMock.replay(fileNode1,fileNode2);
FileNode[] fileNodes = { fileNode1, fileNode2 };
Reflect.on(instance).set("fileNodes",fileNodes);
@ -65,8 +60,10 @@ public class FileSearchManagerTest {
PowerMock.mockStatic(AlphaFineHelper.class);
AlphaFineHelper.getFilterResult();
PowerMock.expectLastCall().andReturn(list).anyTimes();
AlphaFineHelper.findFolderName("");
PowerMock.expectLastCall().andReturn("").anyTimes();
AlphaFineHelper.findFolderName("t1");
PowerMock.expectLastCall().andReturn("t1").anyTimes();
AlphaFineHelper.findFolderName("t2");
PowerMock.expectLastCall().andReturn("t2").anyTimes();
AlphaFineHelper.checkCancel();
PowerMock.expectLastCall().andVoid().anyTimes();
PowerMock.replay(AlphaFineHelper.class);

2
designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManagerTest.java

@ -19,7 +19,7 @@ public class PluginSearchManagerTest {
Assert.assertTrue(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "9.0").get());
Assert.assertTrue(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "9~").get());
Assert.assertTrue(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "10").get());
Assert.assertFalse(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "11").get());
Assert.assertTrue(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "11").get());
}
}

18
designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java

@ -1,13 +1,26 @@
package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.json.JSONObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.ArrayList;
@RunWith(PowerMockRunner.class)
@PrepareForTest(Toolkit.class)
@PowerMockIgnore("javax.swing.*")
public class SearchManegerTest {
SimilarSearchManager similarSearchManager;
ComplementAdviceManager complementAdviceManager;
@ -21,6 +34,11 @@ public class SearchManegerTest {
@Before
public void setUp() {
UpdateActionManager.getUpdateActionManager().setUpdateActions(new ArrayList<>());
PowerMockito.mockStatic(Toolkit.class);
PowerMockito.when(Toolkit.i18nText(Mockito.anyString())).thenReturn("test");
recentSearchManager = RecentSearchManager.getInstance();
recommendSearchManager = RecommendSearchManager.getInstance();
similarSearchManager = SimilarSearchManager.getInstance();

Loading…
Cancel
Save