-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
This file is part of KDDockWidgets. | ||
SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
Author: Sérgio Martins <[email protected]> | ||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only | ||
Contact KDAB at <[email protected]> for commercial licensing options. | ||
*/ | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:KDDockWidgets/KDDockWidgets.dart'; | ||
import 'package:KDDockWidgets/private/Bindings.dart'; | ||
|
||
void main() { | ||
test('Dockregistry', () { | ||
final dr = DockRegistry.instance; | ||
expect(dr.dockItems.isEmpty, true); | ||
expect(dr.floatingItems.isEmpty, true); | ||
|
||
final dock = DockItem(uniqueName: "dw1"); | ||
|
||
expect(dr.dockItems.length, 1); | ||
expect(dr.floatingItems.isEmpty, true); | ||
|
||
final fw = FloatingItem(); | ||
fw.dropArea.addDockItem(dock, Location.LocationOnTop); | ||
expect(dr.dockItems.length, 1); | ||
expect(dr.floatingItems.isEmpty, false); | ||
expect(fw.dropArea.groups.length, 1); | ||
expect(dr.dockItems.length, 1); | ||
expect(dr.floatingItems.length, 1); | ||
|
||
fw.dropArea.groups.first.titlebar.onCloseClicked(); | ||
expect(dr.dockItems.length, 1); // dock items are persistent | ||
expect(dr.floatingItems.isEmpty, true); // discarded when empty | ||
expect(fw.dropArea.groups.isEmpty, true); | ||
|
||
final dock2 = DockItem(uniqueName: "dw2"); | ||
|
||
final fw2 = FloatingItem(); | ||
fw2.dropArea.addDockItem(dock2, Location.LocationOnTop); | ||
expect(dr.floatingItems.length, 1); | ||
fw2.dropArea.removeDockItem(fw2.dropArea.groups.first.currentDockItem!); | ||
expect(dr.floatingItems.isEmpty, true); | ||
}); | ||
} |