<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- $Id$ -->
<testcase>
  <info>
    <p>
      This test checks the PDF embedded file extension,
      and a link to an embedded file.
    </p>
  </info>
  <fo>
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="simple">
          <fo:region-body />
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:declarations>
        <pdf:embedded-file filename="test.png" description="This is just a png image" src="../resources/images/arrow_down_large.png"/>
      </fo:declarations>
      <fo:page-sequence master-reference="simple">
        <fo:flow flow-name="xsl-region-body">
          <fo:block>
            See the 
            <fo:basic-link external-destination="url(embedded-file:test.png)">attached file</fo:basic-link>
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </fo>
  <checks xmlns:pdf="apache:fop:extensions:pdf">
    <eval expected="test.png" xpath="//extension-attachments/pdf:embedded-file/@filename"/>
    <eval expected="This is just a png image" xpath="//extension-attachments/pdf:embedded-file/@description"/>
    <eval expected="../resources/images/arrow_down_large.png" xpath="//extension-attachments/pdf:embedded-file/@src"/>
    <eval expected="newWindow=false,dest=embedded-file:test.png" xpath="//inlineparent/@external-link"/>
  </checks>
  <if-checks xmlns:if="http://xmlgraphics.apache.org/fop/intermediate" xmlns:nav="http://xmlgraphics.apache.org/fop/intermediate/document-navigation" xmlns:pdf="apache:fop:extensions:pdf">
    <eval expected="test.png" xpath="//if:header/pdf:embedded-file/@filename"/>
    <eval expected="This is just a png image" xpath="//if:header/pdf:embedded-file/@description"/>
    <eval expected="../resources/images/arrow_down_large.png" xpath="//if:header/pdf:embedded-file/@src"/>
    <eval expected="embedded-file:test.png" xpath="//if:page-trailer/nav:link/nav:goto-uri/@uri"/>
  </if-checks>
</testcase>