# Copyright (c) 2002 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: View.bunit,v 1.6 2010/04/24 21:39:00 nagler Exp $ config({ 'Bivio::IO::ClassLoader' => { maps => { View => [qw( Bivio::UI::t::View Bivio::PetShop::View Bivio::UI::View )], }, }, }); Request('initialize_fully'); die('only works in PetShop facade') unless req('Bivio::UI::Facade', 'uri') =~ /petshop/; # For ViewSource widget in PetShop symlink('.', 'src') unless -e 'src'; options({ compute_return => sub { my($case, $actual) = @_; return $case->get('method') eq 'execute' ? [req('reply')->get_output] : $actual; }, }); [ class() => [ execute => [ [\(<<'EOF'), req()] view_shortcuts('UIHTML.ViewShortcuts'); view_class_map('HTMLWidget'); view_main(Page({ head => Join(['hello']), body => Join(['goodbye']), })); EOF => qr{hello.*goodbye}s, ['main', req()] => undef, [sub { # Can't AUTOLOAD, because Bivio::Test::Unit already has it. # This works well enough, but normally, you would just # "use Bivio::UI::ViewLanguageAUTOLOAD;" to get this behavior. package Bivio::UI::ViewLanguage; view_class_map('HTMLWidget'); view_shortcuts('UIHTML.ViewShortcuts'); view_main(SimplePage('Simple')); }, req()] => qr{^Simple$}s, ], ], sub {class('View.T1')} => [ execute => [ [t1_html => req()] => qr{^t1$}s, [t2_html => req()] => qr{Pet Shop Demo.*