From 1e856963b6c483b5e73c44e9b7b6d4d44b30bae8 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 13 Mar 2018 15:58:43 +0000 Subject: [PATCH] JAL-2839 additional test case --- test/jalview/analysis/FinderTest.java | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/test/jalview/analysis/FinderTest.java b/test/jalview/analysis/FinderTest.java index e959e62..f05bfb3 100644 --- a/test/jalview/analysis/FinderTest.java +++ b/test/jalview/analysis/FinderTest.java @@ -670,4 +670,51 @@ public class FinderTest assertEquals(match.getStart(), 6); assertEquals(match.getEnd(), 6); } + + @Test(groups = "Functional") + public void testFind_withHiddenColumnsAndSelection() + { + /* + * 0 5 9 + * ABCD--EF-GHI + * A--BCDefHI + * --bcdEFH + * aa---aMMMMMaaa + */ + + /* + * hide columns 2-4 and 6-7 + */ + HiddenColumns hc = new HiddenColumns(); + hc.hideColumns(2, 4); + hc.hideColumns(6, 7); + al.setHiddenColumns(hc); + + /* + * select rows 2-3 + */ + SequenceGroup sg = new SequenceGroup(); + sg.addSequence(al.getSequenceAt(1), false); + sg.addSequence(al.getSequenceAt(2), false); + sg.setStartRes(0); + sg.setEndRes(13); + + /* + * find all search for A or H + * should match seq2/1, seq2/7, not seq3/6 + */ + Finder f = new Finder(al, sg); + f.setFindAll(true); + f.find("[AH]"); + SearchResultsI searchResults = f.getSearchResults(); + assertEquals(searchResults.getSize(), 2); + SearchResultMatchI match = searchResults.getResults().get(0); + assertSame(match.getSequence(), al.getSequenceAt(1)); + assertEquals(match.getStart(), 1); + assertEquals(match.getEnd(), 1); + match = searchResults.getResults().get(1); + assertSame(match.getSequence(), al.getSequenceAt(1)); + assertEquals(match.getStart(), 7); + assertEquals(match.getEnd(), 7); + } } -- 1.7.10.2