From 11758a0f1c8c84aaba28fea5b7d9baf4c8dc7cbd Mon Sep 17 00:00:00 2001 From: Niki Date: Thu, 7 Mar 2019 12:51:16 +0100 Subject: [PATCH] wip --- .../reader/tui/TuiReaderApplication.java | 1 + .../fanfix/reader/tui/TuiReaderMainWindow.java | 18 +++++++++++------- src/be/nikiroo/fanfix/test/ConversionTest.java | 16 +++++++++++----- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java b/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java index 1de62a4..89034e4 100644 --- a/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java +++ b/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java @@ -180,6 +180,7 @@ class TuiReaderApplication extends TApplication implements Reader { } else { main.setSource(source); } + main.maximize(); } } diff --git a/src/be/nikiroo/fanfix/reader/tui/TuiReaderMainWindow.java b/src/be/nikiroo/fanfix/reader/tui/TuiReaderMainWindow.java index 528ee3d..b54d2cb 100644 --- a/src/be/nikiroo/fanfix/reader/tui/TuiReaderMainWindow.java +++ b/src/be/nikiroo/fanfix/reader/tui/TuiReaderMainWindow.java @@ -43,24 +43,28 @@ class TuiReaderMainWindow extends TWindow { this.reader = reader; - maximize(); - listKeys = new ArrayList(); listItems = new ArrayList(); // TODO size + onResize + + + addLabel("Search: ", 5, 3); + addField(15, 3, 5, true); + addLabel("Sort by: ", 5, 1); // -1 = no default index (0 means first,...) 1=height when visible, null // = action + List data = Arrays.asList("(show all)", "Source", "Name", "Author"); + // must be last so to be able to draw over the rest + // TODO: make it so we cannot add manual entries + // TODO: how to select the item via keyboard? why double-click via mouse? addComboBox(15, 1, 12, - Arrays.asList("(show all)", "Source", "Name", "Author"), 0, 1, + data, 0, Math.min(data.size()+1,getHeight()-1-1), null); - addLabel("Search: ", 5, 3); - addField(15, 3, 12, true); - - list = addList(listItems, 0, 5, getWidth(), getHeight(), new TAction() { + list = addList(listItems, 0, 7, getWidth(), getHeight(), new TAction() { @Override public void DO() { MetaData meta = getSelectedMeta(); diff --git a/src/be/nikiroo/fanfix/test/ConversionTest.java b/src/be/nikiroo/fanfix/test/ConversionTest.java index 51b6deb..c59a3db 100644 --- a/src/be/nikiroo/fanfix/test/ConversionTest.java +++ b/src/be/nikiroo/fanfix/test/ConversionTest.java @@ -172,11 +172,17 @@ class ConversionTest extends TestLauncher { }; } - List resultFiles = Arrays.asList(resultDir.list(filter)); - resultFiles.sort(null); - List expectedFiles = Arrays.asList(expectedDir.list(filter)); - expectedFiles.sort(null); - + List resultFiles; + List expectedFiles; + { + String[] resultArr = resultDir.list(filter); + Arrays.sort(resultArr); + resultFiles = Arrays.asList(resultArr); + String[] expectedArr = expectedDir.list(filter); + Arrays.sort(expectedArr); + expectedFiles = Arrays.asList(expectedArr); + } + testCase.assertEquals(errMess, expectedFiles, resultFiles); for (int i = 0; i < resultFiles.size(); i++) { -- 2.27.0