# Copyright (c) 2006 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: TupleSlotTypeListForm.bunit,v 1.5 2009/05/01 17:11:41 nagler Exp $ require './TupleListForm.PL'; model('TupleSlotType')->delete_all; model('TupleSlotType')->create_from_hash({ Exist1 => { type_class => 'Integer', choices => [-1, -2, -3], default_value => -2, }, }); my($exists_id) = req(qw(Model.TupleSlotType tuple_slot_type_id)); my($string) = model('TupleSlotType')->DEFAULT_CLASS; [ empty_case({ 'TupleSlotType.type_class' => $string, map(("key_$_" => model('TupleSlotChoiceList')->EMPTY_KEY_VALUE), 0 .. class()->ROW_INCREMENT - 1), }), simple_case($exists_id, { 'TupleSlotType.label' => 'Exist1', 'TupleSlotType.type_class' => 'Integer', 'TupleSlotType.default_value' => -2, choice_0 => -1, choice_1 => -2, choice_2 => -3, key_0 => 1, key_1 => 2, key_3 => 3, map(("key_$_" => model('TupleSlotChoiceList')->EMPTY_KEY_VALUE), 3 .. 3 + class()->ROW_INCREMENT - 1), }), [{ 'TupleSlotType.label' => 'Tstl1', 'TupleSlotType.type_class' => $string, 'TupleSlotType.default_value' => '', empty_row_count => 0, }] => [{ 'Model.TupleSlotType' => { label => 'Tstl1', type_class => 'String', choices => class('Type.TupleSlotArray')->new([]), default_value => undef, }, }], error_case({ 'TupleSlotType.label' => 'Tstl2', 'TupleSlotType.type_class' => $string, 'TupleSlotType.default_value' => 1, choice_0 => 1, choice_1 => 1, empty_row_count => 2, }, { choice_1 => 'EXISTS', }), error_case({ 'TupleSlotType.label' => 'Tstl2', 'TupleSlotType.type_class' => $string, 'TupleSlotType.default_value' => 3, choice_0 => 1, choice_1 => 2, empty_row_count => 2, }, { 'TupleSlotType.default_value' => 'NOT_FOUND', }), ];