use of org.jabref.gui.fieldeditors.HtmlTransferable in project jabref by JabRef.
the class CitationStyleToClipboardWorkerTest method processPreviewHtml.
@Test
public void processPreviewHtml() throws Exception {
String expected = "<font face=\"sans-serif\"><b><i>Article</i><a name=\"Smith2016\"> (Smith2016)</a></b><br>" + OS.NEWLINE + " Smith, B.; Jones, B. & Williams, J.<BR>" + OS.NEWLINE + " Taylor, P. <i>(Ed.)</i><BR>" + OS.NEWLINE + " Title of the test entry <BR>" + OS.NEWLINE + OS.NEWLINE + " <em>BibTeX Journal, </em>" + OS.NEWLINE + OS.NEWLINE + OS.NEWLINE + OS.NEWLINE + " <em>JabRef Publishing, </em>" + OS.NEWLINE + "<b>2016</b><i>, 34</i>, 45-67 " + OS.NEWLINE + "<BR><BR><b>Abstract: </b> This entry describes a test scenario which may be useful in JabRef. By providing a test entry it is possible to see how certain things will look in this graphical BIB-file mananger. " + OS.NEWLINE + "</dd>" + OS.NEWLINE + "<p></p></font>" + OS.NEWLINE + "<br>" + OS.NEWLINE + "<font face=\"sans-serif\"><b><i>Article</i><a name=\"Smith2016\"> (Smith2016)</a></b><br>" + OS.NEWLINE + " Smith, B.; Jones, B. & Williams, J.<BR>" + OS.NEWLINE + " Taylor, P. <i>(Ed.)</i><BR>" + OS.NEWLINE + " Title of the test entry <BR>" + OS.NEWLINE + OS.NEWLINE + " <em>BibTeX Journal, </em>" + OS.NEWLINE + OS.NEWLINE + OS.NEWLINE + OS.NEWLINE + " <em>JabRef Publishing, </em>" + OS.NEWLINE + "<b>2016</b><i>, 34</i>, 45-67 " + OS.NEWLINE + "<BR><BR><b>Abstract: </b> This entry describes a test scenario which may be useful in JabRef. By providing a test entry it is possible to see how certain things will look in this graphical BIB-file mananger. " + OS.NEWLINE + "</dd>" + OS.NEWLINE + "<p></p></font>";
String citation = "<font face=\"sans-serif\"><b><i>Article</i><a name=\"Smith2016\"> (Smith2016)</a></b><br>" + OS.NEWLINE + " Smith, B.; Jones, B. & Williams, J.<BR>" + OS.NEWLINE + " Taylor, P. <i>(Ed.)</i><BR>" + OS.NEWLINE + " Title of the test entry <BR>" + OS.NEWLINE + OS.NEWLINE + " <em>BibTeX Journal, </em>" + OS.NEWLINE + OS.NEWLINE + OS.NEWLINE + OS.NEWLINE + " <em>JabRef Publishing, </em>" + OS.NEWLINE + "<b>2016</b><i>, 34</i>, 45-67 " + OS.NEWLINE + "<BR><BR><b>Abstract: </b> This entry describes a test scenario which may be useful in JabRef. By providing a test entry it is possible to see how certain things will look in this graphical BIB-file mananger. " + OS.NEWLINE + "</dd>" + OS.NEWLINE + "<p></p></font>";
HtmlTransferable transferable = CitationStyleToClipboardWorker.processPreview(Arrays.asList(citation, citation));
Object actual = transferable.getTransferData(HtmlTransferable.HTML_FLAVOR);
Assert.assertEquals(expected, actual);
}
use of org.jabref.gui.fieldeditors.HtmlTransferable in project jabref by JabRef.
the class CitationStyleToClipboardWorkerTest method processPreviewText.
@Test
public void processPreviewText() throws Exception {
String expected = "Article (Smith2016)Smith, B.; Jones, B. & Williams, J.Taylor, P. (Ed.)Title of the test entry BibTeX Journal, JabRef Publishing, 2016, 34, 45-67 Abstract: This entry describes a test scenario which may be useful in JabRef. By providing a test entry it is possible to see how certain things will look in this graphical BIB-file mananger." + OS.NEWLINE + "Article (Smith2016)Smith, B.; Jones, B. & Williams, J.Taylor, P. (Ed.)Title of the test entry BibTeX Journal, JabRef Publishing, 2016, 34, 45-67 Abstract: This entry describes a test scenario which may be useful in JabRef. By providing a test entry it is possible to see how certain things will look in this graphical BIB-file mananger.";
String citation = "Article (Smith2016)" + OS.NEWLINE + "Smith, B.; Jones, B. & Williams, J." + OS.NEWLINE + "Taylor, P. (Ed.)" + OS.NEWLINE + "Title of the test entry " + OS.NEWLINE + "BibTeX Journal, JabRef Publishing, 2016, 34, 45-67 " + OS.NEWLINE + OS.NEWLINE + "Abstract: This entry describes a test scenario which may be useful in JabRef. By providing a test entry it is possible to see how certain things will look in this graphical BIB-file mananger. ";
HtmlTransferable HtmlTransferable = CitationStyleToClipboardWorker.processPreview(Arrays.asList(citation, citation));
Object actual = HtmlTransferable.getTransferData(DataFlavor.stringFlavor);
Assert.assertEquals(expected, actual);
}
use of org.jabref.gui.fieldeditors.HtmlTransferable in project jabref by JabRef.
the class CitationStyleToClipboardWorkerTest method processHtmlAsText.
@Test
public void processHtmlAsText() throws Exception {
String expected = "[1] B. Smith, B. Jones, and J. Williams, “Title of the test entry,” BibTeX Journal , vol. 34, no. 3, pp. 45–67, Jul. 2016." + OS.NEWLINE + "[1] B. Smith, B. Jones, and J. Williams, “Title of the test entry,” BibTeX Journal , vol. 34, no. 3, pp. 45–67, Jul. 2016.";
String citation = " <div class=\"csl-entry\">" + OS.NEWLINE + " <div class=\"csl-left-margin\">[1]</div><div class=\"csl-right-inline\">B. Smith, B. Jones, and J. Williams, “Title of the test entry,” <i>BibTeX Journal</i>, vol. 34, no. 3, pp. 45–67, Jul. 2016.</div>" + OS.NEWLINE + " </div>" + OS.NEWLINE;
HtmlTransferable htmlTransferable = CitationStyleToClipboardWorker.processHtml(Arrays.asList(citation, citation));
Object actual = htmlTransferable.getTransferData(DataFlavor.stringFlavor);
Assert.assertEquals(expected, actual);
}
use of org.jabref.gui.fieldeditors.HtmlTransferable in project jabref by JabRef.
the class CitationStyleToClipboardWorkerTest method processHtmlAsHtml.
@Test
public void processHtmlAsHtml() throws Exception {
String expected = "<!DOCTYPE html>" + OS.NEWLINE + "<html>" + OS.NEWLINE + " <head>" + OS.NEWLINE + " <meta charset=\"utf-8\">" + OS.NEWLINE + " </head>" + OS.NEWLINE + " <body>" + OS.NEWLINE + OS.NEWLINE + " <div class=\"csl-entry\">" + OS.NEWLINE + " <div class=\"csl-left-margin\">[1]</div><div class=\"csl-right-inline\">B. Smith, B. Jones, and J. Williams, “Title of the test entry,” <i>BibTeX Journal</i>, vol. 34, no. 3, pp. 45–67, Jul. 2016.</div>" + OS.NEWLINE + " </div>" + OS.NEWLINE + OS.NEWLINE + "<br>" + OS.NEWLINE + " <div class=\"csl-entry\">" + OS.NEWLINE + " <div class=\"csl-left-margin\">[1]</div><div class=\"csl-right-inline\">B. Smith, B. Jones, and J. Williams, “Title of the test entry,” <i>BibTeX Journal</i>, vol. 34, no. 3, pp. 45–67, Jul. 2016.</div>" + OS.NEWLINE + " </div>" + OS.NEWLINE + OS.NEWLINE + " </body>" + OS.NEWLINE + "</html>" + OS.NEWLINE;
String citation = " <div class=\"csl-entry\">" + OS.NEWLINE + " <div class=\"csl-left-margin\">[1]</div><div class=\"csl-right-inline\">B. Smith, B. Jones, and J. Williams, “Title of the test entry,” <i>BibTeX Journal</i>, vol. 34, no. 3, pp. 45–67, Jul. 2016.</div>" + OS.NEWLINE + " </div>" + OS.NEWLINE;
HtmlTransferable htmlTransferable = CitationStyleToClipboardWorker.processHtml(Arrays.asList(citation, citation));
Object actual = htmlTransferable.getTransferData(DataFlavor.allHtmlFlavor);
Assert.assertEquals(expected, actual);
}
Aggregations