diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-04-26 20:04:50 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-04-26 20:04:50 +0000 |
commit | c4481e7345f7dfe83ca4503af94f33928f973e70 (patch) | |
tree | 710036ecc510397af3a700ef4f0816bf87294a06 /t/lib | |
parent | db430ae8eb228482cbee8cc3c8a04c3aac30d606 (diff) | |
download | reaction-c4481e7345f7dfe83ca4503af94f33928f973e70.tar.gz reaction-c4481e7345f7dfe83ca4503af94f33928f973e70.zip |
made layoutset name generation smarter, basic tests for name generation
Diffstat (limited to 't/lib')
-rw-r--r-- | t/lib/RTest/UI/View.pm | 32 | ||||
-rw-r--r-- | t/lib/RTest/UI/Window.pm | 7 |
2 files changed, 34 insertions, 5 deletions
diff --git a/t/lib/RTest/UI/View.pm b/t/lib/RTest/UI/View.pm new file mode 100644 index 0000000..4450e2d --- /dev/null +++ b/t/lib/RTest/UI/View.pm @@ -0,0 +1,32 @@ +package RTest::UI::View; + +use base qw/Reaction::Test/; +use Reaction::Class; +use Test::More (); +use Reaction::UI::View ; + + +#has 'view' => (isa => 'Reaction::UI::View', is => 'ro', lazy_build => 1); +#view doesn't yet have TCs for this so ican get away with it ... +#sub _build_view { +# Reaction::UI::View->new( +# ); +#} + +sub test_layoutset_name_generation :Tests { + my $self = shift; + my %cases = + ( + 'MyApp::ViewPort::FooBar' => 'foo_bar', + 'Reaction::UI::ViewPort::Foo_Bar' => 'foo_bar', + 'MyApp::UI::ViewPort::FOOBar::fooBAR' => 'foo_bar/foo_bar', + 'Reaction::UI::ViewPort::FooBARBaz::FooBAR_' => 'foo_bar_baz/foo_bar_', + ); + while(my($class,$layout) = each %cases ){ + my $res = Reaction::UI::View->layout_set_name_from_viewport($class); + Test::More::is($res,$layout,"layoutset name for $class") + } + +} + +1; diff --git a/t/lib/RTest/UI/Window.pm b/t/lib/RTest/UI/Window.pm index 2528f03..0f43ab1 100644 --- a/t/lib/RTest/UI/Window.pm +++ b/t/lib/RTest/UI/Window.pm @@ -33,12 +33,9 @@ use Test::More (); use Reaction::UI::Window; use aliased 'RTest::UI::Window::_::TestViewPort'; -has 'window' => ( - isa => 'Reaction::UI::Window', is => 'rw', - set_or_lazy_build('window') -); +has 'window' => (isa => 'Reaction::UI::Window', is => 'rw', lazy_build => 1); -sub build_window { +sub _build_window { my $self = shift; return Reaction::UI::Window->new( ctx => bless({}, 'Reaction::Test::Mock::Context'), |