File: 02session.t

package info (click to toggle)
libcircle-be-perl 0.173320-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 392 kB
  • sloc: perl: 6,042; makefile: 4; sh: 1
file content (45 lines) | stat: -rw-r--r-- 1,010 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use strict;
use warnings;

use Test::More tests => 5;
use Test::Identity;
use IO::Async::Test;

use IO::Async::Loop;

use Circle;
use t::CircleTest qw( get_session send_command );

my $loop = IO::Async::Loop->new;
testing_loop( $loop );

my ( $circle, $client ) = Circle->new_with_client( loop => $loop );

my $rootobj;
wait_for { $rootobj = $client->rootobj };

my $session = get_session $rootobj;

ok( $session->proxy_isa( "Circle.Session.Tabbed" ), '$session proxy isa Circle.Session.Tabbed' );

my $tabs;
$session->watch_property_with_initial(
   "tabs",
   on_updated => sub { $tabs = $_[0] },
)->get;

wait_for { $tabs };

is( scalar @$tabs, 1, '$tabs contains 1 item' );
identical( $tabs->[0], $rootobj, '$tabs->[0] is RootObj' );

undef $tabs;

send_command $rootobj, "networks add -type raw Test";

wait_for { $tabs };

is( scalar @$tabs, 2, '$tabs contains 2 items after /networks add' );

my $rawnet = $tabs->[1];
ok( $rawnet->proxy_isa( "Circle.Net.Raw" ), '$tabs->[1] proxy isa Circle.Net.Raw' );