Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
2e0c75c1
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
10 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2e0c75c1
编写于
8月 02, 2019
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add tabs to show both suite/script content and test results
上级
3e3dd170
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
7 deletion
+92
-7
src/ui/pageMain.go
src/ui/pageMain.go
+1
-1
src/ui/pageTesting.go
src/ui/pageTesting.go
+75
-6
src/ui/uiUtils.go
src/ui/uiUtils.go
+16
-0
未找到文件。
src/ui/pageMain.go
浏览文件 @
2e0c75c1
...
...
@@ -33,7 +33,7 @@ func InitMainPage(g *gocui.Gui) error {
x
+=
10
}
mainView
:=
NewPanelWidget
(
g
,
"main"
,
utils
.
LeftWidth
,
0
,
maxX
-
1
-
utils
.
LeftWidth
,
utils
.
MainViewHeight
,
""
)
mainView
:=
NewPanelWidget
(
g
,
"main"
,
utils
.
LeftWidth
,
0
,
maxX
-
utils
.
LeftWidth
-
1
,
utils
.
MainViewHeight
,
""
)
ViewMap
[
"root"
]
=
append
(
ViewMap
[
"root"
],
mainView
.
Name
())
mainView
.
Wrap
=
true
...
...
src/ui/pageTesting.go
浏览文件 @
2e0c75c1
...
...
@@ -10,8 +10,10 @@ import (
)
var
CurrAsset
string
var
tabs
[]
string
func
InitTestingPage
(
g
*
gocui
.
Gui
)
error
{
// left
caseFiles
,
suitesFiles
:=
loadTestAssets
()
dir
:=
utils
.
Prefer
.
WorkDir
+
utils
.
GenDir
...
...
@@ -28,13 +30,14 @@ func InitTestingPage(g *gocui.Gui) error {
}
utils
.
PrintToSide
(
g
,
content
)
// right
setViewScroll
(
g
,
"side"
)
setViewLineSelected
(
g
,
"side"
,
select
Line
Event
)
setViewLineSelected
(
g
,
"side"
,
select
Asset
Event
)
return
nil
}
func
select
Line
Event
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
func
select
Asset
Event
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
var
line
string
var
err
error
...
...
@@ -57,20 +60,73 @@ func showAsset(g *gocui.Gui, file string) {
HideHelp
(
g
)
CurrAsset
=
utils
.
Prefer
.
WorkDir
+
utils
.
GenDir
+
file
showRunButton
(
g
)
showTab
(
g
)
defaultTab
,
_
:=
g
.
View
(
"tabContentView"
)
showContent
(
g
,
defaultTab
)
content
:=
utils
.
ReadFile
(
CurrAsset
)
utils
.
PrintToMainNoScroll
(
g
,
content
)
panelFileContent
,
_
:=
g
.
View
(
"panelFileContent"
)
panelFileContent
.
Clear
()
fmt
.
Fprintln
(
panelFileContent
,
content
)
}
func
showRunButton
(
g
*
gocui
.
Gui
)
error
{
func
showTab
(
g
*
gocui
.
Gui
)
error
{
x
:=
utils
.
LeftWidth
+
1
tabContentView
:=
NewLabelWidgetAutoWidth
(
g
,
"tabContentView"
,
x
,
0
,
"Content"
)
ViewMap
[
"testing"
]
=
append
(
ViewMap
[
"testing"
],
tabContentView
.
Name
())
tabs
=
append
(
tabs
,
tabContentView
.
Name
())
if
err
:=
g
.
SetKeybinding
(
"tabContentView"
,
gocui
.
MouseLeft
,
gocui
.
ModNone
,
showContent
);
err
!=
nil
{
return
nil
}
tabResultView
:=
NewLabelWidgetAutoWidth
(
g
,
"tabResultView"
,
x
+
12
,
0
,
"Results"
)
ViewMap
[
"testing"
]
=
append
(
ViewMap
[
"testing"
],
tabResultView
.
Name
())
tabs
=
append
(
tabs
,
tabResultView
.
Name
())
if
err
:=
g
.
SetKeybinding
(
"tabResultView"
,
gocui
.
MouseLeft
,
gocui
.
ModNone
,
shoRun
);
err
!=
nil
{
return
nil
}
return
nil
}
func
showContent
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
DestoryRunPanel
(
g
)
HighlightTab
(
v
.
Name
(),
tabs
)
maxX
,
_
:=
g
.
Size
()
panelFileContent
:=
NewPanelWidget
(
g
,
"panelFileContent"
,
utils
.
LeftWidth
,
2
,
maxX
-
utils
.
LeftWidth
-
1
,
utils
.
MainViewHeight
,
"panelFileContent"
)
ViewMap
[
"testing"
]
=
append
(
ViewMap
[
"testing"
],
panelFileContent
.
Name
())
runButton
:=
NewButtonWidgetAutoWidth
(
g
,
"runButton"
,
maxX
-
10
,
1
,
"Run"
,
run
)
runButton
:=
NewButtonWidgetAutoWidth
(
g
,
"runButton"
,
maxX
-
10
,
0
,
"Run"
,
run
)
runButton
.
Frame
=
false
ViewMap
[
"testing"
]
=
append
(
ViewMap
[
"testing"
],
runButton
.
Name
())
return
nil
}
func
shoRun
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
DestoryContentPanel
(
g
)
HighlightTab
(
v
.
Name
(),
tabs
)
h
:=
utils
.
MainViewHeight
/
2
maxX
,
_
:=
g
.
Size
()
panelResultList
:=
NewPanelWidget
(
g
,
"panelResultList"
,
utils
.
LeftWidth
,
2
,
60
,
h
,
"panelResultList"
)
ViewMap
[
"testing"
]
=
append
(
ViewMap
[
"testing"
],
panelResultList
.
Name
())
panelCaseList
:=
NewPanelWidget
(
g
,
"panelCaseList"
,
utils
.
LeftWidth
,
h
+
2
,
60
,
utils
.
MainViewHeight
-
h
,
"panelCaseList"
)
ViewMap
[
"testing"
]
=
append
(
ViewMap
[
"testing"
],
panelCaseList
.
Name
())
panelCaseResult
:=
NewPanelWidget
(
g
,
"panelCaseResult"
,
utils
.
LeftWidth
+
60
,
2
,
maxX
-
utils
.
LeftWidth
-
61
,
utils
.
MainViewHeight
,
"panelCaseResult"
)
ViewMap
[
"testing"
]
=
append
(
ViewMap
[
"testing"
],
panelCaseResult
.
Name
())
return
nil
}
func
run
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
if
_
,
err
:=
g
.
SetCurrentView
(
"main"
);
err
!=
nil
{
return
err
...
...
@@ -104,3 +160,16 @@ func DestoryTestingPage(g *gocui.Gui) {
g
.
DeleteKeybindings
(
v
)
}
}
func
DestoryContentPanel
(
g
*
gocui
.
Gui
)
{
for
_
,
v
:=
range
[]
string
{
"panelFileContent"
,
"panelCaseList"
,
"panelCaseResult"
}
{
g
.
DeleteView
(
v
)
g
.
DeleteKeybindings
(
v
)
}
}
func
DestoryRunPanel
(
g
*
gocui
.
Gui
)
{
for
_
,
v
:=
range
[]
string
{
"panelResultList"
,
"runButton"
}
{
g
.
DeleteView
(
v
)
g
.
DeleteKeybindings
(
v
)
}
}
src/ui/uiUtils.go
浏览文件 @
2e0c75c1
...
...
@@ -148,3 +148,19 @@ func setInputEvent(g *gocui.Gui, name string) error {
}
return
nil
}
func
HighlightTab
(
view
string
,
views
[]
string
)
{
for
_
,
name
:=
range
views
{
v
,
_
:=
utils
.
Cui
.
View
(
name
)
if
v
.
Name
()
==
view
{
v
.
Highlight
=
true
v
.
SelBgColor
=
gocui
.
ColorWhite
v
.
SelFgColor
=
gocui
.
ColorBlack
}
else
{
v
.
Highlight
=
false
v
.
SelBgColor
=
gocui
.
ColorBlack
v
.
SelFgColor
=
gocui
.
ColorDefault
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录