完善InvalidData

This commit is contained in:
xu_yanfeng
2024-12-18 09:03:59 +08:00
parent a079de4241
commit e0e78064fc
4 changed files with 39 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
import { v4 } from "uuid";
import { Msg, Page, PluginEvent } from "../../../core/types";
import { ArrayData, BoolData, ColorData, EngineData, EnumData, Group, ImageData, Info, NodeInfoData, NumberData, ObjectData, ObjectItemRequestData, Property, StringData, TextData, TreeData, Vec2Data, Vec3Data, Vec4Data } from "../data";
import { ArrayData, BoolData, ColorData, EngineData, EnumData, Group, ImageData, Info, InvalidData, NodeInfoData, NumberData, ObjectData, ObjectItemRequestData, Property, StringData, TextData, TreeData, Vec2Data, Vec3Data, Vec4Data } from "../data";
export class TestClient {
recv(event: PluginEvent) {
@@ -113,6 +113,12 @@ export class TestServer {
this.testData.buildChild("str2").buildComponent("group6")
.buildProperty("str2", new StringData("str2"))
this.testData.buildChild("Invalid").buildComponent("group7")
.buildProperty("NaN", new InvalidData(NaN))
.buildProperty("null", new InvalidData(null))
.buildProperty("Infinity", new InvalidData(Infinity))
.buildProperty("undefined", new InvalidData(undefined))
}
add(client: TestClient) {
this.clients.push(client);

View File

@@ -6,6 +6,7 @@
<CCButton @click="onTestTree">init tree data</CCButton>
<CCButton @click="onFrames">test frame</CCButton>
<CCButton @click="onTestNodeInfo">test node info</CCButton>
<CCButton @click="onNull">test null</CCButton>
</CCSection>
</div>
</template>
@@ -15,7 +16,7 @@ import { ITreeData } from "@xuyanfeng/cc-ui/types/cc-tree/const";
import { defineComponent, ref } from "vue";
import { Msg, Page, PluginEvent } from "../../../core/types";
import { connectBackground } from "../connectBackground";
import { FrameDetails, TreeData } from "../data";
import { FrameDetails, Group, Info, InvalidData, NodeInfoData, TreeData } from "../data";
import { testServer, TestServer } from "./server";
const { CCButton, CCSection } = ccui.components;
export default defineComponent({
@@ -83,6 +84,11 @@ export default defineComponent({
const event = new PluginEvent(Page.Background, Page.Devtools, Msg.NodeInfo, testData);
testServer.send(event);
},
onNull() {
const data = new NodeInfoData("", [new Group("", "1").buildProperty("dependAssets", new InvalidData("Null"))]);
const event = new PluginEvent(Page.Background, Page.Devtools, Msg.NodeInfo, data);
testServer.send(event);
},
};
},
});