Skip to content

Commit ef6f0c3

Browse files
committed
Tabs and Row basic test
Tabs test doesn't work
1 parent df39a83 commit ef6f0c3

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed
4.95 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pytest
2+
3+
import flet as ft
4+
import flet.testing as ftt
5+
6+
7+
@pytest.mark.asyncio(loop_scope="module")
8+
async def test_row_basic(flet_app: ftt.FletTestApp, request):
9+
flet_app.page.theme_mode = ft.ThemeMode.LIGHT
10+
await flet_app.assert_control_screenshot(
11+
request.node.name,
12+
ft.Row(
13+
controls=[ft.Text("Item1"), ft.Text("Item2"), ft.Text("Item3")],
14+
),
15+
)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import pytest
2+
3+
import flet as ft
4+
import flet.testing as ftt
5+
6+
7+
@pytest.mark.asyncio(loop_scope="module")
8+
async def test_tabs_basic(flet_app: ftt.FletTestApp, request):
9+
flet_app.page.theme_mode = ft.ThemeMode.LIGHT
10+
await flet_app.assert_control_screenshot(
11+
request.node.name,
12+
ft.Tabs(
13+
# selected_index=1,
14+
length=2,
15+
expand=True,
16+
content=ft.Column(
17+
expand=True,
18+
controls=[
19+
ft.TabBar(
20+
tabs=[
21+
ft.Tab(label="Tab 1"),
22+
ft.Tab(label="Tab 2", icon=ft.Icons.SETTINGS),
23+
# ft.Tab(
24+
# label=ft.CircleAvatar(
25+
# foreground_image_src="https://avatars.githubusercontent.com/u/7119543?s=88&v=4"
26+
# ),
27+
# ),
28+
]
29+
),
30+
ft.TabBarView(
31+
expand=True,
32+
controls=[
33+
ft.Container(
34+
content=ft.Text("This is Tab 1"),
35+
alignment=ft.Alignment.CENTER,
36+
),
37+
# ft.Container(
38+
# content=ft.Text("This is Tab 2"),
39+
# alignment=ft.Alignment.CENTER,
40+
# ),
41+
ft.Container(
42+
content=ft.Text("This is Tab 3"),
43+
alignment=ft.Alignment.CENTER,
44+
),
45+
],
46+
),
47+
],
48+
),
49+
),
50+
)

0 commit comments

Comments
 (0)