Skip to content

Commit 2132dd5

Browse files
committed
test: 修改测试流程
1 parent 2c82080 commit 2132dd5

File tree

5 files changed

+65
-43
lines changed

5 files changed

+65
-43
lines changed

packages/test/FeatureConfig.json

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
{
3333
"fontLink": "https://github.com/adobe-fonts/source-han-serif/raw/release/Variable/OTF/Subset/SourceHanSerifKR-VF.otf",
3434
"featureKey": "ljmo",
35+
"lineHeight": "1.439",
3536
"splitText": "\\nᄁ\\nᄂ\\nᄓ\\nᄔ\\nᄕ\\nᄖ\\nᄂᄉᄉ\\nᄂᄌᄌ\\nᄂᄒᄒ\\nᄃ\\nᄗ\\nᄄ\\nᄃᄅᄅ\\nᄃᄆᄆ\\nᄃᄇᄇ\\nᄃᄉᄉ\\nᄃᄌᄌ\\nᄅ\\nᄅᄀᄀ\\nᄅᄀᄀ\\nᄘ\\nᄅᄃᄃ\\nᄅᄃᄃ\\nᄙ\\nᄅᄆᄆ\\nᄅᄇᄇ\\nᄅᄇᄇ\\nᄅᄫᄫ\\nᄅᄉᄉ\\nᄅᄌᄌ\\nᄅᄏᄏ\\nᄚ\\nᄛ\\nᄆ\\nᄆᄀᄀ\\n"
3637
},
3738
{
@@ -544,6 +545,7 @@
544545
{
545546
"fontLink": "https://sparanoid.com/lab/opentype-features/assets/fonts/sf-pro-display-bold.woff2",
546547
"featureKey": "cv03",
548+
547549
"splitText": "4"
548550
},
549551
{

packages/test/SUPPORT_FEATURE.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
|| abvs | Above-base Substitutions | |
2424
|| afrc | Alternative Fractions | |
2525
|| akhn | Akhand | |
26-
| ⏺️ | blwf | Below-base Forms | |
26+
| ⏺️ | blwf | Below-base Forms | harfbuzz 部分解析失效,部分成功 |
2727
|| blwm | Below-base Mark Positioning | |
2828
|| blws | Below-base Substitutions | |
2929
|| calt | Contextual Alternates | |
@@ -32,7 +32,7 @@
3232
|| cfar | Conjunct Form After Ro | |
3333
|| chws | Contextual Half-width Spacing | |
3434
|| cjct | Conjunct Forms | |
35-
| | clig | Contextual Ligatures | |
35+
| | clig | Contextual Ligatures | |
3636
| ⏺️ | cpct | Centered CJK Punctuation | 浏览器 unicode-range 部分形态位移 |
3737
|| cpsp | Capital Spacing | |
3838
|| cswh | Contextual Swash | |
@@ -95,7 +95,7 @@
9595
|| pcap | Petite Capitals | |
9696
|| pkna | Proportional Kana | |
9797
|| pnum | Proportional Figures | |
98-
| | pref | Pre-Base Forms | |
98+
| | pref | Pre-Base Forms | |
9999
|| pres | Pre-base Substitutions | |
100100
|| pstf | Post-base Forms | |
101101
|| psts | Post-base Substitutions | |

packages/test/script/build.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ for (const i of features) {
4545
// charset,
4646
// i.splitCount ?? 3
4747
// ),
48-
subsets: [charset],
48+
subsets: [[...new Set(charset)]],
4949
});
5050
}
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,51 @@
1-
import { atom, reflect } from "@cn-ui/reactive"
2-
import { JSXElement } from "solid-js"
3-
import { useElementBounding } from 'solidjs-use'
4-
1+
import { atom, reflect } from '@cn-ui/reactive';
2+
import { JSXElement } from 'solid-js';
3+
import { useElementBounding } from 'solidjs-use';
54

65
export const AbsoluteLayout = (props: {
7-
render: () => JSXElement[]
8-
margin?: number
6+
render: () => JSXElement[];
7+
margin?: number;
98
}) => {
10-
const collection = atom<ReturnType<typeof useElementBounding>[]>([])
11-
return <div style={{
12-
position: "relative"
13-
}}>
14-
{props.render().map(Comp => {
15-
const ref = atom(null)
16-
const size = useElementBounding(ref)
17-
collection(i => [...i, size])
18-
const originPoint = reflect(() => {
19-
const arr = collection()
20-
const index = arr.findIndex(i => i === size)
21-
const stack = arr.slice(0, index)
22-
return stack.reduce((col, cur) => {
23-
col.left += cur.width() + (props.margin ?? 10)
24-
return col
25-
}, { top: 0, left: 0 })
26-
})
27-
return <div ref={ref} style={{
28-
position: "absolute",
29-
display: "flex",
30-
top: originPoint().top + 'px',
31-
left: originPoint().left + 'px'
32-
}}>
33-
{Comp}
34-
</div>
35-
})}
36-
37-
</div>
38-
}
9+
const collection = atom<ReturnType<typeof useElementBounding>[]>([]);
10+
return (
11+
<div
12+
style={{
13+
position: 'relative',
14+
display: 'flex',
15+
}}
16+
>
17+
{props.render().map((Comp) => {
18+
const ref = atom(null);
19+
const size = useElementBounding(ref);
20+
collection((i) => [...i, size]);
21+
const originPoint = reflect(() => {
22+
const arr = collection();
23+
const index = arr.findIndex((i) => i === size);
24+
const stack = arr.slice(0, index);
25+
return stack.reduce(
26+
(col, cur) => {
27+
col.left += Math.ceil(
28+
cur.width() + (props.margin ?? 10),
29+
);
30+
return col;
31+
},
32+
{ top: 0, left: 0 },
33+
);
34+
});
35+
return (
36+
<div
37+
ref={ref}
38+
style={{
39+
position: 'absolute',
40+
'max-width': '50%',
41+
top: originPoint().top + 'px',
42+
left: originPoint().left + 'px',
43+
}}
44+
>
45+
{Comp}
46+
</div>
47+
);
48+
})}
49+
</div>
50+
);
51+
};

packages/test/src/view/Feature.tsx

+11-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import Features from '../../FeatureConfig.json';
33
import { StyleForFont } from '../components/createStyleForFont';
44
import { RouteContext } from '../simpleRoute';
55
import { AbsoluteLayout } from '../components/AbsoluteLayout';
6-
const colorSet = ['#000000', '#00af6c'];
6+
const colorSet = [
7+
['#00af6c', '#00af6c'],
8+
['#2f06c2', '#2f01d2'],
9+
];
710
export const FeatureList = () => {
811
const route = useContext(RouteContext);
912
return (
@@ -27,7 +30,7 @@ export const FeatureList = () => {
2730
return (
2831
<details open class={i.featureKey + '_total'}>
2932
<summary>{i.featureKey}</summary>
30-
{renderArea.map((fontFamily) => {
33+
{renderArea.map((fontFamily, level) => {
3134
return (
3235
<AbsoluteLayout
3336
render={() =>
@@ -50,10 +53,14 @@ export const FeatureList = () => {
5053
48) + 'px',
5154
color:
5255
!isTest &&
53-
colorSet[index],
56+
colorSet[level][
57+
index
58+
],
5459

5560
height: i.height,
56-
// width: '100%',
61+
'line-height':
62+
level === 1 &&
63+
i.lineHeight,
5764
direction:
5865
i.direction ??
5966
'initial',

0 commit comments

Comments
 (0)