You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BorderPropsTestCase.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright 2006 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.traits;
  18. import org.apache.fop.area.Trait;
  19. import org.apache.fop.fo.Constants;
  20. import junit.framework.TestCase;
  21. /**
  22. * Tests the BorderProps class.
  23. */
  24. public class BorderPropsTestCase extends TestCase {
  25. /**
  26. * Test serialization and deserialization to/from String.
  27. * @throws Exception if an error occurs
  28. */
  29. public void testSerialization() throws Exception {
  30. Trait.Color col = new Trait.Color(1.0f, 1.0f, 0.5f, 1.0f);
  31. //Normalize: Avoid false alarms due to color conversion (rounding)
  32. col = Trait.Color.valueOf(col.toString());
  33. BorderProps b1 = new BorderProps(Constants.EN_DOUBLE, 1250,
  34. col, BorderProps.COLLAPSE_OUTER);
  35. String ser = b1.toString();
  36. BorderProps b2 = BorderProps.valueOf(ser);
  37. assertEquals(b1, b2);
  38. b1 = new BorderProps(Constants.EN_INSET, 9999,
  39. col, BorderProps.SEPARATE);
  40. ser = b1.toString();
  41. b2 = BorderProps.valueOf(ser);
  42. assertEquals(b1, b2);
  43. }
  44. }