From 26280306fb4922810b16a22c050ca7ee35bd24a5 Mon Sep 17 00:00:00 2001 From: Mikhail Zolotukhin Date: Mon, 18 Oct 2021 21:54:40 +0300 Subject: [PATCH] refactor: remove tests directory, since it's not used --- test/test_driver.ts | 49 ------------------------------------ test/test_surface.ts | 33 ------------------------ test/test_window.ts | 60 -------------------------------------------- 3 files changed, 142 deletions(-) delete mode 100644 test/test_driver.ts delete mode 100644 test/test_surface.ts delete mode 100644 test/test_window.ts diff --git a/test/test_driver.ts b/test/test_driver.ts deleted file mode 100644 index 621f7233..00000000 --- a/test/test_driver.ts +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-FileCopyrightText: 2018-2019 Eon S. Jeon -// SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin -// -// 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; - } -} diff --git a/test/test_surface.ts b/test/test_surface.ts deleted file mode 100644 index cb1f3aa7..00000000 --- a/test/test_surface.ts +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-FileCopyrightText: 2018-2019 Eon S. Jeon -// SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin -// -// 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); - } -} diff --git a/test/test_window.ts b/test/test_window.ts deleted file mode 100644 index 43314d4d..00000000 --- a/test/test_window.ts +++ /dev/null @@ -1,60 +0,0 @@ -// SPDX-FileCopyrightText: 2018-2019 Eon S. Jeon -// SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin -// -// 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; - } -}