1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #ifndef _U2_GT_UTILS_ASSEMBLY_BROWSER_H_
23 #define _U2_GT_UTILS_ASSEMBLY_BROWSER_H_
24 
25 #include <GTGlobals.h>
26 
27 #include <QModelIndex>
28 #include <QScrollBar>
29 
30 namespace U2 {
31 
32 class AssemblyBrowserUi;
33 class AssemblyModel;
34 
35 class GTUtilsAssemblyBrowser {
36 public:
37     enum Area {
38         Consensus,
39         Overview,
40         Reads
41     };
42 
43     enum Method {
44         Button,
45         Hotkey
46     };
47 
48     /** Returns opened assembly browser window. Fails if not found. */
49     static QWidget *getActiveAssemblyBrowserWindow(HI::GUITestOpStatus &os);
50 
51     /** Checks that assembly browser view is opened and is active and fails if not. */
52     static void checkAssemblyBrowserWindowIsActive(HI::GUITestOpStatus &os);
53 
54     static AssemblyBrowserUi *getView(HI::GUITestOpStatus &os, const QString &viewTitle = "");
55 
56     static void addRefFromProject(HI::GUITestOpStatus &os, QString docName, QModelIndex parent = QModelIndex());
57 
58     static bool hasReference(HI::GUITestOpStatus &os, const QString &viewTitle);
59     static bool hasReference(HI::GUITestOpStatus &os, QWidget *view = nullptr);
60     static bool hasReference(HI::GUITestOpStatus &os, AssemblyBrowserUi *assemblyBrowser);
61 
62     static qint64 getLength(HI::GUITestOpStatus &os);
63     static qint64 getReadsCount(HI::GUITestOpStatus &os);
64 
65     static bool isWelcomeScreenVisible(HI::GUITestOpStatus &os);
66 
67     static void zoomIn(HI::GUITestOpStatus &os, Method method = Button);
68     static void zoomToMax(HI::GUITestOpStatus &os);
69     static void zoomToMin(HI::GUITestOpStatus &os);
70     static void zoomToReads(HI::GUITestOpStatus &os);
71 
72     static void goToPosition(HI::GUITestOpStatus &os, qint64 position, Method method = Hotkey);
73 
74     static void callContextMenu(HI::GUITestOpStatus &os, Area area = Consensus);
75     static void callExportCoverageDialog(HI::GUITestOpStatus &os, Area area = Consensus);
76 
77     static QScrollBar *getScrollBar(HI::GUITestOpStatus &os, Qt::Orientation orientation);
78 
79     static void scrollToStart(HI::GUITestOpStatus &os, Qt::Orientation orientation);
80 };
81 
82 }  // namespace U2
83 
84 #endif  // _U2_GT_UTILS_ASSEMBLY_BROWSER_H_
85