refactor: remove tests directory, since it's not used

This commit is contained in:
Mikhail Zolotukhin 2021-10-18 21:54:40 +03:00
parent 502f812081
commit 26280306fb
3 changed files with 0 additions and 142 deletions

View File

@ -1,49 +0,0 @@
// SPDX-FileCopyrightText: 2018-2019 Eon S. Jeon <esjeon@hyunmu.am>
// SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin <mail@genda.life>
//
// SPDX-License-Identifier: MIT
import Window from "../src/engine/window";
import ISurface from "../src/isurface";
import Rect from "../src/util/rect";
import TestSurface from "./test_surface";
export default class TestDriver {
public currentScreen: number;
public currentWindow: number;
public numScreen: number;
public screenSize: Rect;
public windows: Window[];
constructor() {
this.currentScreen = 0;
this.currentWindow = 0;
this.numScreen = 1;
this.screenSize = new Rect(0, 0, 10000, 10000);
this.windows = [];
}
public forEachScreen(func: (srf: ISurface) => void) {
for (let screen = 0; screen < this.numScreen; screen++)
func(new TestSurface(this, screen));
}
public getCurrentContext(): ISurface {
const window = this.getCurrentWindow();
if (window) return window.surface;
return new TestSurface(this, 0);
}
public getCurrentWindow(): Window | null {
return this.windows.length !== 0 ? this.windows[this.currentWindow] : null;
}
public getWorkingArea(srf: ISurface): Rect {
return this.screenSize;
}
public setCurrentWindow(window: Window) {
const idx = this.windows.indexOf(window);
if (idx !== -1) this.currentWindow = idx;
}
}

View File

@ -1,33 +0,0 @@
// SPDX-FileCopyrightText: 2018-2019 Eon S. Jeon <esjeon@hyunmu.am>
// SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin <mail@genda.life>
//
// SPDX-License-Identifier: MIT
import ISurface from "../src/isurface";
import Rect from "../src/util/rect";
import TestDriver from "./test_driver";
export default class TestSurface implements ISurface {
public readonly screen: number;
public get id(): string {
return String(this.screen);
}
public get ignore(): boolean {
// TODO: optionally ignore some surface to test LayoutStore
return false;
}
public get workingArea(): Rect {
return this.driver.screenSize;
}
constructor(private driver: TestDriver, screen: number) {
this.screen = screen;
}
public next(): ISurface {
return new TestSurface(this.driver, this.screen + 1);
}
}

View File

@ -1,60 +0,0 @@
// SPDX-FileCopyrightText: 2018-2019 Eon S. Jeon <esjeon@hyunmu.am>
// SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin <mail@genda.life>
//
// SPDX-License-Identifier: MIT
import IDriverWindow from "../src/idriver_window";
import ISurface from "../src/isurface";
import Rect from "../src/util/rect";
import TestSurface from "./test_surface";
export default class TestWindow implements IDriverWindow {
private static windowCount: number = 0;
public readonly id: string;
public readonly shouldFloat: boolean;
public readonly shouldIgnore: boolean;
public surface: TestSurface;
public fullScreen: boolean;
public geometry: Rect;
public keepAbove: boolean;
public maximized: boolean;
public noBorder: boolean;
constructor(
srf: TestSurface,
geometry?: Rect,
ignore?: boolean,
float?: boolean
) {
this.id = String(TestWindow.windowCount);
TestWindow.windowCount += 1;
this.shouldFloat = float !== undefined ? float : false;
this.shouldIgnore = ignore !== undefined ? ignore : false;
this.surface = srf;
this.fullScreen = false;
this.geometry = geometry || new Rect(0, 0, 100, 100);
this.keepAbove = false;
this.maximized = false;
this.noBorder = false;
}
public commit(geometry?: Rect, noBorder?: boolean, keepAbove?: boolean) {
if (geometry) this.geometry = geometry;
if (noBorder !== undefined) this.noBorder = noBorder;
if (keepAbove !== undefined) this.keepAbove = keepAbove;
}
public focus() {
// TODO: track focus
}
public visible(srf: ISurface): boolean {
const tctx = srf as TestSurface;
return this.surface.screen === tctx.screen;
}
}