chore: publish native ui polish release v2.5.3
This commit is contained in:
@@ -14,7 +14,7 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class GroupCreateActivityTest {
|
||||
@Test
|
||||
public void buildHeaderCardSpecs_collapsesSourceFlowIntoSingleCompactCard() {
|
||||
public void buildSourceHeaderDetail_usesCompactWechatSummary() {
|
||||
JSONObject threadMeta = new StubJSONObject()
|
||||
.withString("threadDisplayName", "北区试产线回归")
|
||||
.withString("threadId", "thread-7")
|
||||
@@ -25,27 +25,20 @@ public class GroupCreateActivityTest {
|
||||
new StubJSONObject()
|
||||
);
|
||||
|
||||
List<GroupCreateActivity.SummaryCardSpec> cards = GroupCreateActivity.buildHeaderCardSpecs(
|
||||
true,
|
||||
String detail = GroupCreateActivity.buildSourceHeaderDetail(
|
||||
"source-1",
|
||||
"北区试产线回归",
|
||||
threadMeta,
|
||||
participants
|
||||
);
|
||||
|
||||
assertEquals(1, cards.size());
|
||||
assertEquals("北区试产线回归", cards.get(0).title);
|
||||
assertEquals("来源线程 thread-7 · Mac Studio · 3 个参与线程", cards.get(0).body);
|
||||
assertEquals("新群会单独创建,原会话保留", cards.get(0).meta);
|
||||
assertEquals("thread-7 · Mac Studio · 3 个参与线程", detail);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void buildSelectionCardSpec_usesCompactWechatStyleHint() {
|
||||
GroupCreateActivity.SummaryCardSpec card = GroupCreateActivity.buildSelectionCardSpec(5, 0, true);
|
||||
|
||||
assertEquals("选择其他线程", card.title);
|
||||
assertEquals("至少选择 1 个其他线程", card.body);
|
||||
assertEquals("候选 5 个 · 已选 0 个", card.meta);
|
||||
public void buildSelectionHintText_usesCompactWechatStyleHint() {
|
||||
assertEquals("至少选择 1 个其他线程", GroupCreateActivity.buildSelectionHintText(5, 0, true));
|
||||
assertEquals("已选 2 个线程", GroupCreateActivity.buildSelectionHintText(5, 2, true));
|
||||
assertEquals("当前没有可加入的其他线程", GroupCreateActivity.buildSelectionHintText(0, 0, true));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -40,11 +40,10 @@ public class GroupCreateActivityUiTest {
|
||||
|
||||
LinearLayout content = activity.findViewById(R.id.screen_content);
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(0), "北区试产线回归"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(0), "来源线程 thread-7 · Mac Studio · 3 个参与线程"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(0), "新群会单独创建,原会话保留"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(0), "从当前会话发起群聊"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(0), "thread-7 · Mac Studio · 3 个参与线程"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(1), "选择其他线程"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(1), "继续点选可调整成员"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(1), "候选 2 个 · 已选 2 个"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(2), "已选 2 个线程"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -77,8 +76,32 @@ public class GroupCreateActivityUiTest {
|
||||
);
|
||||
|
||||
LinearLayout content = activity.findViewById(R.id.screen_content);
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(1), "至少选择 1 个其他线程"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(1), "候选 2 个 · 已选 0 个"));
|
||||
assertTrue(viewTreeContainsText(content.getChildAt(2), "至少选择 1 个其他线程"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderCreatePageUsesInlineActionRowInsteadOfStackedButtons() throws Exception {
|
||||
Intent intent = new Intent()
|
||||
.putExtra(GroupCreateActivity.EXTRA_SOURCE_PROJECT_ID, "source-1")
|
||||
.putExtra(GroupCreateActivity.EXTRA_SOURCE_PROJECT_NAME, "北区试产线回归");
|
||||
TestGroupCreateActivity activity = Robolectric
|
||||
.buildActivity(TestGroupCreateActivity.class, intent)
|
||||
.setup()
|
||||
.get();
|
||||
|
||||
ReflectionHelpers.callInstanceMethod(
|
||||
activity,
|
||||
"renderCreatePage",
|
||||
ReflectionHelpers.ClassParameter.from(JSONObject.class, buildParticipantsPayload()),
|
||||
ReflectionHelpers.ClassParameter.from(JSONObject.class, buildConversationsPayload()),
|
||||
ReflectionHelpers.ClassParameter.from(boolean.class, true)
|
||||
);
|
||||
|
||||
LinearLayout content = activity.findViewById(R.id.screen_content);
|
||||
View lastChild = content.getChildAt(content.getChildCount() - 1);
|
||||
assertTrue(lastChild instanceof LinearLayout);
|
||||
assertTrue(viewTreeContainsText(lastChild, "取消"));
|
||||
assertTrue(viewTreeContainsText(lastChild, "创建群聊"));
|
||||
}
|
||||
|
||||
private static JSONObject buildParticipantsPayload() throws Exception {
|
||||
|
||||
@@ -190,6 +190,42 @@ public class ProjectDetailActivityUiTest {
|
||||
assertFalse(viewTreeContainsText(attachmentView, "已分析"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outgoingAttachmentMetaPrefersTimeOnly() throws Exception {
|
||||
Intent intent = new Intent()
|
||||
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_ID, "project-1")
|
||||
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_NAME, "北区试产线回归");
|
||||
TestProjectDetailActivity activity = Robolectric
|
||||
.buildActivity(TestProjectDetailActivity.class, intent)
|
||||
.setup()
|
||||
.get();
|
||||
|
||||
JSONObject attachment = new JSONObject()
|
||||
.put("attachmentId", "att-meta")
|
||||
.put("fileName", "现场照片.jpg")
|
||||
.put("mimeType", "image/jpeg")
|
||||
.put("attachmentKind", "image")
|
||||
.put("analysisState", "queued_auto")
|
||||
.put("fileSizeBytes", 1024);
|
||||
JSONObject message = new JSONObject()
|
||||
.put("id", "msg-meta")
|
||||
.put("kind", "attachment")
|
||||
.put("body", "已发送附件")
|
||||
.put("attachments", new JSONArray().put(attachment));
|
||||
|
||||
View attachmentView = ReflectionHelpers.callInstanceMethod(
|
||||
activity,
|
||||
"buildAttachmentMessageView",
|
||||
ReflectionHelpers.ClassParameter.from(JSONObject.class, message),
|
||||
ReflectionHelpers.ClassParameter.from(String.class, "你"),
|
||||
ReflectionHelpers.ClassParameter.from(String.class, "09:26"),
|
||||
ReflectionHelpers.ClassParameter.from(boolean.class, true)
|
||||
);
|
||||
|
||||
assertTrue(viewTreeContainsText(attachmentView, "09:26"));
|
||||
assertFalse(viewTreeContainsText(attachmentView, "你 · 09:26"));
|
||||
}
|
||||
|
||||
private static View buildBoundMessageView(TestProjectDetailActivity activity, String messageId, String body) {
|
||||
TextView messageView = new TextView(activity);
|
||||
messageView.setText(body);
|
||||
|
||||
Reference in New Issue
Block a user