Skip to content

Commit

Permalink
Merge branch 'main' into cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
podborski committed Aug 30, 2023
2 parents 6aa366f + 45aa833 commit 851c8c0
Show file tree
Hide file tree
Showing 13 changed files with 719 additions and 266 deletions.
14 changes: 3 additions & 11 deletions conformance-search/src/components/BoxComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,13 @@ export default function BoxComponent({ box }: { box: SearchResultRefined<Box> })
<h3 className="-mb-1 text-xs font-bold">
{box.item.type || "N/A"} &bull; {box.item.spec}
</h3>
<h2
className="text-4xl font-extralight tracking-tight"
data-testid="list-item-key"
>
{box.item.fourcc}
</h2>
<h2 className="text-4xl font-extralight tracking-tight">{box.item.fourcc}</h2>
<p className="text-justify text-sm italic text-neutral-500">
{box.item.description}
</p>
</div>
<button
className="flex flex-col items-start text-xl"
data-testid="list-item-checkbox"
onClick={() => {
setChecked(!checked);
refineHandler(
Expand Down Expand Up @@ -165,11 +159,10 @@ export default function BoxComponent({ box }: { box: SearchResultRefined<Box> })
</Drawer>
<Drawer hidden={box.item.versions.length < 1} title="Versions">
<ul className="p-3">
{box.item.versions.map((version, index) => (
{box.item.versions.map((version) => (
<li key={version} className="flex flex-row items-center gap-2">
<button
className="flex flex-col items-start"
data-testid={`list-item-version-${index}`}
onClick={() => {
// Create refinements object if it doesn't exist
let { refinements } = box;
Expand Down Expand Up @@ -221,7 +214,7 @@ export default function BoxComponent({ box }: { box: SearchResultRefined<Box> })
title="Flags"
>
<ul className="p-3">
{box.item.flags.map((flag, index) => {
{box.item.flags.map((flag) => {
if ("wildcard" in flag) return null;
const { name, value, description: flagDescription } = flag;
return (
Expand All @@ -231,7 +224,6 @@ export default function BoxComponent({ box }: { box: SearchResultRefined<Box> })
>
<button
className="flex flex-col items-start"
data-testid={`list-item-flag-${index}`}
onClick={() => {
// Create refinements object if it doesn't exist
let { refinements } = box;
Expand Down
8 changes: 1 addition & 7 deletions conformance-search/src/components/FeatureComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ export default function FeatureComponent({ feature }: { feature: SearchResultRef
<div className="flex flex-row items-start p-3 !pb-0">
<div className="grow">
<h3 className="-mb-1 text-xs font-bold">Feature &bull; {feature.item.spec}</h3>
<h2
className="text-3xl font-extralight tracking-tight"
data-testid="list-item-key"
>
{feature.item.name}
</h2>
<h2 className="text-3xl font-extralight tracking-tight">{feature.item.name}</h2>
</div>
<button
className="ml-2 flex flex-col items-start text-xl"
data-testid="list-item-checkbox"
onClick={() => {
setChecked(!checked);
refineHandler(
Expand Down
5 changes: 1 addition & 4 deletions conformance-search/src/components/FileComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,7 @@ export default function FileComponent({ file }: { file: FileSearchResult }) {
)}
</div>
<span className="table w-full table-fixed">
<h2
className="table-cell truncate text-2xl font-extralight tracking-tight"
data-testid="list-item-key"
>
<h2 className="table-cell truncate text-2xl font-extralight tracking-tight">
{file.item.rel_filepath.split("/").pop()}
</h2>
</span>
Expand Down
11 changes: 2 additions & 9 deletions conformance-search/src/components/ListComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,13 @@ export default function ListComponent({
</div>
);
return (
<div
className={clsx(className, "flex flex-col items-center justify-between gap-4")}
data-testid="list-view"
>
<div className={clsx(className, "flex flex-col items-center justify-between gap-4")}>
<span className="w-full self-start px-2">
Search resulted in <b>{children.length}</b> hits
</span>
<ul className="flex w-full grow flex-col gap-4 overflow-y-auto p-2 pt-0">
{children.map((item) => {
return (
<li key={item.key} data-testid="list-item">
{item}
</li>
);
return <li key={item.key}>{item}</li>;
})}
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export default function SearchComponent({
autoComplete="off"
autoCorrect="off"
className="h-16 min-w-0 grow rounded-md px-5 text-sm focus:outline-none disabled:bg-transparent"
data-testid="search-input"
disabled={!ready}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setQuery((e.target as HTMLInputElement).value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ exports[`Database > files > should return 3 files for hdlr under =moov.meta 1`]
]
`;

exports[`Database > files > should return 3 files for meta under =moov 1`] = `
[
"published/isobmff/12_metas_v2.mp4",
"published/uvvu/Solekai002_1280_23_1x1_v7clear.uvvu",
"published/uvvu/Solekai007_1920_29_1x1_v7clear.uvu",
]
`;

exports[`Database > files > should return 3 files for stz2 1`] = `
[
"published/isobmff/02_dref_edts_img.mp4",
Expand Down
13 changes: 0 additions & 13 deletions conformance-search/src/lib/__snapshots__/search.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,6 @@ exports[`Search > search with container filter > (exact) $moov > $trak > $meta >
]
`;

exports[`Search > search with container filter > (exact) $moov > '' TBD 1`] = `
[
"free",
"meta",
"mvex",
"mvhd",
"skip",
"trak",
"udta",
"uuid",
]
`;

exports[`Search > search with container filter > (exact) $trak > '' 1`] = `
[
"edts",
Expand Down
8 changes: 8 additions & 0 deletions conformance-search/src/lib/database.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ describe("Database", () => {
expect(results.map((r) => r.item.abs_filepath)).toMatchSnapshot();
});

it("should return 3 files for meta under =moov", async () => {
await database.updateDatabase([{ container: "=$moov" }]);
const results = database.getMatchingFilesByBox([getBox("meta")]);

expect(results.length).toEqual(3);
expect(results.map((r) => r.item.abs_filepath)).toMatchSnapshot();
});

it("should return more than 0 files after removing a container filter", async () => {
await search.search("meta", [{ type: "container", value: "$trak" }]);
const { boxes } = await search.search("mvex", []);
Expand Down
6 changes: 5 additions & 1 deletion conformance-search/src/lib/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ class Database {
let latchAfterFirst = 0;
for (let i = 0; i < path.length; i += 1) {
// if we have already matched all the filters, we can break out of the loop
if (totalMatched === filterValues.configuration.length) break;
if (totalMatched === filterValues.configuration.length) {
// on exact match, totalMatched should be equal to path.length or we also include other descendants
if (filterValues.exact && totalMatched !== path.length) matched = false;
break;
}

// on exact match, we can break out of the loop if order of the filters are not met
if (filterValues.exact && totalMatched !== latchAfterFirst) {
Expand Down
7 changes: 0 additions & 7 deletions conformance-search/src/lib/search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,6 @@ describe("Search", () => {
expect(boxes.map((r) => r.item.fourcc)).toMatchSnapshot();
});

it("(exact) $moov > '' TBD", async () => {
const { boxes } = await search.search("", [{ type: "container", value: "=$moov" }]);

expect(boxes.length).toEqual(8);
expect(boxes.map((r) => r.item.fourcc)).toMatchSnapshot();
});

it("$moov > $edts > 'elst'", async () => {
it("exact match", async () => {
const { boxes } = await search.search("elst", [
Expand Down
Loading

0 comments on commit 851c8c0

Please sign in to comment.